http://stackoverflow.com/comment/39516039
type: Comment
comment on: http://stackoverflow.com/q/25343629
has text: It looks like the `FXMLLoader` is trying to assign a `Button` to the field that's supposed to hold your `MainApp`. Showing the FXML along with (at least) the parts of the controller that are pertinent to the `mainApp` property would help. As an aside, a controller having a reference to the application code that uses it is usually a bad design.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39317560
comment on: http://stackoverflow.com/a/25238041
type: AnswerComment
has text: @miro: I cant get the length
type: Comment
score: 0

http://stackoverflow.com/q/25337976
tagged with: websocket
downvote count: 0
tagged with: javascript
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39503606
has title: Calling different Java services with the same Websocket session
tagged with: session
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39503518
type: Question
has body: I've defined a websocket in JavaScript like so: var waitAndSend = "ws://localhost:8080/WebSocket/firstService" And call with websocket.send(message); This calls a service defined in Java like so: @ServerEndpoint(value="/firstService") public class FirstService { //...@OnOpen omitted... @OnMessage public void onMessage (Session peer) { //do stuff } } Which is all fine and dandy but I'd like to call a different service from the same browser session. And I'd like that Java webservice to have access to the same Websocket session on the server side. I attempted this by defining a another websocket in the JavaScript and Java but then realised that I'd need to call the new services @onOpen method which would start a 2nd session. So how do I get multiple services to operate under the same session?
answer count: 0
linked to: http://stackoverflow.com/q/17280455
type: UnansweredQuestion

http://stackoverflow.com/comment/39443958
has text: You absolutely need *some* form of window to act as the message destination (otherwise what handle will you use for the WindowProc?). Win32 may have some special types of hidden windows you can use for this purpose, but to start with just make your own JFrame and get its native window handle.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25246353

http://stackoverflow.com/a/25297421
has comment: http://stackoverflow.com/comment/39455631
has comment: http://stackoverflow.com/comment/39428245
has comment: http://stackoverflow.com/comment/39452632
type: Answer
has comment: http://stackoverflow.com/comment/39427320
answers question: http://stackoverflow.com/q/25297333
score: 1
has body: Use try-with-resources: try (FileInputStream fis = new FileInputStream("some.file")) { // some code here } To answer the question of why the recommended pattern is the way it is, consider the fact that new FileInputStream(String) throws a checked exception that you should probably catch; The FileInputStream fis = null; try { fis = new FileInputStream("somefile.txt"); } catch (FileNotFoundException e) { return false; } finally { if (fis != null) { fis.close(); } } allows you to handle it in the same try/catch block as your other file-related exceptions. This has brevity and reduced nesting advantages over the following: try { FileInputStream fis = new FileInputStream("some.file"); try { // do something useful with fis } finally { fis.close(); } } catch (FileNotFoundException e) { return false; } And if you're not catching the exception and just letting it propagate, then your suggestion is cleaner - however given the heavy use of checked exceptions in the IO libraries (including from class constructors), catching and handling an exception is common enough, and I think it makes sense to have just one pattern for tutorial purposes instead of showing someone a slightly different pattern each time.
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25260029
has comment: http://stackoverflow.com/comment/39358108
has comment: http://stackoverflow.com/comment/39357586
downvote count: 0
accepted answer: http://stackoverflow.com/a/25261157
answer count: 7
has comment: http://stackoverflow.com/comment/39358941
upvote count: 1
has answer: http://stackoverflow.com/a/25261157
has comment: http://stackoverflow.com/comment/39357371
favorite count: 0
has comment: http://stackoverflow.com/comment/39357437
has comment: http://stackoverflow.com/comment/39357440
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/49551566
has answer: http://stackoverflow.com/a/38685174
has title: Null Pointer Exception in JDBC
has answer: http://stackoverflow.com/a/25260082
score: 1
has answer: http://stackoverflow.com/a/25261110
tagged with: java
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39357644
has body: I'm trying to execute a Java file, but when I do I get an error NullPointerException in this part of the program. import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; import java.sql.SQLException; public class HiveClient { // JDBC driver required for Hive connections private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; private static Connection con; private static Connection getConnection(String ip, String port, String user, String password) { try { // dynamically load the Hive JDBC driver Class.forName(driverName); } catch (ClassNotFoundException e) { System.out.println(e.getMessage()); return null; } // try catch try { // return a connection based on the Hive JDBC driver return DriverManager.getConnection("jdbc:hive://" + ip + ":" + port + "/default?user=" + user + "&amp;password=" + password); } catch (SQLException e) { System.out.println(e.getMessage()); return null; } // try catch } // getConnection public static void main(String[] args) { try { // from here on, everything is SQL! con = getConnection("130.206.80.46", "10000", "myuser", "mypasswd"); Statement stmt = con.createStatement(); ResultSet res = stmt.executeQuery("select column1,column2,otherColumns " + "from mytable where column1='whatever' and columns2 like '%whatever%'"); // iterate on the result while (res.next()) { String column1 = res.getString(1); Integer column2 = res.getInt(2); // whatever you want to do with this row, here } // while // close everything res.close(); stmt.close(); con.close(); } catch (SQLException ex) { System.exit(0); } // try catch } // doQuery } // HiveClient This is the message: Exception in thread "main" java.lang.NullPointerException at HiveClient.main(HiveClient.java:34) Java Result: 1 The line the exception is at: Statement stmt = con.createStatement(); I've checked the java.sql.Connection package and createStatement() is allowed in the Method Summary.
possible better answer: http://stackoverflow.com/a/25261041
has comment: http://stackoverflow.com/comment/39357380
has comment: http://stackoverflow.com/comment/39357620
has comment: http://stackoverflow.com/comment/39357784
has answer: http://stackoverflow.com/a/25261041
type: Question
has comment: http://stackoverflow.com/comment/39357616
has answer: http://stackoverflow.com/a/25260242

authentication
tags question: http://stackoverflow.com/q/25297671
tags question: http://stackoverflow.com/q/25384534
tags question: http://stackoverflow.com/q/25281034
tags question: http://stackoverflow.com/q/25319254
tags question: http://stackoverflow.com/q/25238691
tags question: http://stackoverflow.com/q/25348716
tags question: http://stackoverflow.com/q/25331781
tags question: http://stackoverflow.com/q/25291274
tag name: authentication
tags question: http://stackoverflow.com/q/25306743
tags question: http://stackoverflow.com/q/25251779
tags question: http://stackoverflow.com/q/25308636
type: Tag
tags question: http://stackoverflow.com/q/25230861
tags question: http://stackoverflow.com/q/25386325
tags question: http://stackoverflow.com/q/25275909
tags question: http://stackoverflow.com/q/25331064

http://stackoverflow.com/comment/39455549
has text: @Error do you know how to do this? Desperately looking for an answer to solve it directly
comment on: http://stackoverflow.com/q/25311938
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25369123
has answer: http://stackoverflow.com/a/25369217
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39559025
score: 5
downvote count: 0
answer count: 1
has title: Schema related problems with H2 embedded database
favorite count: 0
has comment: http://stackoverflow.com/comment/104597988
has comment: http://stackoverflow.com/comment/39559138
has comment: http://stackoverflow.com/comment/39558985
type: Question
tagged with: sql
has body: I am building a Java Swing Desktop app and I have a problem with the database. After I made ​​the schema "studenti" and table "studenti.ocjene_studenata" in sql file, when I start the program, I get the following message. What exactly would be a problem? I think that I all configured correctly. I will show the message f error,the xml configuration app,sql file and annotations the variables. Thanks a lot! ERROR: HHH000388: Unsuccessful: create table studenti.ocjene_studenata (ID integer generated by default as identity, godina_studiranja integer, ime_studenta varchar(255), baze_podataka integer, matematika integer, napredne_baze_podataka integer, objektno_orijentirano_programiranje_2 integer, objektno_orijentirano_programiranje_1 integer, osnove_programiranja integer, programiranje integer, ocjena_mature integer, prezime_studenta varchar(255), prosjek double, primary key (ID)) kol 18, 2014 7:05:47 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute ERROR: Schema "STUDENTI" not found; SQL statement: create table studenti.ocjene_studenata ( ID integer generated by default as identity, godina_studiranja integer, ime_studenta varchar(255), baze_podataka integer, matematika integer, napredne_baze_podataka integer, objektno_orijentirano_programiranje_2 integer, objektno_orijentirano_programiranje_1 integer, osnove_programiranja integer, programiranje integer, ocjena_mature integer, prezime_studenta varchar(255), prosjek double, primary key (ID) ) [90079-171] kol 18, 2014 7:05:47 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000232: Schema update complete kol 18, 2014 7:05:47 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 90079, SQLState: 90079 kol 18, 2014 7:05:47 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: Schema "STUDENTI" not found; SQL statement: insert into studenti.ocjene_studenata (ID, godina_studiranja, ime_studenta, baze_podataka, matematika, napredne_baze_podataka, objektno_orijentirano…
upvote count: 5
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25369217
has comment: http://stackoverflow.com/comment/39559008

http://stackoverflow.com/comment/39534557
type: QuestionComment
comment on: http://stackoverflow.com/q/25355237
type: Comment
has text: Quoted from the doc u mentioned: `The persistence.xml doesn't have to be complete. The required elements are the persistence-unit (any legal name will do), and the provider (you have to identify openjpa). You can identify the classes to be enhanced either in this file or in the enhancer task ant project.` Therefore just make up a dummy persistence.xml containing the persistence unit and provider should be good enough
score: 0

http://stackoverflow.com/q/25335461
score: 0
has body: I want to try Java unit testing using fakeApplication in play 2.3 framework. My code is like this: import static org.fest.assertions.Assertions.assertThat; import static play.test.Helpers.fakeApplication; import static play.test.Helpers.running; import org.junit.Test; import play.test.WithApplication; public class ApplicationTest extends WithApplication { @Test public void simpleCheck() { running(fakeApplication(), new Runnable() { public void run() { int a = 1 + 1; assertThat(a).isEqualTo(2); } }); } } However I get the following error: [error] Test ApplicationTest.simpleCheck failed: java.lang.StackOverflowError: null, took 3.862 sec [error] at java.lang.String.regionMatches(String.java:1326) [error] at java.lang.String.equalsIgnoreCase(String.java:1090) [error] at org.slf4j.impl.JDK14LoggerFactory.getLogger(JDK14LoggerFactory.java:55) [error] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270) [error] at org.slf4j.bridge.SLF4JBridgeHandler.getSLF4JLogger(SLF4JBridgeHandler.java:204) [error] at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:291) [error] at java.util.logging.Logger.log(Logger.java:610) [error] at org.slf4j.impl.JDK14LoggerAdapter.log(JDK14LoggerAdapter.java:579) . . . [error] Failed: Total 1, Failed 1, Errors 0, Passed 0 [error] Failed tests: [error] ApplicationTest [error] (test:testOnly) sbt.TestsFailedException: Tests unsuccessful The test passes when I don't use fakeApplication.
answer count: 1
tagged with: unit-testing
type: Question
has title: get " java.lang.StackOverflowError: null " when using Helpers.fakeApplcation in play 2.3.2 unit testing
tagged with: java
accepted answer: http://stackoverflow.com/a/25336458
has answer: http://stackoverflow.com/a/25336458
type: AnsweredQuestion
tagged with: playframework-2.0

http://stackoverflow.com/a/25377385
has comment: http://stackoverflow.com/comment/39574812
has comment: http://stackoverflow.com/comment/39575354
score: 0
has comment: http://stackoverflow.com/comment/39574872
has comment: http://stackoverflow.com/comment/39574878
has comment: http://stackoverflow.com/comment/39576468
answers question: http://stackoverflow.com/q/25376688
type: Answer
has comment: http://stackoverflow.com/comment/39574923
has body: Just extending from my comment.Here have a look. final String CHECKBOX_DATA="CHECKBOX_DATA"; JSONObject js=new JSONObject(); js.put("package.name1", true); js.put("package.name2", false); js.put("package.name3", true); js.put("package.name4", true); SharePreferences prefs=context.getSharedPreferences(context.getPackageName(),Context.MODE_PRIVATE); prefs.edit().putString(CHECKBOX_DATA, js.toString()).commit(); And then retrieve the same as SharedPreferences prefs = context.getSharedPreferences( context.getPackageName(), Context.MODE_PRIVATE); String json=prefs.getString(CHECKBOX_DATA, null); JSONObject jsobj=new JSONObject(json); Iterator&lt;String&gt; iter = jsobj.keys(); while (iter.hasNext()) { String key = iter.next();//This is your packagename try { boolean value = jsobj.getBoolean(key); } catch (JSONException e) { // Something went wrong! } }
has comment: http://stackoverflow.com/comment/39574960

http://stackoverflow.com/comment/39445430
type: QuestionComment
comment on: http://stackoverflow.com/q/25307513
type: Comment
has text: `Map#replace` is in java since 1.8.
score: 0

http://stackoverflow.com/q/25378919
has body: I'm trying to launch multiple embedded zookeeper servers into separate threads from a Java application this way: String port1 = "2181"; String directory1 = new File(System.getProperty("java.io.tmpdir"), "zookeeper/data1").getAbsolutePath(); final ServerConfig config1 = new ServerConfig(); config1.parse(new String[] { port1, directory1 }); new Thread(new Runnable() { @Override public void run() { try{ ZooKeeperServerMain zk = new ZooKeeperServerMain() zk.runFromConfig(config1); }catch(Exception e){ e.printStackTrace(); } } }).run(); When I start zk this way, the main process is blocked and the remaining instructions are not executed! Is there a proper way to launch zookeeper in a separate thread?
favorite count: 0
type: Question
tagged with: apache-zookeeper
has answer: http://stackoverflow.com/a/25378983
tagged with: distributed
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0
has title: Launching zookeeper in a separate thread
upvote count: 1
tagged with: configuration
score: 1
accepted answer: http://stackoverflow.com/a/25378983
tagged with: java
answer count: 1

http://stackoverflow.com/a/25383598
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25383436
has comment: http://stackoverflow.com/comment/39587382
answers question: http://stackoverflow.com/q/25383436
type: Answer
score: 4
upvote count: 4
has body: This code checks intOne for null, and jumps to comparing intTwos as soon as any of the two intOnes is detected to be null: if(obj1.getIntOne()==null || obj2.getIntOne()==null){ return obj1.getIntTwo().compareTo(obj2.getIntTwo()); } This produces the effect that you see. If you would like to have the effect that you describe, change the code as follows: if(obj1.getIntOne()==null &amp;&amp; obj2.getIntOne()==null) { return obj1.getIntTwo().compareTo(obj2.getIntTwo()); } else if(obj1.getIntOne()==null &amp;&amp; obj2.getIntOne()!=null) { // Null is greater than any non-null number return 1; } else if(obj1.getIntOne()!=null &amp;&amp; obj2.getIntOne()==null) { // Non-null is smaller than null return -1; } else { return obj1.getIntOne().compareTo(obj2.getIntOne()); } This change uses intTwos only when both intOnes are null. If only one of them is null, the value of null is interpreted as a very large number.

http://stackoverflow.com/a/25366380
has body: First of all Garage extends Vehicle makes no sense. I'm assuming it's a mistake. A Garage is not a Vehicle. In Garage you can implement clone as : @Override protected Object clone() { Garage other = new Garage (); for (Vehicle v : this.array) { other.addVehicle((Vehicle)v.clone()); } return other; } Then you have to implement clone() in the Vehicle class hierarchy.
has comment: http://stackoverflow.com/comment/39589772
answers question: http://stackoverflow.com/q/25366308
has comment: http://stackoverflow.com/comment/39577757
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39599266
has comment: http://stackoverflow.com/comment/39599834
has comment: http://stackoverflow.com/comment/39554014
type: Answer
has comment: http://stackoverflow.com/comment/39554123
accepted answer of: http://stackoverflow.com/q/25366308

jhipster
tag name: jhipster
tags question: http://stackoverflow.com/q/25230861
type: Tag
tags question: http://stackoverflow.com/q/25343278

http://stackoverflow.com/q/25270823
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25275335
tagged with: jackson
has title: Converting java object to an InputStream (for uploading to S3) with Jackson?
score: 0
has body: I have a POJO that I was going to serialize to .json and upload to S3. Bit. it turns out that since I use a writer to write (i.e. serialize) the .json to disk before I upload it, this doesn't work, as I don't have write permissions to the directory that java would use to write the file to disk before it uploads. I could use a TempFile, but is there a simple way to convert a java object to an InputStream so I can use the corresponding S3Client inputStream putObject method instead?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
type: Question

http://stackoverflow.com/comment/39504512
type: AnswerComment
comment on: http://stackoverflow.com/a/25338676
type: Comment
has text: I will have a look to GitLab in detail :) Thanks for the response.
score: 0

http://stackoverflow.com/q/25317408
has comment: http://stackoverflow.com/comment/39464226
answer count: 4
has answer: http://stackoverflow.com/a/25317495
has answer: http://stackoverflow.com/a/25317518
downvote count: 0
has answer: http://stackoverflow.com/a/25327618
possible better answer: http://stackoverflow.com/a/25327618
upvote count: 1
accepted answer: http://stackoverflow.com/a/25317495
favorite count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25317545
has body: I am getting a No operations allowed after statement closed. - very obvious and also self explanatory as to what is going on with my code. In any case I am wondering how I can do this in a cleaner way public class BaseClass { Connection con; Statement st; protected void establishDBConnection() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); String cString = "...."; con = DriverManager.getConnection(cString, user, password); st = con.createStatement(); } public BaseClass() { try { createDBConnection(); } catch (Exception e) { e.printStackTrace(); } } } public ClassB extends BaseClass { public ClassB() { super(); } public void doSomething() { try { String q = "select * from my_table"; String moreQuery = "update my_table ...." String anotherQuery = "do something fancy..." rs = st.executeQuery(q); while (rs.next()) { st.executeUpdate(moreQuery); st.executeUpdate(anotherQuery); } } catch (Exception e) { e.printStackTrace(); System.out.println("Error in getAllAssociatesOfMra: " + e); } } } Currently my code is throwing a com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed. The exception is obvious as to what is going on but I was wondering how I can go about handling the close in the BaseClass. Update I am aware that there a couple of related questions like mine. The only problem with those questions is that everything is done in the main class. Consider this to be kind of design/abstraction question
score: 1
has title: java jdbc no operations allowed
tagged with: java
tagged with: jdbc

http://stackoverflow.com/comment/40567779
has text: Uninstalling Eclipse should be the last resource. Other not-so-heavy solution is uninstalling all the currently installed android plugins (About Eclipse -> Installation Details -> select the Android ones and 'Uninstall...' [Restart Eclipse]) and then installing the latest android plugin versions.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25306068

http://stackoverflow.com/q/25320021
tagged with: salesforce
has comment: http://stackoverflow.com/comment/39468849
type: Question
has body: First of all please look at my code below: List&lt;BasicNameValuePair&gt; qsList = new ArrayList&lt;BasicNameValuePair&gt;(); qsList.add(new BasicNameValuePair("oauth_token", accessToken)); String queryString = URLEncodedUtils.format(qsList, HTTP.UTF_8); HttpGet userInfoRequest = new HttpGet(id + "?" + queryString); DefaultHttpClient defaultHttpClientclient = new DefaultHttpClient(); HttpResponse userInfoResponse; try { userInfoResponse = defaultHttpClientclient.execute(userInfoRequest); String responseBody = EntityUtils.toString(userInfoResponse.getEntity()); System.out.println("User info response: " + responseBody); System.out.println(""); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } I got an access token from Salesforce. Now I request user's information via that token. In the responseBody I got all infomation of that user like username, id, language,... Now I need to take only username from the response. What should I do to take it?
accepted answer: http://stackoverflow.com/a/25320096
has comment: http://stackoverflow.com/comment/39468880
has comment: http://stackoverflow.com/comment/39468824
linked to: http://stackoverflow.com/q/2591098
has comment: http://stackoverflow.com/comment/39468931
type: AnsweredQuestion
has title: How to get info from HttpResponse java?
score: 0
has answer: http://stackoverflow.com/a/25320096
has comment: http://stackoverflow.com/comment/39468820
tagged with: java
answer count: 1

http://stackoverflow.com/q/25255811
has body: hi i need to get all the start dates and end date of each and every month in between given two years pulbic void printStartDateAndEndDate(Date start, Date end){ for(// start - end){ Sysout("1 st month starting date: "+ startDateOfMonth+ " End Date"+endDateOfMonth); } } if somebody knows how to do this please let me know.i need the "startDateOfMonth" and "endDateOfMonth" to be in Date object.
tagged with: datetime
downvote count: 1
has answer: http://stackoverflow.com/a/25255894
has comment: http://stackoverflow.com/comment/39350111
type: AnsweredQuestion
tagged with: java
answer count: 1
score: -1
has title: start date and end date between two dates
favorite count: 0
has comment: http://stackoverflow.com/comment/39350262
accepted answer: http://stackoverflow.com/a/25255894
type: Question
tagged with: jodatime
has comment: http://stackoverflow.com/comment/39350121
upvote count: 0

http://stackoverflow.com/a/25290789
has comment: http://stackoverflow.com/comment/39655360
answers question: http://stackoverflow.com/q/25290036
upvote count: 9
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39553444
has comment: http://stackoverflow.com/comment/39414370
has comment: http://stackoverflow.com/comment/39678106
has comment: http://stackoverflow.com/comment/39550839
has comment: http://stackoverflow.com/comment/39550026
has comment: http://stackoverflow.com/comment/39653994
has body: // Make a regex pattern (once only): StringBuilder pattern = new StringBuilder(); for (String sought : searchCollection) { if (!Util.isNullOrEmpty(sought)) { if (pattern.length() != 0) { pattern.append('|'); } pattern.append(Pattern.quote(sought)); } } final Pattern PATTERN = Pattern.compile("(" + pattern + ")"); This creates a pattern of alternatives like "(abc|def|ghi)". You might consider a case-insensitive search. And in the function containsAny: Matcher m = PATTERN.matcher(searchString); return m.find(); Regex compilation is relatively smart. It would be comparable to using a search tree of your collection of sought words: "agent" and "agitator" to ("ag", ("ent", "itator"))
score: 9
has comment: http://stackoverflow.com/comment/39550920

http://stackoverflow.com/comment/39339627
has text: If your temporary variable is `null` you can't use it as object reference, so you can skip it in the code block where it lives. Repopulating a list with non-null elements requires a time as twice as passing a loop. It's not much efficient.
comment on: http://stackoverflow.com/a/25249523
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39508687
type: AnswerComment
has text: *"can't just shorten the code"* Get beyond 'minimal' and make it complete, verifiable and an example!
type: Comment
comment on: http://stackoverflow.com/a/25338142
score: 0

http://stackoverflow.com/comment/39381025
type: Comment
type: QuestionComment
has text: @mimi when is the time you want to change activity?? it is when the animation is done?
comment on: http://stackoverflow.com/q/25272560
score: 0

http://stackoverflow.com/comment/39464681
comment on: http://stackoverflow.com/q/25317748
type: QuestionComment
score: 0
has text: @Kayaman: On top what Luiggi said there is alos this exception - [`CloneNotSupportedException`](http://docs.oracle.com/javase/7/docs/api/java/lang/CloneNotSupportedException.html).
type: Comment

http://stackoverflow.com/comment/39571401
type: Comment
type: AnswerComment
score: 0
has text: I guess if you call query.setSkip(2), then in the callback, check if the object returned is null - if it's null, then nothing was returned, which would logically mean there wasn't a 3rd user in the table, then redirect to where you want to go
comment on: http://stackoverflow.com/a/25354164

http://stackoverflow.com/comment/39351704
score: 0
has text: Agreed, but there has to be a solution to this using mvn exec as well. I have also tried adding the output directory within configuration in my pom, but no luck. output/
type: QuestionComment
comment on: http://stackoverflow.com/q/25256511
type: Comment

http://stackoverflow.com/a/25282354
has comment: http://stackoverflow.com/comment/39399967
accepted answer of: http://stackoverflow.com/q/25282255
has body: It looks like an error in your pom.xml. You probably forgot to include the group id for the plugin in the <build> section, which would make maven assume the default/automagic group id org.apache.maven.plugins It should look like this: <build> <plugins> <plugin> org.apache.tomcat.maven tomcat7-maven-plugin ...
has comment: http://stackoverflow.com/comment/39400580
has comment: http://stackoverflow.com/comment/39399430
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25282255
score: 0
has comment: http://stackoverflow.com/comment/39402526
type: Answer

http://stackoverflow.com/a/25344553
has body: I have a similar error one time. On line #71 do you have a definition of Button: &lt;Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="60dp" android:layout_height="60dp" android:layout_marginLeft="30dp" android:layout_marginTop="430dp" android:background="@drawable/menu_button" android:onClick="menu" /&gt; I offer you some solutions to your problem: Override onLowMemory method on your Activities to free some resources from memory. Use more WeakReference, SoftReference and WeakHashMap, to avoid strong references, that will be used by the garbage collector to free memory. Use inSampleSize and inJustDecodeBounds options on BitmapFactory.Options to decode bitmaps, as shown here. In my particular problem, I decided to reduce the size of the image to use. Set android:largeHeap = "true" on Manifest as describe here.
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39865464
type: Answer
accepted answer of: http://stackoverflow.com/q/25344518
answers question: http://stackoverflow.com/q/25344518
has comment: http://stackoverflow.com/comment/39866750
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39866856
has comment: http://stackoverflow.com/comment/39864518

http://stackoverflow.com/q/25292224
has comment: http://stackoverflow.com/comment/39416804
has comment: http://stackoverflow.com/comment/39416727
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39442448
has answer: http://stackoverflow.com/a/41521542
has answer: http://stackoverflow.com/a/25314042
has body: I try to make simple application with sliding images. I use this article http://www.androidbegin.com/tutorial/android-viewpager-gallery-images-and-texts-tutorial/. This is my xml with viewpager: main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;android.support.v4.view.ViewPager android:id="@+id/pages" android:layout_height="match_parent" android:layout_width="match_parent"&gt; &lt;/android.support.v4.view.ViewPager&gt; &lt;/LinearLayout&gt; this is my xml with image: item.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/image" android:layout_gravity="center" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/ic_launcher" /&gt; &lt;/RelativeLayout&gt; this is my adapter: ViewerPagerAdapter.java public class ViewerPagerAdapter extends PagerAdapter { private Context mContext; private ArrayList&lt;CueModel&gt; mArray; private LayoutInflater mInflater; private ImageView mImage; public ViewerPagerAdapter(Context _context){ mContext = _context; mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public void setArray(ArrayList&lt;Bitmap&gt; arr){ mArray = arr; } @Override public int getItemPosition(Object object) { return POSITION_NONE; } @Override public Object instantiateItem(ViewGroup container, int position) { View itemView = mInflater.inflate(R.layout.item, container, false); mImage = (ImageView)itemView.findViewById(R.id.image); mImage.setImageBitmap(mArray.get(position)); container.addView(itemView); return itemView; } @Override public int getCount() { return mArray.size(); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View)object); } @Ove…
has title: Why instantiateItem doesn't call and ViewPager doesn't work?
has answer: http://stackoverflow.com/a/73766944
tagged with: android-viewpager
tagged with: android
downvote count: 0
has answer: http://stackoverflow.com/a/62181390
has comment: http://stackoverflow.com/comment/39416783
has comment: http://stackoverflow.com/comment/39417085
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39416834
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39416755
upvote count: 1
possible better answer: http://stackoverflow.com/a/41521542
accepted answer: http://stackoverflow.com/a/25314042

http://stackoverflow.com/q/25369490
tagged with: python
has title: Executing a python file from within JAR
has comment: http://stackoverflow.com/comment/39559763
score: 2
has comment: http://stackoverflow.com/comment/39559844
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39559802
has comment: http://stackoverflow.com/comment/39560529
tagged with: java
has answer: http://stackoverflow.com/a/25369758
downvote count: 0
answer count: 1
has body: I am trying to figure out how to reference a python file so that I can execute it within a Java GUI Jar. It needs to be a portable solution, so using absolute paths will not work for me. I have listed my project structure below, and have included the code for how I am trying to execute the python script..I have read things about using resources, but I have been unable to implement this successfully. I appreciate any help you can provide! private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { Runtime rt = Runtime.getRuntime(); Process pr = rt.exec("python /scripts/script.py"); BufferedReader bfr = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line = ""; while((line = bfr.readLine()) != null) System.out.println(line); } catch(Exception e) { System.out.println(e.toString()); } } --OneStopShop (Project) --Source Packages --images --onestopshop --Home.java --scripts --script.py
has comment: http://stackoverflow.com/comment/39560022
favorite count: 0
type: Question
upvote count: 2
tagged with: jar
accepted answer: http://stackoverflow.com/a/25369758

http://stackoverflow.com/a/25374220
has comment: http://stackoverflow.com/comment/39568965
has comment: http://stackoverflow.com/comment/39569010
score: -1
answers question: http://stackoverflow.com/q/25374168
has body: public static int getPersonCount(){ return personCount; } Then invoke above method Person.getPersonCount();
has comment: http://stackoverflow.com/comment/39569025
has comment: http://stackoverflow.com/comment/39568984
has comment: http://stackoverflow.com/comment/39569104
downvote count: 2
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39568999
has comment: http://stackoverflow.com/comment/39568974

http://stackoverflow.com/q/25321500
has answer: http://stackoverflow.com/a/25321740
score: 0
tagged with: java
answer count: 1
has body: I'm trying to make a View appear exactly the same as it would normally, except a smaller size. I've tried doing this: import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.widget.LinearLayout; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(getBaseContext()); final Button b1 = new Button(getBaseContext()); final Button b2 = new Button(getBaseContext()); final Button b3 = new Button(getBaseContext()); b1.setText("button 1"); b2.setText("button 2"); b3.setText("button 3"); b2.setScaleX(0.5f); b2.setScaleY(0.5f); ll.addView(b1); ll.addView(b2); ll.addView(b3); setContentView(ll); } } It does scale the View, but it still takes up the space it would have taken if I didn't scale at all: I want to get rid of the invisible space around button 2. The 3 buttons should be compact in the LinearLayout.
type: Question
has title: How to scale a View without it taking up the space it would have taken if I didn't scale it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39471631
tagged with: android

http://stackoverflow.com/q/25333624
has answer: http://stackoverflow.com/a/25333930
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25333870
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25333870
type: Question
answer count: 3
linked to: http://stackoverflow.com/q/14421694
has title: Android/Java decisions about threading
tagged with: multithreading
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/25333876
has body: Okay, so I after playing around with the Android SDK a little I have decided to develop a full application. Not necessarily to release on the store (I don't really have the tools at my disposal to do proper QA and so wouldn't feel right; I could only test on my one personal device) it is mostly just a personal project for fun and learning. In the end, I decided on a camera application because I use my camera fairly often so it is the kind of application I would end up actually using if I made it and also because I am quite excited by the features of the new Camera2 API in Android L and want to give them a try. Anyway, I have been thinking on the design/architecture of the application for a while and I have come across a potential problem that I cannot really resolve myself as I am not only not really familiar with GUI programming of this nature but also not 100% on Java and the Android SDK. They both sit well outside the purview of my dayjob. Now I know enough that I really need to keep my UI thread separate from everything else, but what I am unsure about is first of all, what I should devote extra threads to (I was thinking one to handle image capture and storage, and another to handle the settings? perhaps that is over doing it) and also whether to have background threads which the UI thread communicates with through Events or simply to spawn threads as and when they are needed. Perhaps a single intermediate background thread which arbitrates between the UI thread and any background processing that needs to be done? What I mean to ask is, how do I decide these things? Are there general/best practices? I'm really asking because I want to get this done properly and plan out the application thoroughly beforehand since in the past I have found that if I just dive right in I get confused very easily and end up losing faith and dropping the project. I hope somebody can help. It's not a question that I have found easy to phrase in such a way that Google would provide sa…
has answer: http://stackoverflow.com/a/25333876

http://stackoverflow.com/a/25235191
upvote count: 1
has comment: http://stackoverflow.com/comment/39311395
has body: SWT is built on native code, one is the interface definitions and the other is the Mac OS implementation. I'm running Linux and I have, # linux specific org.eclipse.swt.gtk.linux.x86_64_3.103.0.v20140605-2012.jar and # cross platform Java interfaces org.eclipse.swt_3.103.0.v20140605-2008.jar and # linux specific source implementing cross platform Java interfaces and # compilable into the first jar org.eclipse.swt.gtk.linux.x86_64.source_3.103.0.v20140605-2012.jar
type: Answer
has comment: http://stackoverflow.com/comment/39311386
has comment: http://stackoverflow.com/comment/39311365
has comment: http://stackoverflow.com/comment/39311415
accepted answer of: http://stackoverflow.com/q/25235119
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39311376
answers question: http://stackoverflow.com/q/25235119

http://stackoverflow.com/comment/39554658
type: Comment
has text: These are not what I would consider standard Java Libraries, they seem to come from eclipse, how do you compile? The only jars you should need per the above is POI and SWT.
type: AnswerComment
comment on: http://stackoverflow.com/a/25366745
score: 0

http://stackoverflow.com/a/25384805
answers question: http://stackoverflow.com/q/25384728
type: Answer
has body: \\b\\d+(/\\d+){1, 3}\\b \b is a word boundary. This will match all tokens with 1-3 slashes, with the slashes surrounded by digits and the token surrounded by word boundaries.
score: 0

http://stackoverflow.com/comment/39370729
score: 0
comment on: http://stackoverflow.com/a/25267169
has text: Actually, I had a previous variation which did that, but the thing is that `while ((lines = reader.readLine()) != null) { //do stuff with lines }` would actually never execute because `while ((lines = reader.readLine()) != null)` would somehow be false. My code variation in the question was done in the hopes that it has something to do with the conditional operator and not the fact that the actual `lines` variable is null.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25357115
has answer: http://stackoverflow.com/a/25357222
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25357259
tagged with: parse-platform
upvote count: 2
downvote count: 0
has body: I have received a Syntax error on tokens, AnnotationName expected instead occured on the following line: query.findInBackground(new FindCallback&lt;ParseUser&gt;() { I have been trying to troubleshoot since a while, but is still having difficulties. Below is my complete code public class Fragment1 extends Fragment { public interface Constants { String LOG = "com.dooba.beta"; } private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ArrayList&lt;Images&gt; alProfilePicture; private ListView usersListView; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setConversationsList(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment1_layout, container, false); return view; } private void setConversationsList() { currentUserId = ParseUser.getCurrentUser().getObjectId(); names = new ArrayList&lt;String&gt;(); alProfilePicture = new ArrayList&lt;Images&gt;(); // String userActivitySelectionName = null; ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); // query.whereEqualTo("ActivityName",userActivitySelectionName); query.whereNotEqualTo("objectId", ParseUser.getCurrentUser().getObjectId()); // users with Gender = currentUser.Looking_Gender query.whereEqualTo("Gender", userLookingGender); // us…
possible better answer: http://stackoverflow.com/a/25357222
score: 2
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: android
tagged with: java
has title: Syntax error on tokens, AnnotationName expected instead - error on query
favorite count: 0
accepted answer: http://stackoverflow.com/a/25357259

http://stackoverflow.com/comment/39483406
type: Comment
has text: @Greycon I tried to add a rule but without success. Something is wrong. Sorry I have to go. I'll continue my investigation on Monday
score: 0
comment on: http://stackoverflow.com/q/25325579
type: QuestionComment

http://stackoverflow.com/comment/62628263
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/37553324
type: Comment
has text: In this you're not generating a JavaScript Date object though.

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25362078
tags question: http://stackoverflow.com/q/25233768
tags question: http://stackoverflow.com/q/25306508
tags question: http://stackoverflow.com/q/25321919
tags question: http://stackoverflow.com/q/25242705
tags question: http://stackoverflow.com/q/25331596
tags question: http://stackoverflow.com/q/25258125
tags question: http://stackoverflow.com/q/25282203
tags question: http://stackoverflow.com/q/25388164
tag name: xml
tags question: http://stackoverflow.com/q/25302887
tags question: http://stackoverflow.com/q/25237357
tags question: http://stackoverflow.com/q/25265481
tags question: http://stackoverflow.com/q/25298969
tags question: http://stackoverflow.com/q/25364334
tags question: http://stackoverflow.com/q/25304506
tags question: http://stackoverflow.com/q/25376888
tags question: http://stackoverflow.com/q/25289539
tags question: http://stackoverflow.com/q/25263978
tags question: http://stackoverflow.com/q/25328779
tags question: http://stackoverflow.com/q/25334207
tags question: http://stackoverflow.com/q/25256529
tags question: http://stackoverflow.com/q/25236272
tags question: http://stackoverflow.com/q/25263171
type: Tag
tags question: http://stackoverflow.com/q/25346968
tags question: http://stackoverflow.com/q/25387500
tags question: http://stackoverflow.com/q/25382162
tags question: http://stackoverflow.com/q/25372516
tags question: http://stackoverflow.com/q/25239315
tags question: http://stackoverflow.com/q/25266215
tags question: http://stackoverflow.com/q/25273265
tags question: http://stackoverflow.com/q/25254514
tags question: http://stackoverflow.com/q/25359212
tags question: http://stackoverflow.com/q/25365089
tags question: http://stackoverflow.com/q/25232458
tags question: http://stackoverflow.com/q/25363114
tags question: http://stackoverflow.com/q/25340608
tags question: http://stackoverflow.com/q/25330069
tags question: http://stackoverflow.com/q/25250418
tags question: http://stackoverflow.com/q/25312407
tags question: http://stackoverflow.com/q/25381703
tags question: http://stackoverflow.com/q/25287509
tags question: http://stackoverflow.com/q/25275248
tags question: http://stackoverflow.com/q/25365998
tags question: http://stackoverflow.com/q/25357209
tags question: http://stackoverflow.com/q/25246493
tags question: http://stackoverflow.com/q/25325262
tags question: http://stackoverflow.com/q/25308305
tags question: http://stackoverflow.com/q/25331252
tags question: http://stackoverflow.com/q/25247156
tags question: http://stackoverflow.com/q/25367043
tags question: http://stackoverflow.com/q/25288602
tags question: http://stackoverflow.com/q/25291950
tags question: http://stackoverflow.com/q/25280911
tags question: http://stackoverflow.com/q/25363748
tags question: http://stackoverflow.com/q/25246766
tags question: http://stackoverflow.com/q/25274587
tags question: http://stackoverflow.com/q/25368805
tags question: http://stackoverflow.com/q/25360961
tags question: http://stackoverflow.com/q/25389334
tags question: http://stackoverflow.com/q/25294711
tags question: http://stackoverflow.com/q/25330187
tags question: http://stackoverflow.com/q/25274197
tags question: http://stackoverflow.com/q/25289910
tags question: http://stackoverflow.com/q/25277039
tags question: http://stackoverflow.com/q/25267328
tags question: http://stackoverflow.com/q/25356118
tags question: http://stackoverflow.com/q/25357967
tags question: http://stackoverflow.com/q/25370165
tags question: http://stackoverflow.com/q/25374375
tags question: http://stackoverflow.com/q/25244315
tags question: http://stackoverflow.com/q/25309741
tags question: http://stackoverflow.com/q/25385343
tags question: http://stackoverflow.com/q/25307949
tags question: http://stackoverflow.com/q/25329566
tags question: http://stackoverflow.com/q/25301333
tags question: http://stackoverflow.com/q/25288381
tags question: http://stackoverflow.com/q/25265834
tags question: http://stackoverflow.com/q/25378385

http://stackoverflow.com/a/25282770
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25282442
has comment: http://stackoverflow.com/comment/51406333
downvote count: 1
has comment: http://stackoverflow.com/comment/39433436
has comment: http://stackoverflow.com/comment/39445633
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39446496
has body: Servlets are instantiated by the Servlet container, you have no explicit control over that. You can't force to have only 1 instance of a specific Servlet in a Servlet container (although typically this will be the case); at least not in an official way because the Servlet API does not provide any way to do it. Some container implementations might provide you an arbitrary API for this, but I wouldn't count on it. Instead make your Servlet implementation so that it doesn't depend on how many instances there are (e.g. do not use static attributes). Update: Quoting from the Servlet specification 2.3 section #2.3.1: It is important to note that there can be more than one instance of a given Servlet class in the servlet container. For example, this can occur where there was more than one servlet definition that utilized a specific servlet class with different initialization parameters. This can also occur when a servlet implements the SingleThreadModel interface and the container creates a pool of servlet instances to use.
answers question: http://stackoverflow.com/q/25282442
has comment: http://stackoverflow.com/comment/39445384
has comment: http://stackoverflow.com/comment/39430578
has comment: http://stackoverflow.com/comment/39447081

gson
tag name: gson
tags question: http://stackoverflow.com/q/25346512
tags question: http://stackoverflow.com/q/25273485
tags question: http://stackoverflow.com/q/25347121
tags question: http://stackoverflow.com/q/25341787
tags question: http://stackoverflow.com/q/25339735
tags question: http://stackoverflow.com/q/25357365
tags question: http://stackoverflow.com/q/25315268
tags question: http://stackoverflow.com/q/25230823
tags question: http://stackoverflow.com/q/25298409
tags question: http://stackoverflow.com/q/25276479
tags question: http://stackoverflow.com/q/25364002
tags question: http://stackoverflow.com/q/25252240
tags question: http://stackoverflow.com/q/25274036
tags question: http://stackoverflow.com/q/25380514
type: Tag
tags question: http://stackoverflow.com/q/25279068
tags question: http://stackoverflow.com/q/25292004

http://stackoverflow.com/a/25836858
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25369186
type: Answer
score: 2
has body: I was able to find a reference to this behavior Message distribution in case of wildcard queue consumers is random. http://activemq.2283324.n4.nabble.com/Wildcard-and-message-distribution-td2346132.html#a2346133 Though this can be tuned by setting appropriate prefetch size. After trial &amp; error, I arrived at following formula, to have fair distribution across the consumers and all the queue getting de-queued at almost same pace. prefetch = number of wildcard consumers
answers question: http://stackoverflow.com/q/25369186
upvote count: 2

http://stackoverflow.com/comment/39657373
score: 0
has text: Hi Salem, the column names are the same, what I had to do for each variable defined in the model class was insert @Column(name="xxx") e.g @Column(name="Symbol"). And that worked. But looking at the play doc and examples, this wasn't necessary.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25368133

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

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25236817
tag name: jfreechart
tags question: http://stackoverflow.com/q/25338458
tags question: http://stackoverflow.com/q/25323581

http://stackoverflow.com/comment/39618015
score: 0
has text: Header names: Connection Header Value: close Header names: Content-Length Header Value: 5638 Header names: Content-Type Header Value: text/html Header names: Pragma Header Value: no-cache Header names: Cache-control Header Value: no-cache,max-age=0,must-revalidate If you suggest another way getting the authenticated page html, it would be nice. I absolutely need to parse this page.
type: AnswerComment
comment on: http://stackoverflow.com/a/25389560
type: Comment

send
type: Tag
tags question: http://stackoverflow.com/q/25343471
tag name: send

http://stackoverflow.com/comment/39531629
score: 0
comment on: http://stackoverflow.com/a/25344821
type: Comment
has text: 1. Your question clearly states 'from console'. Make up your mind. 2. *Non sequitur.* The fact that you can't think of any other cause doesn't imply that the only cause you thought of is the correct cause.
type: AnswerComment

http://stackoverflow.com/comment/39495785
score: 0
has text: Thanks for the input, I have tried to create only the directory structure super/sub/ in the local directory and I have found that it doesn't even do that so now I am wondering if I am using mkdirs properly... In my former code, I actually used mkdir twice... once before the FOR to create super ("presentaciones") then another time in the FOR to create each one of the subdirectories before placing copying files to the subdirectories which was done in an inappropriate manner as you pointed out
comment on: http://stackoverflow.com/a/25320640
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25355292
downvote count: 1
has comment: http://stackoverflow.com/comment/39539118
has comment: http://stackoverflow.com/comment/39538612
has comment: http://stackoverflow.com/comment/39536660
type: Answer
has comment: http://stackoverflow.com/comment/39539665
score: 0
has body: Recorder is for Firefox. Record with Firefox replay on ie. Tweak script as needed
upvote count: 1
answers question: http://stackoverflow.com/q/25355022

http://stackoverflow.com/a/25337970
answers question: http://stackoverflow.com/q/25337570
downvote count: 0
type: Answer
has body: If you go to 3rd tab then go to the 2nd or 1st tab then 1st will be recreated and call onCreate, that is the default behavior of fragment. But going to just 2nd tab and then back to 1st tab will not recreate the 1st tab. I have made some changes in the InterestTabFragment.java below only in onCreate. See if it helps, if not then notify me, I may try again. Thanks..... public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreateView(inflater, container, savedInstanceState); view = inflater.inflate(R.layout.interest_tab_fragment, container, false); listview = (HorizontalListView) view.findViewById(R.id.LVCategory); if(((ProfileActivity)getActivity()).interestResult.categories == null){ Session session = Session.getActiveSession(); if (session != null &amp;&amp; session.isOpened()) { // Get the user's data access_token = session.getAccessToken(); makeInterestRequest(session); } } else { CategoryLVAdapter adapter = new CategoryLVAdapter(getActivity(), R.layout.category_item_template, ((ProfileActivity)getActivity()).interestResult.categories); listview.setAdapter(adapter); } return view; }
score: 1
has comment: http://stackoverflow.com/comment/39502997
upvote count: 1
has comment: http://stackoverflow.com/comment/39503289

java
tags question: http://stackoverflow.com/q/25356776
tags question: http://stackoverflow.com/q/25287123
tags question: http://stackoverflow.com/q/25264701
tags question: http://stackoverflow.com/q/25357967
tags question: http://stackoverflow.com/q/25378448
tags question: http://stackoverflow.com/q/25304103
tags question: http://stackoverflow.com/q/25319922
tags question: http://stackoverflow.com/q/25300454
tags question: http://stackoverflow.com/q/25296615
tags question: http://stackoverflow.com/q/25257513
tags question: http://stackoverflow.com/q/25365664
tags question: http://stackoverflow.com/q/25369214
tags question: http://stackoverflow.com/q/25380845
tags question: http://stackoverflow.com/q/25318106
tags question: http://stackoverflow.com/q/25310335
tags question: http://stackoverflow.com/q/25322556
tags question: http://stackoverflow.com/q/25370165
tags question: http://stackoverflow.com/q/25355022
tags question: http://stackoverflow.com/q/25300446
tags question: http://stackoverflow.com/q/25239945
tags question: http://stackoverflow.com/q/25310759
tags question: http://stackoverflow.com/q/25325500
tags question: http://stackoverflow.com/q/25371058
tags question: http://stackoverflow.com/q/25382733
tags question: http://stackoverflow.com/q/25240453
tags question: http://stackoverflow.com/q/25292465
tags question: http://stackoverflow.com/q/25349570
tags question: http://stackoverflow.com/q/25251411
tags question: http://stackoverflow.com/q/25295194
tags question: http://stackoverflow.com/q/25350098
tags question: http://stackoverflow.com/q/25353970
tags question: http://stackoverflow.com/q/25351717
tags question: http://stackoverflow.com/q/25304958
tags question: http://stackoverflow.com/q/25265335
tags question: http://stackoverflow.com/q/25329413
tags question: http://stackoverflow.com/q/25377855
tags question: http://stackoverflow.com/q/25357519
tags question: http://stackoverflow.com/q/25244495
tags question: http://stackoverflow.com/q/25363069
tags question: http://stackoverflow.com/q/25294258
tags question: http://stackoverflow.com/q/25248449
tags question: http://stackoverflow.com/q/25318449
tags question: http://stackoverflow.com/q/25264827
tags question: http://stackoverflow.com/q/25270916
tags question: http://stackoverflow.com/q/25342601
tags question: http://stackoverflow.com/q/25340013
tags question: http://stackoverflow.com/q/25369560
tags question: http://stackoverflow.com/q/25315152
tags question: http://stackoverflow.com/q/25237685
tags question: http://stackoverflow.com/q/25233186
tags question: http://stackoverflow.com/q/25259466
tags question: http://stackoverflow.com/q/25254220
tags question: http://stackoverflow.com/q/25257455
tags question: http://stackoverflow.com/q/25291980
tags question: http://stackoverflow.com/q/25320950
tags question: http://stackoverflow.com/q/25336153
tags question: http://stackoverflow.com/q/25312993
tags question: http://stackoverflow.com/q/25374641
tags question: http://stackoverflow.com/q/25349741
tags question: http://stackoverflow.com/q/25307841
tags question: http://stackoverflow.com/q/25275246
tags question: http://stackoverflow.com/q/25364765
tags question: http://stackoverflow.com/q/25383286
tags question: http://stackoverflow.com/q/25253350
tags question: http://stackoverflow.com/q/25348008
tags question: http://stackoverflow.com/q/25346993
tags question: http://stackoverflow.com/q/25374375
tags question: http://stackoverflow.com/q/25300627
tags question: http://stackoverflow.com/q/25387098
tags question: http://stackoverflow.com/q/25271481
tags question: http://stackoverflow.com/q/25309741
tags question: http://stackoverflow.com/q/25236619
tags question: http://stackoverflow.com/q/25238500
tags question: http://stackoverflow.com/q/25275000
tags question: http://stackoverflow.com/q/25361475
tags question: http://stackoverflow.com/q/25313054
tags question: http://stackoverflow.com/q/25239801
tags question: http://stackoverflow.com/q/25255854
tags question: http://stackoverflow.com/q/25266804
tags question: http://stackoverflow.com/q/25283766

http://stackoverflow.com/a/25342064
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25342026
has body: n is defined as an int and 1 is an int literal. When you divide two ints you use integer arithmetic, which would return only the whole part of the fraction - in your case, 0. To rectify this, you should use doubles: public class Ques11 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double d = scan.nextInt(); // Note we're assigning to a double BigDecimal sum = new BigDecimal(1); for(int i = 2; i &lt;= d; i++) { sum.add(new BigDecimal(1.0/d)); } System.out.print(sum.setScale(10).toPlainString()); } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25342026
score: 1

http://stackoverflow.com/comment/39421272
score: 0
has text: thanks for noticing that, I have updated my question it was `:\start`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25294433

http://stackoverflow.com/q/25275898
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/25277243
tagged with: android
tagged with: java
has body: I have problem on Android 4.0.x. When up navigate in onActivityResult resultCode is always 0 and Intent is null. Navigate up code: protected void navigateUp(){ Intent upIntent = NavUtils.getParentActivityIntent(this); upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); if (NavUtils.shouldUpRecreateTask(this, upIntent)) { TaskStackBuilder.create(this) .addNextIntentWithParentStack(upIntent) .startActivities(); } else { NavUtils.navigateUpTo(this, upIntent); } } Set result code: public void onNavigationDrawerItemSelected(int position) { Intent resultIntent = new Intent(); resultIntent.putExtra(SELECTED_POSITION, position); setResult(RESULT_OK, resultIntent); navigateUp(); } What the problem? It's works on 4.4.x and not works on 4.0.x. Why? Thx!
tagged with: android-activity
has title: Return result from Activity
type: UnansweredQuestion
answer count: 1
downvote count: 0
score: 1
upvote count: 1
tagged with: android-intent
favorite count: 0

http://stackoverflow.com/a/25357012
upvote count: 1
score: 1
has body: The regex parser goes to each character in the string and checks it with the regex. The first part, (?=...), is called a 'lookahead', and it asks if the next character is whatever specified (that is, [\x00-\x7F]). It doesn't move the character pointer. The next part is saying that the next character is not alphanumeric, but does move the character pointer. So it does precisely what you told it to; that is, match any non-alphanumeric ASCII character. It does not match £ in ££££A$££0#$% because £ is not ASCII. If you want to match ANY character that is non-alphanumeric, you're probably looking for this regex: `[^a-zA-Z0-9]` See http://www.regular-expressions.info/lookaround.html and other pages on the site for more info.
has comment: http://stackoverflow.com/comment/39537984
has comment: http://stackoverflow.com/comment/39537895
has comment: http://stackoverflow.com/comment/39796769
has comment: http://stackoverflow.com/comment/39799808
type: Answer
answers question: http://stackoverflow.com/q/25349418
downvote count: 0

http://stackoverflow.com/a/25326828
type: Answer
has body: 1) Download the image from Oracle web page 2) Mount the dmg image : sudo hdiutil attach .dmg The image will be mounted to /Volumes/. 3) Run sudo installer /Volumes//.pkg -target /. 4) Unmount the image: sudo hdiutil detach /Volumes/.
answers question: http://stackoverflow.com/q/25326730
score: 0

http://stackoverflow.com/comment/39527804
type: QuestionComment
comment on: http://stackoverflow.com/q/25352557
has text: I believe [`grep`](http://en.wikipedia.org/wiki/Grep) is what you're looking for.
score: 4
type: Comment

http://stackoverflow.com/comment/39344954
score: 0
type: AnswerComment
has text: Are you sure that is the only image?
comment on: http://stackoverflow.com/a/25252892
type: Comment

http://stackoverflow.com/q/25286324
favorite count: 0
type: Question
upvote count: 4
has title: How to get notified when a client connects or disconnects in netty?
type: UnansweredQuestion
tagged with: netty
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/25286457
has body: I want to get notified whenever a client(browser is my client here) connects or disconnects from the netty server. I have extended SimpleChannelInboundHandler and i m working on websockets so overiding channelActive and channelInactive method would solve my problem? And if yes then please help me out or if there is any other way to achieve it.Thanks
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39543715
comment on: http://stackoverflow.com/q/25361173
has text: What I am missing here in the above program, is what this refers to. Since the form of the constructor is Thread(Runnable ob, String name), this refers to a Runnable type object?
score: 0
type: Comment
type: QuestionComment

cdi
tags question: http://stackoverflow.com/q/25386414
type: Tag
tags question: http://stackoverflow.com/q/25374579
tags question: http://stackoverflow.com/q/25247689
tags question: http://stackoverflow.com/q/25384514
tags question: http://stackoverflow.com/q/25267209
tag name: cdi
tags question: http://stackoverflow.com/q/25284721
tags question: http://stackoverflow.com/q/25385802

http://stackoverflow.com/q/25306049
type: Question
tagged with: algorithm
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25306107
has answer: http://stackoverflow.com/a/39834419
has title: How could I determine if domain name is upper-level(primary) or lower-level(secondary)?
score: 0
tagged with: subdomain
has comment: http://stackoverflow.com/comment/39442681
answer count: 2
has body: Is there some algorithm for this? for example twitter.com zamg.ac.at are top level domains and pic.twitter.com is secondary level domain
tagged with: java
linked to: http://stackoverflow.com/q/2141224

http://stackoverflow.com/a/25236322
answers question: http://stackoverflow.com/q/25236198
has comment: http://stackoverflow.com/comment/39314004
score: 11
has body: You can attempt to get the Jedis resource from the JedisPool. A JedisConnectionException will be thrown if a connection has not been established: JedisPool pool = new JedisPool(...); try { Jedis jedis = pool.getResource(); // Is connected } catch (JedisConnectionException e) { // Not connected }
accepted answer of: http://stackoverflow.com/q/25236198
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/39313690
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25238697
has comment: http://stackoverflow.com/comment/39318081
tagged with: java
score: -3
has body: hi i am writing some data to a file if i have 10000 lines in 1000 line i want some content like "N/D" in the remaing i have get "D" but here the problem is not in sequence it has to get randomly "D" in 1000 lines.... File newfile = new File("/root/Documents/"+name+".txt"); // if file doesnt exists, then create it if (!newfile.exists()) { newfile.createNewFile(); } FileWriter fw = new FileWriter(newfile.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); FileInputStream file = new FileInputStream(new File(filePath)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); Iterator rows = sheet.rowIterator(); while (rows.hasNext()) { XSSFRow row = (XSSFRow) rows.next(); Iterator cells = row.cellIterator(); List dd = new ArrayList(); while (cells.hasNext()) { XSSFCell cell = (XSSFCell) cells.next(); String mobileNumber=data.formatCellValue(cell); String mobile=mobileNumber.substring(0, 5)+"****"; String content=date +" "+ mobile +" " + encode + " "+"N/D"; bw.write(content); bw.newLine(); } } file.close(); bw.close(); System.out.println("Done");
has comment: http://stackoverflow.com/comment/39318079
has answer: http://stackoverflow.com/a/25239084
downvote count: 4
has comment: http://stackoverflow.com/comment/39317873
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39317811
has title: How to execute some piece of code randomly
tagged with: excel
favorite count: 0
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25360534
has answer: http://stackoverflow.com/a/25360608
has body: This is very simple: Using Android Studio, I can't build a project because I'm getting the error: Error: java: unreported exception org.json.JSONException; must be caught or declared to be thrown Here is the offending code: public static JSONObject toJsonObject(String json){ JSONObject jsonObj = new JSONObject(json); return jsonObj; } I'm importing org.json.JSONObject; by the way. The squiggly red line is underneath "new JSONObject(json)". It doesn't seem to like being passed a String, but everywhere I've seen e.g. https://github.com/douglascrockford/JSON-java/blob/master/JSONObject.java suggests it can. I have tried making the class and method non-static, and have rebuilt projhect/restarted Android Studio. I know this must be something simple I've missed...
type: Question
has comment: http://stackoverflow.com/comment/39542343
has answer: http://stackoverflow.com/a/25360811
upvote count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25360608
favorite count: 0
accepted answer: http://stackoverflow.com/a/25360811
score: 2
type: AnsweredQuestion
answer count: 3
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Very simple JSONObject unreported exception org.json.JSONException at design time
has answer: http://stackoverflow.com/a/25360679

http://stackoverflow.com/a/25305796
has body: Hope you get an idea/direction to proceed further with below code. String myCurrentID = ""; String strPreviousID = ""; while (moreRecordsAvailable) { myCurrentID = resulset.getString("ID"); if (!myCurrentID.equals(strPreviousID )) { // If the previous and current are different, then add both artist and picture objects strPreviousID = myCurrentID ; Artist artist = new Artist(); artist.setId(resulset.getString("a.id")); ........ Pic pic = new Pic(); pic.setIdArtist(resulset.getString("a.id")); pic.setUrl(resulset.getInt("p.picUrl")); ..... artist.setPic(pic ); } else { // If previous and current is same, then add only pictures object. Need not add artist object here. Pic pic = new Pic(); pic.setIdArtist(resulset.getString("a.id")); pic.setUrl(resulset.getInt("p.picUrl")); } }
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25305380
answers question: http://stackoverflow.com/q/25305380
type: Answer

http://stackoverflow.com/comment/39404770
type: QuestionComment
type: Comment
has text: This has very little to do with programming, but rather with an elementary school physics/maths course (I use the word elementary freely here, not sure if there are actual "elementary" schools anywhere). The position of the object after `i` iterations with initial speed of `speed` and initial position `pos` and acceleration `acc` will be `pos + i * speed + acc * (i^2) / 2`
score: 0
comment on: http://stackoverflow.com/q/25285741

http://stackoverflow.com/q/25240974
answer count: 2
tagged with: push-notification
accepted answer: http://stackoverflow.com/a/25243166
score: 1
downvote count: 0
upvote count: 1
has body: I made a mistake in implementing gcm for my app in my phone, and it's not reciving any notifications now. The same app works perfectly(recives gcm notifications) in any other device. I need to unregister my phone from gcm what should I do? Should I wait 7 days(default expiry time)?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39775939
has answer: http://stackoverflow.com/a/25243166
tagged with: android
tagged with: java
tagged with: google-cloud-messaging
has answer: http://stackoverflow.com/a/25241687
possible better answer: http://stackoverflow.com/a/25241687
type: AnsweredQuestion
has title: How can I reset my device's Google Cloud Messaging registration?

http://stackoverflow.com/q/25236198
tagged with: java
downvote count: 0
score: 6
has title: Check connection Redis
favorite count: 0
type: Question
tagged with: redis
possible better answer: http://stackoverflow.com/a/41591262
has answer: http://stackoverflow.com/a/41591262
has answer: http://stackoverflow.com/a/25236322
has body: I am using the Redis in Java using the Jedis client. I am creating a JedisPool and would like to know if the connection is successful, is there a way of doing this without fetching an object?
upvote count: 6
tagged with: jedis
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25236322

http://stackoverflow.com/a/31980393
type: Answer
has body: For those who had trouble with the apt-get, or with the long instruction. I solved it in a relatively painless way. Download the installer from here, or direct download link $ sudo dpkg -i oracle-java8-installer_8u51+8u51arm-1-webupd8-0_all.deb
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25289482

http://stackoverflow.com/a/25274031
type: Answer
accepted answer of: http://stackoverflow.com/q/25269561
score: 0
type: AcceptedAnswer
has body: I solved the problem: I was clearing the buffers every time I wanted to draw something. I've moved the clear now, and it works.
answers question: http://stackoverflow.com/q/25269561

http://stackoverflow.com/a/25292853
score: 0
answers question: http://stackoverflow.com/q/25292595
has body: You need to restart your scan over your username file for each iteration of your outer loop. At the moment your inner loop immediately scans to the end of your username file and never starts from the top again in subsequent iterations of the outer loop. You could achieve this by adding: listScanner = new Scanner(list); At as the last statement in your outer loop. Note, Repeatedly scanning through one of your files like this is very inefficient. If one of your files is smallish (less than gigabytes say), consider loading it fully into a HashSet first.
type: Answer

http://stackoverflow.com/a/25264011
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25263892
type: Answer
has body: Try using Log.i(inputLine); for more details you can refer to http://developer.android.com/reference/android/util/Log.html
downvote count: 0

http://stackoverflow.com/a/25308238
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25307720
downvote count: 0
has body: If you know the current working directory (test it with: System.out.println(new File(".").getAbsolutePath()); you can hardcode a relative directory like ../../XML/RequestXML For the record: although this may help, I still believe you should try to solve this with a configuration parameter or by loading it as a resource available in the classpath.
score: 3

http://stackoverflow.com/a/25287029
has body: I'm trying to get my head around the logic of the code ... But one thing that I've noticed is that you do this kind of thing in a couple of places: Thread thread = new Thread(new Runnable(){ ... }); thread.start(); thread.join(); This usage of threads is pointless. You could achieve exactly the same effect by executing the body of the Runnable.run() method. Indeed, it is worse than pointless, because if the run() method throws some unchecked exception that isn't caught and logged in the run() method itself, then that exception is liable to go unnoticed. And, it is possible that that might be happening here ... But even if not, the redundant threading is expensive, and makes your code more complicated and harder to read. The only other thing I can think of is that the client side may not be getting the correct login response line. That would cause it to think that login had failed. Apart from that, the best suggesting I can make is to run the client-side code in a debugger or add more trace-printing or logging. (For example, look at what Socket.isClosed() returns at various points ....)
downvote count: 0
has comment: http://stackoverflow.com/comment/39409155
upvote count: 1
has comment: http://stackoverflow.com/comment/39407980
has comment: http://stackoverflow.com/comment/39407380
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25286348
has comment: http://stackoverflow.com/comment/39407315
has comment: http://stackoverflow.com/comment/39407080

http://stackoverflow.com/comment/39465648
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25318266
has text: You can add a check if same name file exists than delete it and create new and store data in it. By doing that you will always have a fresh data without duplication.

http://stackoverflow.com/q/25341634
downvote count: 0
accepted answer: http://stackoverflow.com/a/25341662
duplicate of: http://stackoverflow.com/q/1855170
has title: Why intern method does not return equal String in java
favorite count: 0
type: Question
upvote count: 5
linked to: http://stackoverflow.com/q/1855170
tagged with: java
has answer: http://stackoverflow.com/a/25341662
has comment: http://stackoverflow.com/comment/39520478
has body: public static void main (String[] args) { String s1 = new String("hello"); String s2 = new String("hello"); s1.intern(); s2.intern(); System.out.println(s1 == s2); // why this returns false ? } as per my understanding, 1st call to intern method should have created a 'string intern pool' with a single string "hello". second call to intern method would have done nothing (as "hello" string is already present in pool). Now, when i say s1 == s2 i am expecting JVM to compare "hello" string from string intern pool and return true.
has answer: http://stackoverflow.com/a/25341656
possible better answer: http://stackoverflow.com/a/25341656
has comment: http://stackoverflow.com/comment/39514453
answer count: 4
type: AnsweredQuestion
score: 5
has answer: http://stackoverflow.com/a/25342245
has answer: http://stackoverflow.com/a/25341658
has comment: http://stackoverflow.com/comment/39509439

http://stackoverflow.com/q/25365054
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39562551
downvote count: 0
tagged with: javascript
upvote count: 1
has comment: http://stackoverflow.com/comment/39562494
has title: how to stop master ajax request if slave ajax request fails in extjs
has body: I am newbie to extjs 4.1, I developed a small app wherein I have a master and slave concept i.e basis on master's ajax success i have to fire slave's ajax request, if slave fails then master should also fail and vice versa. Please find the below snipnet of my code Controller.js Ext.define('Basel3.controller.Contacts', { extend: 'Ext.app.Controller', stores:['...My all store goes here...'], models:['...My all models goes here...'], views: ['...My all views goes here...'], refs:[{ My all references goes here }], init: function(){ this.control({ .... }) }, save: function() { this.getRulesStore().save(); this.getRuleDetailsStore().save(); } } As in the aforementioned code we can see that I have used the stores to save the data in my database, which fires seperate ajax request, which I don't want to do. Below are the store and model of the respective entities. Models Rule Detail: Ext.define('Basel3.model.RuleDetail', { extend: 'Ext.data.Model', fields: [{name: 'ruleDetailId', type: 'int'}, {name: 'ruleId',type: 'string'}, {name: 'attrName',type: 'string'}, {name: 'attrType',type: 'string'}, {name: 'attrOprtr',type: 'string'}, {name: 'attrValue',type: 'string'} ] }); Rule: Ext.define('Basel3.model.Rule', { extend: 'Ext.data.Model', fields: [{name: 'ruleName',type: 'string'}, {name: 'ruleGroup', type: 'string'}, {name: 'ruleReportName', type: 'string'}, {name: 'ruleCategory',type: 'string'}, {name: 'ruleTypeId',type: 'string'}, {name: 'ruleFactor',type: 'string'}, {name: 'effDate',type: 'date', dateFormat :'d-M-y'} ] }); Stores: Rule Details: Ext.define('Basel3.store.Contacts', { extend: 'Ext.data.Store', model: 'Basel3.model.Contact', autoLoad: true, pageSize: 35, storeId : 'Contacts', autoLoad: {start: 0, limit: 35}, sorters: ['attrType'], groupField: 'attrType', proxy: { type: 'ajax', api: { read : 'ruledetail/view.action', create : 'ruledetail/create.action', update: 'ruledetail/update.action', destroy: '' }, model : 'Basel3.model.Contact', reader: { //reads the data i…
tagged with: ajax
tagged with: extjs
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39562608
favorite count: 0
type: Question
answer count: 0

http://stackoverflow.com/comment/39697949
has text: One main drawback is when checking the last line it has taken more time(nearly a minute). Every hundredth line checking was goes fast.only problem with last line checking.Check it once.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25441332

http://stackoverflow.com/a/25292695
has comment: http://stackoverflow.com/comment/39430117
has body: from what I understand, UriComponentsBuilder doesn't encode the query parameters automatically, just the original HttpUrl it's instantiated with. In other words, you still have to explicitly encode: UriComponentsBuilder is encoding your URI in accordance with RFC 3986 (see http://www.ietf.org/rfc/rfc3986.txt, in particular section 3.4 which is about the 'query' component of a URI). Within the query component, the characters '/' and ':' are permitted, and do not need escaping. To take the '/' character for example: the query component (which is clearly delimited by unescaped '?' and (optionally) '#' characters), is not hierarchical and the '/' character has no special meaning. So it doesn't need encoding. UriComponentsBuilder.fromUriString("/test/").queryParam("rt",URLEncoder.encode("http://a.com?u=1", "UTF-8")).build(false).encode().toUriString(); output : /test/?rt=http%253A%252F%252Fa.com%253Fu%253D1
answers question: http://stackoverflow.com/q/25283139
type: Answer
score: 0

http://stackoverflow.com/comment/97635388
score: 0
comment on: http://stackoverflow.com/a/25303840
type: Comment
has text: ()->fibRec(1k) is better than "{}",fibRec(1k) ;-)
type: AnswerComment

http://stackoverflow.com/q/25295253
has title: Differences between webservice URL ending with '/'
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: jax-rs
upvote count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/25295484
favorite count: 0
linked to: http://stackoverflow.com/q/5948659
type: Question
has comment: http://stackoverflow.com/comment/39441290
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39422814
has body: I just started learning Webservices using JAX-RS in Java. My webservice URL is http://localhost:8080/test/testWebservcie That is working fine. Just to play around with it I added '/' at end of the URL like below http://localhost:8080/test/testWebservcie/ even that is working fine and no issues at all. What is the differences between those two ? can I replace one with another ?

http://stackoverflow.com/comment/39343891
type: QuestionComment
comment on: http://stackoverflow.com/q/25252127
score: 0
type: Comment
has text: I understand the question, there's just a better way to achieve it ;)

http://stackoverflow.com/comment/39437273
type: Comment
type: QuestionComment
score: 0
has text: @MadProgrammer Ya my main concern is regarding restart service which might take some time, so i wanted to wait until that process is complete. So it should execute sequentially right?
comment on: http://stackoverflow.com/q/25302999

http://stackoverflow.com/comment/39403780
has text: But what is the harm of making 1 and then change into 2, 3, 4 etc? Wouldn't be better that way? I didn't get the advantage to be honest.
comment on: http://stackoverflow.com/a/25285147
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25379824
tagged with: agents-jade
has comment: http://stackoverflow.com/comment/39579165
type: Question
has answer: http://stackoverflow.com/a/25380062
linked to: http://stackoverflow.com/q/13116192
accepted answer: http://stackoverflow.com/a/25380062
has title: any other ways similar to observer pattern
has comment: http://stackoverflow.com/comment/39579393
has comment: http://stackoverflow.com/comment/39579982
has comment: http://stackoverflow.com/comment/39579259
has body: I was asked to implement the function which waits for some action to be done. Then lets it do whatever it is supposed to do. I was asked not to use observer class. I tried with infinite loop and it worked. So i wonder if there are any other ways i could do that. (im developing an app in Jade where an supper agent communicates with other agents and once a message is received by and agent he can do some function and send back a message). I want something for that waiting part. Thanks in advance
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39579690
tagged with: java
answer count: 1
tagged with: observer-pattern

http://stackoverflow.com/comment/39567317
comment on: http://stackoverflow.com/a/25373349
score: 0
type: AnswerComment
type: Comment
has text: thanks, i tried this because I figured it was something like this. I was working on the same thing earlier, different project and this time I was just using a jpane vs earlier jframe. its working fine because I restarted, tho yes this answers my question

http://stackoverflow.com/comment/39482725
comment on: http://stackoverflow.com/q/25327506
score: 2
has text: `tiger t` should be `Tiger t`. Java is case sensitive (as are many, many other languages).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39548562
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25362462
type: Comment
has text: The question that you linked to already seems to contain an answer to this question. (The answer was originally posted as an edit to the question, but I've added a community wiki answer, so it's a bit clearer now.) It might have been more appropriate to simply flag as a duplicate.

http://stackoverflow.com/q/25298965
answer count: 1
favorite count: 0
type: Question
has title: Maven set up questions
tagged with: java
tagged with: eclipse
has body: I just started using researching Maven and am trying to figure it all out. I had to use it with this online tutorial in mongoDB i'm taking to run maven on a couple of different pom.xml files to build a couple of different apps. I have a few questions about Maven though that will hopefully help me better understand how to use it. I understand the concept of Mavens pom.xml including different dependancies. When i ran Maven on a certain pom.xml in eclipse, the file loaded everything necessary for Spark and FreeMarker. How is this different from a regular import statement? couldn't your source code import FreeMarker/Spark? or is this some kind of difference between frameworks and classes? Also it seems the only way to make an existing project into a maven project with a proper pom would be to create new maven project (with the same project name?)and copy all of your source code into the src folder. Would you then have to build up test code for all of your source code? how important is the test code in a maven project? So, a new maven project from scratch would build the proper maven 2 directory structure after i identify artifactID, groupID, and version, then I would build all my code under the src folder, tests under the test folder and manually add dependancies to the pom as i go? I just want to get my head around what makes Maven so important so I can fully utilize using it. Any kind of information is greatly appreciated. Thanks for your time.
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25299227
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/25299227
downvote count: 1

http://stackoverflow.com/comment/39354858
comment on: http://stackoverflow.com/a/25244314
score: 0
type: AnswerComment
has text: What do you meen by base sources? These are files that are generated by the UIMA framework (https://uima.apache.org/). They are just Java files. I have tons of them in other projects and those project can be deployed without any problem (outputing the same warnings).
type: Comment

http://stackoverflow.com/q/25351427
accepted answer: http://stackoverflow.com/a/25351458
tagged with: java
has answer: http://stackoverflow.com/a/25351458
has body: In the page Wikipedia - Shifts in Java: In bit and shift operations, the type byte is implicitly converted to int. If the byte value is negative, the highest bit is one, then ones are used to fill up the extra bytes in the int. So byte b1=-5; int i = b1 | 0x0200; will give i == -5 as result. I understand that 0x0200 is equal to 0b0000 0010 0000 0000. But what is the significance of 0x0200 in the passage shown above? I mean&mdash;b1 | 0x0200 will always be equal to i (see "My Test" below), then in the passage above, why not simply write byte b1=-5; int i = b1? My Test: public static void main(final String args[]) { final byte min_byte = Byte.MIN_VALUE; // -128 final byte limit = 0; // according to the bolded words in the passage for (byte b = min_byte; b &lt; limit; ++b) { final int i1 = b; final int i2 = b | 0x0200; if (i1 != i2) { // this never happens! System.out.println(b); } } }
has title: Java "int i = byte1 | 0x0200" vs "int i = byte1"?
tagged with: bitwise-operators
possible better answer: http://stackoverflow.com/a/25351509
favorite count: 0
score: 2
answer count: 2
has answer: http://stackoverflow.com/a/25351509
upvote count: 2
has comment: http://stackoverflow.com/comment/39527109
tagged with: bit-manipulation
downvote count: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/39530603
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25354032
has text: @yshavit: interesting, my Eclipse 4.4 says `Additional bounds are not allowed in cast operator at source levels below 1.8` if i change the jdk version to 1.7 (But Eclipse could be wrong of course)
score: 0

entryset
tag name: entryset
tags question: http://stackoverflow.com/q/25336546
type: Tag

http://stackoverflow.com/comment/39501381
score: 0
has text: @Code-Apprentice How can I achieve that solution.Please provide an example.
comment on: http://stackoverflow.com/q/25336981
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25251367
has comment: http://stackoverflow.com/comment/39341996
score: 0
has answer: http://stackoverflow.com/a/25251503
tagged with: arrays
has comment: http://stackoverflow.com/comment/39341865
linked to: http://stackoverflow.com/q/1128723
type: Question
linked to: http://stackoverflow.com/q/8229473
accepted answer: http://stackoverflow.com/a/25251563
has answer: http://stackoverflow.com/a/25251563
tagged with: java
has body: I am working on a budget app for practice. And I am using an array of objects and want to be able to iterate through an array and only print out an element of the same name once, to create a menu for a user to choose from, without hard coding it in. I want my output to look like this: Groceries Restaurants Other expenses. Not listed. So I want to avoid having the "expense type" being listed more than once. Make sense? Here is the code that I have so far: package homebudget; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.JOptionPane; /** * * @author Derek */ public class HomeBudget { //Features to add: //Reminder 2 days before an auto deduction public static void main(String[] args) throws Exception { // TODO code application logic here List&lt;Bills&gt; deductions = new ArrayList(); String billName, deductDate, resp; double amount, totalAmount; int cmd, year, month, date; totalAmount = 0; List&lt;Spending&gt; expenses = new ArrayList(); String type; List&lt;Income&gt; deposits = new ArrayList(); String incomeType; String fname = JOptionPane.showInputDialog("Enter the name of the budget file, none if no file"); if (fname.compareTo("none") !=0) { FileInputStream ist = new FileInputStream(fname); ObjectInputStream ifile = new ObjectInputStream(ist); deductions = (ArrayList&lt;Bills&gt;) ifile.readObject(); } boolean done = false; while(!done) { resp = JOptionPane.showInputDialog("Enter a command from: \n" + "\t1:Add a new deduction\n" //think its done + "\t2:Add a new expense\n" //this is done, but could be made better wit + "\t3:Add a deposit\n" //This is done + "\t4:Deduction options\n" + "\t5:Expense Options\n" + "\t6:Total balances in bank\n" + "\t7:quit"); cmd = Integer.parseInt(resp); switch(cmd) { case 1: billName = JOptionPane.showInputDialog("Enter the name of the bill:"); deductDate = JOptionPane.showInputDialog("Enter the deduct date:"); resp =…
type: AnsweredQuestion
has title: how to print out the same name of an array element once
possible better answer: http://stackoverflow.com/a/25251503
answer count: 2

http://stackoverflow.com/a/25261400
has body: You are setting the text filed value to empty formattedTextField_4.setText(""); Therefore every time that text field get focus nothing will be remain in text filed
accepted answer of: http://stackoverflow.com/q/25260954
type: Answer
has comment: http://stackoverflow.com/comment/39359959
has comment: http://stackoverflow.com/comment/39360070
answers question: http://stackoverflow.com/q/25260954
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39359916
has comment: http://stackoverflow.com/comment/39360038

http://stackoverflow.com/q/25263468
has answer: http://stackoverflow.com/a/25264149
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25263585
tagged with: java
tagged with: hibernate
type: Question
type: UnansweredQuestion
tagged with: jpa
has body: SELECT * FROM (SELECT *,CONCAT(org_name,'|',email_id) txt FROM t_organization) a WHERE txt LIKE '%o%'; How to write hql for this
has title: How to convert this sql query into hql

http://stackoverflow.com/comment/39496070
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25333930
has text: Akk! No, no, no! A Service runs on the UI thread! ... and, FWIW, a Loader is an AsyncTask.
score: 0

http://stackoverflow.com/a/25546468
has comment: http://stackoverflow.com/comment/40510655
type: Answer
has body: I was facing similar issue in my code. Then i tried updating the recent versions of DB2 jars into my server and the code started working. Try to update your DB2 jar.
answers question: http://stackoverflow.com/q/25312562
score: 0
accepted answer of: http://stackoverflow.com/q/25312562
type: AcceptedAnswer

http://stackoverflow.com/a/25480535
answers question: http://stackoverflow.com/q/25375650
has body: Just use @ConcurrencyManagementType(CONTAINER) on a class level and container will maintain synchronization. And use methond without synchronized directive.
type: Answer
score: 0

http://stackoverflow.com/comment/39596386
type: Comment
has text: Please post the full text of the error message, we can't guess at it.
type: QuestionComment
comment on: http://stackoverflow.com/q/25388870
score: 0

http://stackoverflow.com/a/25288859
upvote count: 1
has body: The reference documentation for CIDOC CRM indicates that there is an existing RDF and/or OWL representation of the data model. The official releases page contain links for downloading the RDF representation of the data model. As of this time version 5.1 is the newest available for download. Creating a Graph from Nothing Because you have an existing data model and vocabulary, the question of "how to generate a RDF file with the CIDOC CRM format" is equivalent to "how to generate a RDF file using the data model and vocabulary provided by CIDOC". This is a pretty common problem and it's actually quite easy. Create an apache jena model. write statements into it that correspond to the way graphs are laid out in CIDOC Step two requires: read the documentation to understand the graph that you will create look at the RDF representation of the vocabulary to understand the terms you will use Creating a Graph from a Database If you already have a (relational) database containing this information, then it may be a rather simple translation from table names to vocabulary terms. This would involve executing a select query (using JDBC for example) and then writing statements into your jena Model based on the result. Expressing the graph as JSON RDF has a json serialization format JSON-LD which you can use to write your output, if necessary.
has comment: http://stackoverflow.com/comment/39471103
downvote count: 0
has comment: http://stackoverflow.com/comment/39410845
type: Answer
has comment: http://stackoverflow.com/comment/39444806
answers question: http://stackoverflow.com/q/25281401
has comment: http://stackoverflow.com/comment/39471003
has comment: http://stackoverflow.com/comment/39471077
accepted answer of: http://stackoverflow.com/q/25281401
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25363589
has comment: http://stackoverflow.com/comment/39548606
type: Answer
answers question: http://stackoverflow.com/q/25362409
has comment: http://stackoverflow.com/comment/39548246
has comment: http://stackoverflow.com/comment/39548890
has body: I don't seem to get any exceptions, attempting to create an MCVE with the code you've shown. It's not the best code, but I tried to maintain what your code looks like as much as possible. Look over it and let me know how my code differs. And again, to better help us get down to the root of the problem, you should always post an MCVE. That means the code should be runnable, i.e copy,paste,compile,run. And also please consider all my above comments (i.e. maybe using a JDialog, if you don't plan to make this application an MDI (see the link in comment) type application. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.SwingUtilities; public class MainUser implements ActionListener { WindowConstruct wconstruct; JDesktopPane desktop = new JDesktopPane(); JInternalFrame InternalWindows = new JInternalFrame(); public MainUser() { wconstruct = new WindowConstruct("..:: User's Helpdesk Main Page ::..", 500, 500); wconstruct.add(desktop); wconstruct.btnNew.addActionListener(this); } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == wconstruct.btnNew) { InternalWindows.setSize(500, 300); InternalWindows.setTitle("New task"); InternalWindows.setLayout(null); InternalWindows.setClosable(true); InternalWindows.setLocation(100, 50); desktop.add(InternalWindows); InternalWindows.setVisible(true); } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new MainUser(); } }); } class WindowConstruct extends JFrame { JButton btnNew = new JButton("Add New"); public WindowConstruct(String title, int width, int height) { super(title); setSize(width, height); add(btnNew, BorderLayout.PAGE_END); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } } }
has comment: http://stackoverflow.com/comment/39548413
score: 1
has comment: http://stackoverflow.com/comment/39548640
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39548777

http://stackoverflow.com/comment/39511962
type: QuestionComment
comment on: http://stackoverflow.com/q/25342089
has text: @Voo Can you explain please?
score: 0
type: Comment

http://stackoverflow.com/a/25250725
type: Answer
has comment: http://stackoverflow.com/comment/39343082
has comment: http://stackoverflow.com/comment/39343195
accepted answer of: http://stackoverflow.com/q/25250458
score: 0
has body: Maybe using the other way of updating. If testprovincia already exists, using the method described here might do the trick for you. Instead of using makepersistent, grab your data with the persistence manager and straight update it. That or use standard datastore's db (or ndb) puts, as explained here? Do you REALLY need the JDO?
has comment: http://stackoverflow.com/comment/39370291
answers question: http://stackoverflow.com/q/25250458
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39370433
has comment: http://stackoverflow.com/comment/39368136

http://stackoverflow.com/comment/39528139
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25352021
type: Comment
has text: Make sense, so any suggestions on how not to make its count twice?

http://stackoverflow.com/comment/39474276
type: Comment
type: QuestionComment
has text: Also note that the constructor is used to initialize an object. It's not the place to print text to the user.
score: 0
comment on: http://stackoverflow.com/q/25322952

http://stackoverflow.com/q/25372167
has title: How to obtain the name of an active Excel spreadsheet and pass it into Java?
has answer: http://stackoverflow.com/a/25372322
score: 1
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25372301
answer count: 2
tagged with: apache-poi
type: UnansweredQuestion
has body: I am working on a Java app that I need to integrate with Excel. When testing the Java app, I can hard code the excel workbook name and can do everything that I need to. But, the intention is to have an excel workbook open and run a vb macro that launches the Java code and populates the FileInputStream name with the active workbook name, not hard code the workbook name in. What I need to do is either: In Java, somehow get the name and path of the current active excel workbook as a text string and use that in my code in place of the hard coded name, as the intention is to have it run on various workbooks. I was unable to find a way of doing that via Apache POI. There only seems to be a getSheetName method available? Or alternatively, I can probably get vb to get the name of the current workbook as a string, but I'm unsure how I would pass that string into Java to use as the workbook name string variable. That's the only sticking point, everything else in the java code runs as I would like it to. Any advice would be greatly appreciated.
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39358646
type: Comment
type: QuestionComment
has text: I checked source code of `LocalMangedConnectionFactory` This class is in `jdbcadapters`. you can find it in `{JBOSS_HOME}\modules\org\jboss\ironjacamar`
comment on: http://stackoverflow.com/q/25257507
score: 1

http://stackoverflow.com/comment/39347348
has text: Why do you need a loop? You just want to do something when you click a button, but in the meanwhile you are doing what?
score: 0
comment on: http://stackoverflow.com/q/25254231
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25294165
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25417800
accepted answer: http://stackoverflow.com/a/25417800
tagged with: java
answer count: 1
has title: Re-factoring the Log4J aspect files to shared project
type: Question
has body: My application has three projects:- Web Module, Enterprise and Shared. The enterprise module has already implemented the Log4J aspect and has the code specific to Logging Aspect. Now I need to implement the Logging aspects in the web module and for that I need to move the Logging aspect code to Shared project. And the other 2 modules will use that. I moved the source files(except the log4j xml) to the shared project. Now when I tries to define a Logger Aspect bean in the enterprise project context.xml, it doesn't find the class ? The shared project doesn't have the context file which can be imported in the enterprise project. Also, the shared project is added in enterprise project dependencies. Enterprise context XML:- &lt;aop:aspectj-autoproxy&gt; &lt;aop:include name="loggerAspect"/&gt; &lt;/aop:aspectj-autoproxy&gt; &lt;!-- Logger Aspect --&gt; &lt;bean id="loggerAspect" class="net.prcins.esales.aspects.LoggerAspect" /&gt; Enterprise POM :- &lt;properties&gt; &lt;esales-shared.Version&gt;2.1.0-SNAPSHOT&lt;/esales-shared.Version&gt; &lt;/properties&gt; How to access the class from the shared code ? Also, shall I keep the XML file specific to a project or common ? I am fairly new to spring and aspects, pls suggest.
tagged with: aspectj
tagged with: spring
tagged with: logging

http://stackoverflow.com/a/25271741
type: Answer
upvote count: 4
has body: The generic type of your class Property&lt;Integer&gt; is erased during compilation. Mockito can only pick up the runtime type of your erased method. To Mockito, your class looks something like this: public class Property { private Object value; public Object get() { return this.value; } public void set(Object value) { this.value = value; } } When you mock this class, your call to model.count().get() is implicitly cast to Integer where this instruction is added by javac due to your generic information. However, Mockito only returns a mock of an Object type after it observed the types above, thus the exception. Instead of mock(Model.class, Mockito.RETURNS_MOCKS); define the return value explicitly mock(Model.class, Mockito.RETURNS_DEEP_STUBS); // intermediate mocks when(model.count().get()).thenReturn(0); The Integer type is final and cannot be mocked which is why you need to return a dummy value.
has comment: http://stackoverflow.com/comment/39379408
has comment: http://stackoverflow.com/comment/39379773
downvote count: 0
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/25271285
accepted answer of: http://stackoverflow.com/q/25271285

http://stackoverflow.com/a/25345847
score: 0
answers question: http://stackoverflow.com/q/25345787
type: Answer
has comment: http://stackoverflow.com/comment/39687729
type: AcceptedAnswer
has body: try this: First: find the viewgroup where you want to add the IB. for instance: LinearLayout layout = (LinearLayout) findViewById(R.id.mainlayout); Second: Create and parametrize the IB ImageButton ib = new ImageButton(this); //&lt;-- this is the activity ib.setImageResource(R.drawable.my_button_image); ib.setLayoutParams(new LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); Third: add the IB to the previous found viewgroup. layout.addView(ib);
accepted answer of: http://stackoverflow.com/q/25345787

android
tags question: http://stackoverflow.com/q/25378256
tags question: http://stackoverflow.com/q/25327542
tags question: http://stackoverflow.com/q/25293653
tags question: http://stackoverflow.com/q/25282804
tags question: http://stackoverflow.com/q/25329013
tags question: http://stackoverflow.com/q/25376688
tags question: http://stackoverflow.com/q/25302825
tags question: http://stackoverflow.com/q/25296449
tags question: http://stackoverflow.com/q/25299423
tags question: http://stackoverflow.com/q/25247224
tags question: http://stackoverflow.com/q/25245763
tags question: http://stackoverflow.com/q/25340423
tags question: http://stackoverflow.com/q/25230504
tags question: http://stackoverflow.com/q/25357689
tags question: http://stackoverflow.com/q/25263940
tags question: http://stackoverflow.com/q/25333658
tags question: http://stackoverflow.com/q/25251781
tags question: http://stackoverflow.com/q/25365598
tags question: http://stackoverflow.com/q/25282312
tags question: http://stackoverflow.com/q/25234128
tags question: http://stackoverflow.com/q/25350506
tags question: http://stackoverflow.com/q/25320653
tags question: http://stackoverflow.com/q/25366309
tags question: http://stackoverflow.com/q/25280038
tags question: http://stackoverflow.com/q/25337940
tags question: http://stackoverflow.com/q/25261296
tags question: http://stackoverflow.com/q/25351234
tags question: http://stackoverflow.com/q/25269383
tags question: http://stackoverflow.com/q/25385350
tags question: http://stackoverflow.com/q/25255753
tags question: http://stackoverflow.com/q/25345885
tags question: http://stackoverflow.com/q/25346600
tags question: http://stackoverflow.com/q/25385769
tags question: http://stackoverflow.com/q/25275821
tags question: http://stackoverflow.com/q/25339169
tags question: http://stackoverflow.com/q/25230251
tags question: http://stackoverflow.com/q/25342919
tags question: http://stackoverflow.com/q/25320572
tags question: http://stackoverflow.com/q/25349005
tags question: http://stackoverflow.com/q/25334873
tags question: http://stackoverflow.com/q/25321773
tags question: http://stackoverflow.com/q/25314777
tags question: http://stackoverflow.com/q/25232552
tags question: http://stackoverflow.com/q/25339940
tags question: http://stackoverflow.com/q/25365022
tags question: http://stackoverflow.com/q/25347646
tags question: http://stackoverflow.com/q/25310948
tags question: http://stackoverflow.com/q/25275898
tags question: http://stackoverflow.com/q/25264017
tags question: http://stackoverflow.com/q/25239436
tags question: http://stackoverflow.com/q/25232731
tags question: http://stackoverflow.com/q/25333959
tags question: http://stackoverflow.com/q/25372467
tags question: http://stackoverflow.com/q/25380895
tags question: http://stackoverflow.com/q/25327445
tags question: http://stackoverflow.com/q/25257593
tags question: http://stackoverflow.com/q/25280006
tags question: http://stackoverflow.com/q/25269771
tags question: http://stackoverflow.com/q/25270239
tags question: http://stackoverflow.com/q/25341344
tags question: http://stackoverflow.com/q/25287619
tags question: http://stackoverflow.com/q/25334496
tags question: http://stackoverflow.com/q/25336752
tags question: http://stackoverflow.com/q/25269042
tags question: http://stackoverflow.com/q/25271604
tags question: http://stackoverflow.com/q/25368438
tags question: http://stackoverflow.com/q/25253651
tags question: http://stackoverflow.com/q/25255336
tags question: http://stackoverflow.com/q/25359097
tags question: http://stackoverflow.com/q/25296196
tags question: http://stackoverflow.com/q/25343471
tags question: http://stackoverflow.com/q/25348938
tags question: http://stackoverflow.com/q/25376724
tags question: http://stackoverflow.com/q/25385180
tags question: http://stackoverflow.com/q/25381749
tags question: http://stackoverflow.com/q/25299769
tags question: http://stackoverflow.com/q/25276398
tags question: http://stackoverflow.com/q/25357933
tags question: http://stackoverflow.com/q/25291282
tags question: http://stackoverflow.com/q/25306852

http://stackoverflow.com/q/25336943
has body: I am trying to read a sequence from a file to train an HMM using Jahmm library. I am getting the following error: Exception : be.ac.ulg.montefiore.run.jahmm.io.FileFormatException: Integer expected Following is my vector.seq file # A simple data file 1; 2; 3; 2; 4; 6; Following is my code public class HMMDemo { public static void main(String[] args) { try{ Reader reader = new FileReader("vectors.seq"); List&lt;List&lt;ObservationInteger&gt;&gt; v = ObservationSequencesReader. readSequences(new ObservationIntegerReader(), reader); reader.close(); }catch(Exception e){ System.out.println("Exception : " + e); } } } I am getting an exception "Integer Expected" but in my vector.seq file I have integers only. I am following the instructions at http://www.run.montefiore.ulg.ac.be/~francois/software/jahmm/example/
has title: Integer Expected Exception while training a HMM using Java HMM Library
score: 0
tagged with: file-io
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39502316
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/29972658

http://stackoverflow.com/q/25370033
upvote count: 1
has body: For example, when I store 5/3 as a double, I get 1.0 returned. What datatype should I use for real numbers like 5/3 so that it returns 1.67 in java?
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25370103
possible better answer: http://stackoverflow.com/a/25370133
has answer: http://stackoverflow.com/a/25370103
has answer: http://stackoverflow.com/a/25370133
tagged with: type-conversion
type: AnsweredQuestion
has title: What datatype should i use to store non terminating rational numbers
has comment: http://stackoverflow.com/comment/39560909
tagged with: numbers
answer count: 2
score: 1
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25279302
linked to: http://stackoverflow.com/q/7373567
has answer: http://stackoverflow.com/a/25283103
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39392800
has title: How to read xml file present in Servlet request
has body: Header Request POST http://{URL} HTTP/1.1 Accept: */* Accept-Language: en-us Content-Type: text/xml; charset=UTF-8 Accept-Encoding: gzip, deflate Content-Length: 1049 Connection: Keep-Alive Pragma: no-cache <?xml version="1.0"?> dummy pwd I have the above request which is send to a ServletRequest in doFilter. I am able to read parameters by using servet apis as below HttpServletRequest req = (HttpServletRequest) request; Enumeration<String> params = req.getParameterNames(); How can I read the xml content inorder to retrieve UserID in that xml using servlet in Java
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
upvote count: 2
downvote count: 2
type: UnansweredQuestion
tagged with: servlet-filters
has comment: http://stackoverflow.com/comment/39393770
tagged with: servlets
has comment: http://stackoverflow.com/comment/39392943

http://stackoverflow.com/q/25322550
linked to: http://stackoverflow.com/q/7805572
answer count: 1
upvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/15844220
accepted answer: http://stackoverflow.com/a/25325625
has title: Filtering JPA eager fetched entites
has answer: http://stackoverflow.com/a/25325625
type: AnsweredQuestion
has body: I have a bunch of JPA entites (witch Hibernate) called Nodes, with the following fields: NodeId ParentNodeId Active The ParentNodeId refers to another Node, so I have a nice tree structure. I've set the fetch type of Node to eager, so I get all the elements in the tree. What I would like to do, is to filter the tree by Active property, that is get only those nodes, which has its Active field set to 1. Is there an easy way to do this? Thank, krisy
score: 1
tagged with: java
tagged with: hibernate
tagged with: jpa
downvote count: 0

http://stackoverflow.com/q/25337743
has comment: http://stackoverflow.com/comment/39507298
type: Question
answer count: 0
type: UnansweredQuestion
has title: Javafx - can a loop be paused?
has body: I have never heard of a loop being paused before, but I'm still learning and I'm trying to make a poker game to where each AI makes there choice if one of them raises the bet then the round must continue until everyone has met that bet or folded I'm sort of learning the game as I go. I'm working with a Texas Hold Em style of poker and I want the players to make their choices and then have the game continue after the player has made theirs. If a loop can't be paused and I doubt it can, then what would be the best way to go about doing this? I basically have a class with a set of rules, the players cards get passed to it along with the community cards, gets analyzed and the best hand is returned. The AI will be created using the same class that the players hand is created with and a separate class will be created for controlling each AI's hand. The system is setup so that I can basically add different rule sets for different styles of poker and casino card games. I'm trying to create my first full blown program while at the same time writing it in a way that will allow it to be easily modified so that you can add or take away elements without having to rewrite everything Edit: Alright, cool so i read through James_D's post and since the rotation of the game changes each game until a new game is created (Think 6 players sitting around a table one is randomly chosen as the dealer at the start, each game the dealer becomes the person to the left of the current dealer every game until a new game is started and the process is then restarted). So what ill do is load all the players in an ArrayList in the order they are to play according to who the dealer is for that game and set a variable for tracking the players turn, when its the next players turn an action such as call, check, raise, or fold will change the players turn and will notify the next player it is their turn, if this is an AI then they will make their decision upon this notification
tagged with: java-8
has comment: http://stackoverflow.com/comment/39502455
score: 0
has comment: http://stackoverflow.com/comment/39507354
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39510868

http://stackoverflow.com/a/25296938
has comment: http://stackoverflow.com/comment/39426529
has comment: http://stackoverflow.com/comment/39426312
has comment: http://stackoverflow.com/comment/39577209
has body: Simliar algorithm as already posted by Valdar Moridin, but without the need to create substrings (every call to substring will create a new String object that contains a copy of the specified range of the char[] of its source). This won't improve the time complexity, but probably reduces the total runtime for a constant factor: public static int partialSuffixMatch(CharSequence input) { int count = input.length(); for (int i = 1; i &lt; input.length(); i++) { for (int a = 0, b = i; b &lt; input.length(); a++, b++) { if (input.charAt(a) != input.charAt(b)) break; count++; } } return count; } After a short warmup, this algorithm processes a String with 10,000 equal characters in about 40 ms on my computer, and with 100,000 equal characters in about 4 seconds.
upvote count: 2
has comment: http://stackoverflow.com/comment/39440298
answers question: http://stackoverflow.com/q/25235552
type: Answer
has comment: http://stackoverflow.com/comment/39439753
has comment: http://stackoverflow.com/comment/39439819
has comment: http://stackoverflow.com/comment/39577253
has comment: http://stackoverflow.com/comment/39473377
has comment: http://stackoverflow.com/comment/39473133
score: 2
has comment: http://stackoverflow.com/comment/39582933
downvote count: 0

http://stackoverflow.com/comment/101012313
score: 0
type: Comment
has text: It worked for me, i was dealing with this bug for almost 1 day, the **@Autowired** annotation doesn't work on a setter but it does in a property.
type: AnswerComment
comment on: http://stackoverflow.com/a/42191609

http://stackoverflow.com/q/25246353
score: 0
tagged with: hook
tagged with: java
tagged with: usb
linked to: http://stackoverflow.com/q/4678247
has comment: http://stackoverflow.com/comment/39377292
has comment: http://stackoverflow.com/comment/39425642
has title: How create a global hook usb device with JNA?
type: Question
has comment: http://stackoverflow.com/comment/39333444
has comment: http://stackoverflow.com/comment/39333876
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39443958
has comment: http://stackoverflow.com/comment/39332361
has body: I'm trying get WM_DEVICECHANGE notification using Windows hooks based in this example of mouse hook (http://www.javawebdevelop.com/3205624/), but method that contains this constant is never called and when put usb device in my machine I not get any notification. Sincerely I don't know how solve. Any suggestion is welcome! I'm using NetBeansIDE and Here is my code that I'm trying now: package testusbnotification; public class TESTUSBNOTIFICATION { public static void messagem(String s) { JOptionPane.showMessageDialog(null, s); } public static final int WH_GETMESSAGE = 3; static HHOOK msgHook; static HOOKPROC msgProc; public interface MyWinUser extends WinUser { public static final int WM_DEVICECHANGE = 0x0219; } /** * @param args the command line arguments */ public static void main(String[] args) { msgProc = new GetMsgProc() { @Override public LRESULT callback(int nCode, WPARAM wParam, MSG lParam) { if (nCode &gt;= 0) { switch(wParam.intValue()) { case MyWinUser.WM_DEVICECHANGE: messagem("A Usb device was detected!"); break; } } return User32.INSTANCE.CallNextHookEx(msgHook, nCode, wParam, lParam.getPointer()); } }; HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null); msgHook = User32.INSTANCE.SetWindowsHookEx(WH_GETMESSAGE, msgProc, hMod, 0); MSG msg = new MSG(); while (User32.INSTANCE.GetMessage(msg, null, 0, 0) != 0) { User32.INSTANCE.TranslateMessage(msg); User32.INSTANCE.DispatchMessage(msg); } User32.INSTANCE.UnhookWindowsHookEx(msgHook); } public static interface GetMsgProc extends HOOKPROC { LRESULT callback(int nCode, WPARAM wParam, MSG lParam); } }
has comment: http://stackoverflow.com/comment/39348141
tagged with: jna

http://stackoverflow.com/a/25308771
score: 0
has comment: http://stackoverflow.com/comment/39448312
has comment: http://stackoverflow.com/comment/39448220
answers question: http://stackoverflow.com/q/25308509
has body: You can only separate arguments by space and this limit is posed by Java not by Eclipse. I think your issue is that you want to pass arguments which have space in them. If that is the case you can enclose that arguments in double quotations. For your example it would be: "something one" "something two" "something three" Look at this link for the details of how you can define arguments for a Java program: http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html Hope that helps.
has comment: http://stackoverflow.com/comment/39448450
has comment: http://stackoverflow.com/comment/39448096
type: Answer

http://stackoverflow.com/a/25353631
type: Answer
answers question: http://stackoverflow.com/q/25353484
has comment: http://stackoverflow.com/comment/127636180
score: 0
has body: Finally found it :D https://developers.google.com/wallet/digital/docs/jsreference#jwt It's optional field, google sends the same data when the transaction is success to issuer postback uri.

http://stackoverflow.com/q/25366168
has comment: http://stackoverflow.com/comment/39553039
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/25366315
tagged with: android
linked to: http://stackoverflow.com/q/2246228
has comment: http://stackoverflow.com/comment/39553069
tagged with: bit
has comment: http://stackoverflow.com/comment/39553082
has answer: http://stackoverflow.com/a/25366315
has title: new to java: what are the bits between i and j in 10000000000
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39553114
has answer: http://stackoverflow.com/a/25366384
downvote count: 4
answer count: 3
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25366304
has body: I have been asked to solved the following problem: You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j). EXAMPLE: Input: N = 10000000000, M = 10101, i = 2, j = 6 Output: N = 10001010100 what I dont understand, is what are the bits between i and j in 10000000000 ? can you explain this for me ? I have familarity with bitwise operations, but this has totally confused me.
has comment: http://stackoverflow.com/comment/39553120
has answer: http://stackoverflow.com/a/25366304
has comment: http://stackoverflow.com/comment/39553068
favorite count: 0
type: Question
upvote count: 4

http://stackoverflow.com/a/25264832
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/39370462
answers question: http://stackoverflow.com/q/25262509
has body: well I assume that reading value from the pin should be easy to implement. Check any tutorial Check specification of RaspPi that describes what state deasit counts as HIGH. Adjust your electric set-up to provide enough voltage on that pin on trigger value. So basically you have to scale output voltage of light sensitive meter to match high voltage considered as High for that pin. Or you can go with any ADC circuit avaliable for Rpi that will translate analog signal to digital.
score: -1
upvote count: 0

http://stackoverflow.com/comment/39315321
has text: @T.J.Crowder Well I hadn't completed the answer then :) I was writing and posting and editing and so.
type: Comment
comment on: http://stackoverflow.com/a/25237280
score: 0
type: AnswerComment

http://stackoverflow.com/a/25344809
accepted answer of: http://stackoverflow.com/q/25344492
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39514440
has comment: http://stackoverflow.com/comment/56399196
type: Answer
answers question: http://stackoverflow.com/q/25344492
has comment: http://stackoverflow.com/comment/39514584
upvote count: 5
has body: Part of the Java API for ZIP files is actually desgined to provide "on the fly" compression. It all fits nicely both with the java.io API and the servlet API, which means this is even... kind of easy (no multithreading required - even for performance reason, because usually your CPU will probably be faster at ZIPping than your network will be at sending contents). The part you'll be interacting with is ZipOutputStream. It is a FilterOutputStream (which means it is designed to wrap an outputstream that already exists - in your case, that would be the respone's OutputStream), and will compress every byte you send it, using ZIP compression. So, say you have a get request protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Your code to handle the request List&lt;YourFileObject&gt; responseFiles = ... // Whatever you need to do // We declare that the response will contain raw bytes response.setContentType("application/octet-stream"); // We open a ZIP output stream try (ZipOutputStream zipStream = new ZipOutputStream(response.getOutputStream()) {// This is Java 7, but not that different from java 6 // We need to loop over each files you want to send for(YourFileObject fileToSend : responseFiles) { // We give a name to the file zipStream.putNextEntry(new ZipEntry(fileToSend.getName())); // and we copy its content copy(fileToSend, zipStream); } } } Of course, you should do proper exception handling. A couple quick notes though : The ZIP file format mandates that each file has a name, so you must create a new ZipEntry each time you start a new file (you'll probably get an IllegalStateException if you do not, anyway) Proper use of the API would be that you close each entry once you are done writing to it (at the end of the file). BUT : the Java implementation does that for you : each time you call putNextEntry it closes the previous one (if need be) all by itself Likewise, you must not forget to close the ZIP stream…
score: 5
downvote count: 0

http://stackoverflow.com/comment/39365484
has text: You're code makes absolutely so sense
comment on: http://stackoverflow.com/q/25264098
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25363473
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18806877
tagged with: customization
tagged with: user-interface
answer count: 1
downvote count: 0
has title: Remove icon from searchView widget (not in actionBar)
has comment: http://stackoverflow.com/comment/39547954
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39548082
tagged with: searchview
tagged with: android
tagged with: java
has body: I want to customize a searchView widget in my App. Point is to remove magnifier glass icon from it (not to make it transparent, just remove). To make it easier to understand here are some screenshots: How it looks now: And how it supposed to look: I can use editText instead, but it doesn't have suggestions, which is important for me.
has answer: http://stackoverflow.com/a/25363751
score: 2
has comment: http://stackoverflow.com/comment/39550896
upvote count: 2

http://stackoverflow.com/q/25330464
has comment: http://stackoverflow.com/comment/39488778
score: -2
has comment: http://stackoverflow.com/comment/39488779
tagged with: executorservice
has answer: http://stackoverflow.com/a/25330934
type: AnsweredQuestion
has body: I have an object that I need to run through 4 scenarios. I want to split this between 2 threads (so I can send to an additional server) I got this working to the 2 servers, but in trying to clean up the code i have created what looks like this; ExecutorService executor1 = Executors.newFixedThreadPool(1); ExecutorService executor2 = Executors.newFixedThreadPool(1); executor1.execute(userProvisioner1); executor1.execute(userProvisioner2); executor2.execute(userProvisioner3); executor2.execute(userProvisioner4); executor1.shutdown(); executor2.shutdown(); while (!executor1.isTerminated()&amp;!executor2.isTerminated()) { } userProvisioner1 &amp; userProvisioner2 need to be run sequentially (as do 3 &amp; 4) but can be run along side each other. This does work, but I have hit issues since trying to use the 2 pools at once. Is this an issue with the pools or something else?
upvote count: 0
tagged with: java
downvote count: 2
tagged with: multithreading
answer count: 1
accepted answer: http://stackoverflow.com/a/25330934
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39489526
has title: Running Multiple Thread Pools (ExecutorService) together

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25327698
tags question: http://stackoverflow.com/q/25310276
tags question: http://stackoverflow.com/q/25341787
tags question: http://stackoverflow.com/q/25284022
tags question: http://stackoverflow.com/q/25294343
tags question: http://stackoverflow.com/q/25365204
tags question: http://stackoverflow.com/q/25252537
tags question: http://stackoverflow.com/q/25259259
tags question: http://stackoverflow.com/q/25236687
tags question: http://stackoverflow.com/q/25311472
tags question: http://stackoverflow.com/q/25339735
tags question: http://stackoverflow.com/q/25361919
tags question: http://stackoverflow.com/q/25310759
tags question: http://stackoverflow.com/q/25357365
tags question: http://stackoverflow.com/q/25332208
tags question: http://stackoverflow.com/q/25238464
tags question: http://stackoverflow.com/q/25255210
tags question: http://stackoverflow.com/q/25317064
tags question: http://stackoverflow.com/q/25383482
tags question: http://stackoverflow.com/q/25377708
tags question: http://stackoverflow.com/q/25315268
tags question: http://stackoverflow.com/q/25318863
tags question: http://stackoverflow.com/q/25388322
tags question: http://stackoverflow.com/q/25233131
tags question: http://stackoverflow.com/q/25230823
tags question: http://stackoverflow.com/q/25378412
tags question: http://stackoverflow.com/q/25262435
tags question: http://stackoverflow.com/q/25308331
tags question: http://stackoverflow.com/q/25273610
tags question: http://stackoverflow.com/q/25260456
tag name: json
tags question: http://stackoverflow.com/q/25374788
tags question: http://stackoverflow.com/q/25325685
tags question: http://stackoverflow.com/q/25237062
tags question: http://stackoverflow.com/q/25270823
tags question: http://stackoverflow.com/q/25296697
tags question: http://stackoverflow.com/q/25367979
tags question: http://stackoverflow.com/q/25329013
tags question: http://stackoverflow.com/q/25296449
tags question: http://stackoverflow.com/q/25382862
tags question: http://stackoverflow.com/q/25296038
tags question: http://stackoverflow.com/q/25270239
tags question: http://stackoverflow.com/q/25287619
tags question: http://stackoverflow.com/q/25291972
tags question: http://stackoverflow.com/q/25358485
tags question: http://stackoverflow.com/q/25288143
tags question: http://stackoverflow.com/q/25307994
tags question: http://stackoverflow.com/q/25359245
tags question: http://stackoverflow.com/q/25270672
tags question: http://stackoverflow.com/q/25298409
tags question: http://stackoverflow.com/q/25381791
tags question: http://stackoverflow.com/q/25360750
tags question: http://stackoverflow.com/q/25360534
tags question: http://stackoverflow.com/q/25276479
tags question: http://stackoverflow.com/q/25364002
tags question: http://stackoverflow.com/q/25332791
tags question: http://stackoverflow.com/q/25263946
tags question: http://stackoverflow.com/q/25272803
tags question: http://stackoverflow.com/q/25314172
tags question: http://stackoverflow.com/q/25389301
tags question: http://stackoverflow.com/q/25291759
tags question: http://stackoverflow.com/q/25366924
tags question: http://stackoverflow.com/q/25382394
tags question: http://stackoverflow.com/q/25334751
tags question: http://stackoverflow.com/q/25266268
tags question: http://stackoverflow.com/q/25314211
tags question: http://stackoverflow.com/q/25306170
tags question: http://stackoverflow.com/q/25295640
tags question: http://stackoverflow.com/q/25360231
tags question: http://stackoverflow.com/q/25366102
tags question: http://stackoverflow.com/q/25370751
tags question: http://stackoverflow.com/q/25252240
tags question: http://stackoverflow.com/q/25274036
tags question: http://stackoverflow.com/q/25236140
tags question: http://stackoverflow.com/q/25241362
tags question: http://stackoverflow.com/q/25380514
tags question: http://stackoverflow.com/q/25252715
tags question: http://stackoverflow.com/q/25269090
tags question: http://stackoverflow.com/q/25239319
tags question: http://stackoverflow.com/q/25316641

http://stackoverflow.com/comment/39569060
comment on: http://stackoverflow.com/q/25374168
has text: You should do `System.out.println(somePersonInstance.getPersonCount());`. I would imagine that your statement above gave an error message to the effect that `getPersonCount` is not found.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39396399
has text: As always, a bit of code is worth 1024 words...
comment on: http://stackoverflow.com/q/25281301
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25363489
linked to: http://stackoverflow.com/q/285177
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39547858
tagged with: arrays
has body: Lets say we have these two different constructors. What is the different between the first one and the second one. How is the way to do it? Explain the difference please! (I know you cant have these two constructors in the same class, this is just to show what i mean. public class StackOverFlow { private int[] x; // instance variable StackOverFlow(int[] x) { // constructor this.x=x; } StackOverFlow(int[] x) { // constructor this.x = new int[x.length]; for(int k=0 ; k &lt; x.length; k++) { this.x[k]=x[k]; } }
downvote count: 7
has answer: http://stackoverflow.com/a/25363655
favorite count: 0
has answer: http://stackoverflow.com/a/25363663
type: Question
tagged with: constructor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39548010
has title: How to initialize an array in the constructor?
score: -1
has answer: http://stackoverflow.com/a/25363574
upvote count: 6

internet-explorer-9
tag name: internet-explorer-9
type: Tag
tags question: http://stackoverflow.com/q/25359103

http://stackoverflow.com/comment/39594270
comment on: http://stackoverflow.com/q/25383777
type: Comment
score: 0
has text: @pskink How does IBinder achieve its functionality with the following codes
type: QuestionComment

http://stackoverflow.com/a/25248054
has body: You can use the class javax.xml.bind.DatatypeConverter (since Java SE 6 update 3): Code: public static void main(String[] args) { String str = "wcLDxMXGx8jJ0fHy8/T1AHsSNFw="; byte[] array = DatatypeConverter.parseBase64Binary(str); System.out.println(Arrays.toString(array)); } Output: [-63, -62, -61, -60, -59, -58, -57, -56, -55, -47, -15, -14, -13, -12, -11, 0, 123, 18, 52, 92]
type: AcceptedAnswer
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25247958
answers question: http://stackoverflow.com/q/25247958
downvote count: 0

http://stackoverflow.com/q/25293653
has title: Method to stop Android MediaPlayer using the same button?
has answer: http://stackoverflow.com/a/25312800
has body: I want to stop the Android MediaPlayer in my App using the same button which I use for starting it. As you can see from the sources below, I declared the onClick function of my button in the activity_main.xml. When clicked, the buttons value changes from an triangle to a square, if I click it again, it changes back so there is no problem with this. The tick(); function is configured to get either the string "start" or the string "stop" dependent on which version of the button has been pressed. Also the player is very laggy. It should play the click sound every second (for testing if this even works) but it is very laggy. Here is my MainActivity package net.k40s.metronome; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.MediaPlayer; import android.os.Bundle; import android.os.PowerManager; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.NumberPicker; import android.widget.Toast; import android.os.Handler; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends Activity { NumberPicker inputBPM; ImageView outputFlash; Button buttonPlay; protected PowerManager.WakeLock mWakeLock; final Handler metronomeHandler = new Handler(); MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); inputBPM = (NumberPicker) findViewById(R.id.inputBPM); outputFlash = (ImageView) findViewById(R.id.imageClick); buttonPlay = (Button) findViewById(R.id.buttonPlay); inputBPM.setMinValue(20); inputBPM.setMaxValue(150); inputBPM.setValue(120); inputBPM.setWrapSelectorWheel(true); SharedPref…
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39421996
has comment: http://stackoverflow.com/comment/39423493
type: Question
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/25479241
score: 0
type: AcceptedAnswer
has body: Here I found the full Installing progress of the OpenCV... # install basic development environment sudo apt-get install build-essential cmake pkg-config # install opencv dependencies. ubuntu 13.04 ships with opencv which is close enough to 2.4.6 to pull in most of the needed dependencies. sudo apt-get build-dep libopencv-dev # additional dependencies for java support sudo apt-get install default-jdk ant # compile opencv tar xzvf opencv-2.4.6.1.tar.gz cd opencv-2.4.6.1 mkdir build; cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON .. make sudo make install And in last don't forget to set Native library path to the /home/.../opencv-2.4.6.1/build/lib Thats it...
answers question: http://stackoverflow.com/q/25379814
type: Answer
accepted answer of: http://stackoverflow.com/q/25379814

http://stackoverflow.com/q/25315181
tagged with: eclipse
favorite count: 0
has body: I tried to install Eclipse but I have this problem that I never see before. The problem is: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. I didn't do anything on the project. Basically I just create the project as android to work on it and I find this error. The error is in the res/values, res/values-v11, res/value-v14. The text is the same that you can find on normal Eclipse: &lt;resources&gt; &lt;!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --&gt; &lt;style name="AppBaseTheme" parent="Theme.AppCompat.Light"&gt; &lt;!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --&gt; &lt;/style&gt; The same block code is in the other two classes. All the &lt; > are closed (because, as I said, I didn't change anything in the code). I read something in the site but nothing corresponds to my version of the application. What do you thing about it? What should I have to do?
type: Question
has title: Eclipse Error on styles value
linked to: http://stackoverflow.com/q/21059612
has answer: http://stackoverflow.com/a/25315471
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1

spring-data-couchbase
tags question: http://stackoverflow.com/q/25293288
tag name: spring-data-couchbase
type: Tag

http://stackoverflow.com/comment/39585299
type: Comment
type: QuestionComment
has text: Executors are modern way to create thread in java where developer has more handle on thread and it has thread pool. `ExecutorService#submit` you submit runnable instance also.
score: 1
comment on: http://stackoverflow.com/q/25383153

powermock
type: Tag
tags question: http://stackoverflow.com/q/25317804
tags question: http://stackoverflow.com/q/25307632
tags question: http://stackoverflow.com/q/25316490
tag name: powermock
tags question: http://stackoverflow.com/q/25334139
tags question: http://stackoverflow.com/q/25363884
tags question: http://stackoverflow.com/q/25250899
tags question: http://stackoverflow.com/q/25258876
tags question: http://stackoverflow.com/q/25371284
tags question: http://stackoverflow.com/q/25371387
tags question: http://stackoverflow.com/q/25246306
tags question: http://stackoverflow.com/q/25329588

http://stackoverflow.com/a/25299527
score: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25291274
upvote count: 2
has body: Instead of creating the basic auth header manually, can you try create it using UsernamePasswordCredentials, e.g. HttpPut put = new HttpPut(url); UsernamePasswordCredentials creds = new UsernamePasswordCredentials(userName, password); put.addHeader( BasicScheme.authenticate(creds,"US-ASCII",false) ); ... HttpResponse response = client.execute(put);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25291274

http://stackoverflow.com/comment/39432493
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25297453
type: Comment
has text: @789 `asyncExec` schedules its argument to run later, when the GUI thread can. But it is already running your code in the selection listener, which includes this print and has to finish first before the infinite loop can start.

http://stackoverflow.com/q/25256573
tagged with: cluster-computing
favorite count: 0
type: Question
has body: I have read the Clustering/Session Replication HOW-TO for Tomcat 7. I want to configure a password to ensure that unauthorised nodes cannot join the cluster. I was expecting that this configuration might be done on the Cluster/Channel/Membership element in the Tomcat server.xml, but I can't see anything in the documentation. Is there such a feature for Tomcat? I am looking for something similar to JGroups' AUTH protocol.
tagged with: configuration
tagged with: tomcat7
tagged with: tomcat
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
has title: How to enable member authentication in Apache Tomcat Tribes clustering
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25274003
accepted answer: http://stackoverflow.com/a/25274003

http://stackoverflow.com/comment/39522992
score: 0
has text: @matt I got -2 that's why I assumed it.
comment on: http://stackoverflow.com/q/25349418
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25299020
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has body: I am trying to make a Helicopter-like game (as you can probably tell, I'm using "Rocket Man" instead of a helicopter). I'm new to Android programming and to Stack Overflow, so don't pick apart my code too much (please). Anyway, right now I'm just trying to get the rocketman to move up while touch is held down, and move down while touch is released. It isn't working out very well. I'm using a Moto XT886 for testing, (in case that's relevent). When I run the application, it starts up and loads the MainActivity perfectly well. When I touch the screen the first time (boolean start == true), the text views are hidden, as they are supposed to. However, on the second, third, fourth and all the rest of the times I touch the screen (Start == false), nothing happens. There are no errors in Log Cat, the code doesn't seem to recognize the touch. I'm pretty sure that it has something to do with those while loops, but I'm using this application mainly to learn Android Java and I don't know enough (yet) to recognize that I'm doing something wrong. Are you able to put a while loop with the conditions as the MotionEvent of an onTouchListner? Or is it something else? Either way, I appreciate the help, this is an awesome website (this is the first question I couldn't find already asked on Stack Overflow, and for all I know, mine could've already been answered)! Here's the code to my MainActivity, if you need the .xml code as well, (though I'm pretty sure that's unnecessary) just say the word. public class MainActivity extends ActionBarActivity { boolean Start; RelativeLayout rLayout; TextView gameTitle; TextView clickStart; TextView highScore; Handler handler; ImageView rocketMan; float Y; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initialize(); rLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (Start == true) { gameTitl…
favorite count: 0
type: Question
tagged with: imageview
tagged with: android
has title: Can't change Android ImageView's Y in Java file
tagged with: eclipse

http://stackoverflow.com/comment/39487220
type: Comment
has text: Which line of your test is `30`?
type: QuestionComment
comment on: http://stackoverflow.com/q/25329588
score: 0

http://stackoverflow.com/q/25281549
has answer: http://stackoverflow.com/a/25295910
score: 3
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39398976
tagged with: spring-security
favorite count: 0
type: Question
tagged with: single-sign-on
has title: SSO with 2 spring applications in different Tomcats
type: UnansweredQuestion
downvote count: 0
tagged with: spring
tagged with: tomcat
has body: I have been asked to do an integration of our webapp into a 3rd party webapp both have identical Spring security configurations the entry point will always be the 3rd party webapp integration will be through IFrame unless there is a better way for SSO So if you had both webapps in the same Tomcat instance from what I know you could enable the SSO widget and you'd get SSO across webapps but for a number of reasons we are running the webapps in their own Tomcat servers. I've used Jasig CAS before to manage SSO services, but because the main webapp is not designed or maintained by us and there is only one entry point, I'm looking for a less invasive way of managing authentication across the services. Would a Cookie suffice of should I be looking at something else?
has comment: http://stackoverflow.com/comment/39418749

http://stackoverflow.com/q/25286516
accepted answer: http://stackoverflow.com/a/25286753
has answer: http://stackoverflow.com/a/25286753
type: AnsweredQuestion
score: 0
answer count: 3
has title: Java transform child class to parent one
tagged with: java
possible better answer: http://stackoverflow.com/a/25286705
has answer: http://stackoverflow.com/a/25286740
has answer: http://stackoverflow.com/a/25286705
type: Question
has comment: http://stackoverflow.com/comment/39406103
has body: Consider this code: public class PublicInformation { public String username; public String status; } public class PrivateInformation extends PublicInformation { public String somePrivateInformation; } I have a PrivateInformation object, and I want to send it to store it on a stream, without the values of PrivateInformation. So I want to convert it to a PublicInformation object. How should I do this? Is casting it to a PublicInformation object and send it through a stream enough?

http://stackoverflow.com/comment/39317531
comment on: http://stackoverflow.com/q/25238548
has text: *I seem to get regular calls to GC_FOR_ALLOC. This does not occur when I run my program on an HTC One M8*, GC implementation will be different for different machines, So, I wouldn't worry much about this. Show us the code where you are declaring `List/ArrayList`.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25342294
possible better answer: http://stackoverflow.com/a/25365311
accepted answer: http://stackoverflow.com/a/25342424
has comment: http://stackoverflow.com/comment/39510426
has answer: http://stackoverflow.com/a/25342424
has title: OOP player implementation libgdx
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24501268
score: 0
tagged with: oop
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25365311
type: Question
answer count: 2
has body: I would like some suggestions for the implementation object of the player. the player can have 2 textures that will be chosen depending on the button pressed, for example, the right arrow will display a texture to the left while another texture. I have implemented the interface inputprocessor in the class of player but I do not know why it does not seem very fair and very dynamic, so I would like some suggestions from you thank you very much CODE: public class Player implements InputProcessor { private Texture up; private Texture down; private Sprite player; public Player(Texture one,Texture two){ this.up=one; this.down=two; player=new Sprite(one); } @Override public boolean keyDown(int keycode) { // TODO Auto-generated method stub player.setTexture(this.down); return false; } @Override public boolean keyUp(int keycode) { // TODO Auto-generated method stub player.setTexture(this.up); return false; } @Override public boolean keyTyped(char character) { // TODO Auto-generated method stub return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { // TODO Auto-generated method stub return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { // TODO Auto-generated method stub return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { // TODO Auto-generated method stub return false; } @Override public boolean mouseMoved(int screenX, int screenY) { // TODO Auto-generated method stub return false; } @Override public boolean scrolled(int amount) { // TODO Auto-generated method stub return false; } } I implement the player class in this way, but I would like some suggestions for implementing best.
tagged with: libgdx

http://stackoverflow.com/q/25376724
answer count: 2
has answer: http://stackoverflow.com/a/25377195
tagged with: java
tagged with: email
has title: How to use BroadcastReceiver for sending email in Android ?
type: Question
has answer: http://stackoverflow.com/a/25384546
type: UnansweredQuestion
tagged with: android
has body: I'm trying to create alarm manager to send an email for particular date in my application . I have use BroadcastReceiver for send email at particular date and time.I want that when the user click my app "send" button it should send the email for particular date and time.Can some one help me please .It's urgent.Thanks to appreciate. Here is my Activity Code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_details); etServiceName = (EditText)findViewById(R.id.editText_ServiceName); etSupplierName = (EditText)findViewById(R.id.editText_SupplierName); etEmailId = (EditText)findViewById(R.id.Edittext_EmailId); etReplacementDate = (EditText)findViewById(R.id.EditText_ReplacementDate); etInterval_Days = (EditText)findViewById(R.id.EditText_IntervalDays); etNextReplanishmentDate = (EditText)findViewById(R.id.Next_Replanishment_Date); // Get current date by calender final Calendar c = Calendar.getInstance(); year = c.get(Calendar.YEAR); month = c.get(Calendar.MONTH); day = c.get(Calendar.DAY_OF_MONTH); etReplacementDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(DATE_OF_REPLACEMENT); } }); etInterval_Days.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable editable) { // TODO Auto-generated method stub String fixedDate = etReplacementDate.getText().toString().trim(); SimpleDateFormat dateFormat1 = new SimpleDateFormat( "dd-MM-yyyy" ); Calendar cal = Calendar.getInstance(); try { cal.setTime( dateFormat1.parse( fixedDate ) ); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } String strNumDays = etInte…
tagged with: alarmmanager
score: 0

http://stackoverflow.com/comment/39532038
has text: your code has major issues
score: 1
comment on: http://stackoverflow.com/q/25354760
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/97454575
score: 0
comment on: http://stackoverflow.com/q/25317678
type: Comment
type: QuestionComment
has text: I have a similar issue that I'm researching now. The data exists, it works for most IDs, but not for a few where findOne(id) returns null. The workaround we have is to define the query in the repo and forgo use of findOne(id) in lieu of a custom findOneById(id).

http://stackoverflow.com/a/40991370
has body: You should definitely check Hazelcast map configuration if you are using Vert.x. Maybe it's not related to your problem and your Vert.x usage, but I had similar problems with memory usage and found that my configuration (in cluster.xml) was not appropriate regarding my use cases. Some points you should check in Hazelcast config: backup-count - By default, Hazelcast has one sync backup copy time-to-live-seconds - Maximum time in seconds for each map entry to stay in the map is 0 (infinite) by default max-idle-seconds - Maximum time in seconds for each entry to stay idle in the map is 0 (infinite) by default eviction-policy - NONE eviction policy for Maps is used by default See Hazelcast Map documentation for more details.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25276985
type: Answer

http://stackoverflow.com/q/25347187
has comment: http://stackoverflow.com/comment/39620661
has body: I learned this code from some tutorial but it only counts left mouse clicks. I try with MouseListener but it kept counting while the timer came to 0. And with ActionListener it isn't counting the right mouse clicks. Any suggestions? Maybe its a foolish question but I'm new here. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class game extends JFrame { private static final int SwingConstants=0; Timer timer; int timercounter; int clickcounter; JLabel directions,entertime,clicklabel,timeleft,label; JButton startbutton,clickbutton; JTextField tf; JMenuBar menubar; JMenu file,help; JMenuItem reset,exit,mhelp; JFrame frame=new JFrame(); public game() { Container pane=this.getContentPane(); pane.setLayout(new GridLayout(3,1,2,2)); menubar=new JMenuBar(); setJMenuBar(menubar); file=new JMenu("File"); menubar.add(file); help=new JMenu("Help"); menubar.add(help); reset=new JMenuItem("Reset"); file.add(reset); exit=new JMenuItem("Quit"); file.add(exit); mhelp=new JMenuItem("More Help!!"); help.add(mhelp); ResetClass rc=new ResetClass(); reset.addActionListener(rc); ExitClass ec=new ExitClass(); exit.addActionListener(ec); MhelpClass mc=new MhelpClass(); mhelp.addActionListener(mc); JPanel top=new JPanel(); top.setLayout(new GridLayout(1,1)); directions=new JLabel("Enter time &amp; press &lt;Click Here&gt; REPEATEDLY!!"); top.add(directions); pane.add(top); JPanel middle=new JPanel(); middle.setLayout(new GridLayout(1,3)); entertime=new JLabel("Enter Time (sec):"); middle.add(entertime); tf=new JTextField(); middle.add(tf); startbutton=new JButton("Click Here"); middle.add(startbutton); pane.add(middle); JPanel bottom=new JPanel(); bottom.setLayout(new GridLayout(1,3)); clickbutton=new JButton("Click Here!"); clickbutton.setEnabled(false); bottom.add(clickbutton); clicklabel=new JLabel("Clicks: 0"); bottom.add(clicklabel); timeleft=new JLabel("Time left: ?"); bottom.add(timeleft); pane.add(bottom); StartButtonClass sbc=new StartButtonClass(); startbut…
favorite count: 0
has comment: http://stackoverflow.com/comment/39592782
type: Question
tagged with: actionlistener
has title: ActionListener is only counting left mouse click
has comment: http://stackoverflow.com/comment/39523052
has comment: http://stackoverflow.com/comment/39518481
accepted answer: http://stackoverflow.com/a/25387198
has comment: http://stackoverflow.com/comment/39558118
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25387198
has comment: http://stackoverflow.com/comment/39600701
type: AnsweredQuestion
score: 1
tagged with: mouselistener
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39349346
type: Comment
comment on: http://stackoverflow.com/q/25255287
type: QuestionComment
has text: Thank you, @MadProgrammer. I didn't think it was necessary for this question, but in the future I will consider it.
score: 0

http://stackoverflow.com/comment/76490819
has text: Also if you use template engine like `Thymeleaf` it will not work with `@RestController` because of `@ResponseBody` which included in this annotation.
type: Comment
type: AnswerComment
score: 13
comment on: http://stackoverflow.com/a/25242458

http://stackoverflow.com/comment/39327666
type: Comment
type: QuestionComment
has text: You have to annotate all properties with `@XmlElement` not just the `name`. Or use `@XmlAccessorType(XmlAccessType.FIELD)` and then you don't have to annotate the fields (but still make exceptions with the `@XmlTransient` annotation).
comment on: http://stackoverflow.com/q/25244091
score: 1

http://stackoverflow.com/comment/40327137
comment on: http://stackoverflow.com/a/25306068
score: 0
type: Comment
has text: @hoomi can i copy the sdk from previous folder or i have to update it in latest ADT
type: AnswerComment

http://stackoverflow.com/q/25334165
has answer: http://stackoverflow.com/a/25334304
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39498167
answer count: 1
has body: I have a class that makes async requests and parses the returned jason (http://developer.android.com/reference/android/os/AsyncTask.html#onPreExecute%28%29) public class JSONparser extends AsyncTask&lt;NameValuePair, Void, JSONObject&gt;{ // Response from the HTTP Request static InputStream httpResponseStream = null; // JSON Response String to create JSON Object static String jsonString = ""; @Override protected JSONObject doInBackground(NameValuePair... pairs) { try { // get a Http client List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); String method = pairs[0].getValue(); String url = pairs[1].getValue(); for(int i=2; i &lt; pairs.length; i++){ params.add(pairs[i]); } DefaultHttpClient httpClient = new DefaultHttpClient(); // If required HTTP method is POST if (method == "POST") { // Create a Http POST object HttpPost httpPost = new HttpPost(url); // Encode the passed parameters into the Http request httpPost.setEntity(new UrlEncodedFormEntity(params)); // Execute the request and fetch Http response HttpResponse httpResponse = httpClient.execute(httpPost); // Extract the result from the response HttpEntity httpEntity = httpResponse.getEntity(); // Open the result as an input stream for parsing httpResponseStream = httpEntity.getContent(); } // Else if it is GET else if (method == "GET") { // Format the parameters correctly for HTTP transmission String paramString = URLEncodedUtils.format(params, "utf-8"); // Add parameters to url in GET format url += "?" + paramString; // Execute the request HttpGet httpGet = new HttpGet(url); // Execute the request and fetch Http response HttpResponse httpResponse = httpClient.execute(httpGet); // Extract the result from the response HttpEntity httpEntity = httpResponse.getEntity(); // Open the result as an input stream for parsing httpResponseStream = httpEntity.getContent(); } // Catch Possible Exceptions } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) …
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/25334304
type: Question
has comment: http://stackoverflow.com/comment/39496145
tagged with: android
has title: Overriding a specific non-abstract function from class depending on a certain situation
linked to: http://stackoverflow.com/q/513832
type: AnsweredQuestion

http://stackoverflow.com/comment/39526723
type: QuestionComment
score: 0
has text: Does the actor display before you try and move it?
comment on: http://stackoverflow.com/q/25348438
type: Comment

http://stackoverflow.com/q/25239301
has body: I am trying to perform empirical analysis of the time complexity of a data set of about 1000 Codes. I have annotated them manually (how does the algorithm scale with respect to the size of input), and now I am trying to regress timing data against my complexity equation Y=C+log X + X + X log X + X^2 + X^3 + X^4 + e^X. As a metric for execution time of the program, I am currently using the number of byte codes executed during program execution. This count can by found by the -XX countBytecodes Flag in Hotspot JVM. I also tried running with and without -Xint flag in hotspot JVM which forces the JVM to execute all bytecode in interpreted mode. However the problem I am facing is, that the execution counts change when I run the same program twice. And due to this change is timing data, the regression results change. Furthar, when I run two different instances of the same code, The variation is huge in the verdict. I am not using timing data from System.currentTimeMillis/Nanos for the same reason. (I ran the data 6 times sequentially for about 500 codes and 3 times in parallel in batches of 160 codes. The variation was huge. Even the correlation between these values was random ranging from 1.00 to .37 and even small negatives in some cases.) So I am looking for alternate apporaches, which can be used as a metric for the running time of the program. The only constraint is that this metric should have a direct relationship with the performance of the code, and should give same count when the code is executed multiple times. (or atleast the correlation should be close to 1). I do not want to run timing data multiple times and take mean/median count because that is slowing things down to a great extent. And is there any other profiler that could give me the count of the number of byte codes executed, during execution of a code? A related question by me. I just want the execution counts to be same if two codes are identical, not otherwise. And my sample has trivial codes to so…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39352495
has comment: http://stackoverflow.com/comment/39367149
tagged with: profiler
linked to: http://stackoverflow.com/q/13811082
upvote count: 2
tagged with: performance
has comment: http://stackoverflow.com/comment/39362852
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/39326665
tagged with: java
has title: Empirical Analysis Of Algorithms
tagged with: profiling
downvote count: 1
linked to: http://stackoverflow.com/q/25114261
has comment: http://stackoverflow.com/comment/39326744
tagged with: jvm
has comment: http://stackoverflow.com/comment/39366651
favorite count: 0
type: Question

testng
tags question: http://stackoverflow.com/q/25296127
tag name: testng
tags question: http://stackoverflow.com/q/25376045
tags question: http://stackoverflow.com/q/25295089
tags question: http://stackoverflow.com/q/25308245
tags question: http://stackoverflow.com/q/25246535
tags question: http://stackoverflow.com/q/25367028
tags question: http://stackoverflow.com/q/25260342
tags question: http://stackoverflow.com/q/25360391
tags question: http://stackoverflow.com/q/25315196
tags question: http://stackoverflow.com/q/25329588
type: Tag

http://stackoverflow.com/comment/39574502
type: Comment
type: QuestionComment
has text: I see. Is it possible to see an example of that? And will it be stored even when I exit the app and open it again
comment on: http://stackoverflow.com/q/25376688
score: 0

http://stackoverflow.com/a/25295243
has comment: http://stackoverflow.com/comment/39424097
upvote count: 3
downvote count: 0
score: 3
has body: Probably something like that, you won't get any simpler, unless there is something to know about Student List&lt;Object[]&gt; props = new ArrayList&lt;&gt;(); for (Student student : myStudents) { Object[] std = new Object[11]; std[0] = student.whatever; // Complete the object props.add(std); } return props.toArray();
answers question: http://stackoverflow.com/q/25295137
type: Answer
has comment: http://stackoverflow.com/comment/39423185

http://stackoverflow.com/q/25357264
type: Question
has title: How can I do a popup menu without right click using awt or swing?
has answer: http://stackoverflow.com/a/25357355
has comment: http://stackoverflow.com/comment/39536335
accepted answer: http://stackoverflow.com/a/25357355
score: -2
has body: I would like to program a popup menu similar to the context menu in java using AWT or Swing, however I need to display when typing a key, for example "." I was looking por context menu but it needs right click. ¿How can I do it? Any idea... Thanks.
has comment: http://stackoverflow.com/comment/39536326
has comment: http://stackoverflow.com/comment/39536412
has comment: http://stackoverflow.com/comment/39536404
type: AnsweredQuestion
tagged with: contextmenu
answer count: 2
upvote count: 0
tagged with: java
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/39536322
tagged with: awt
has answer: http://stackoverflow.com/a/25357304
has comment: http://stackoverflow.com/comment/39536292
possible better answer: http://stackoverflow.com/a/25357304
favorite count: 0
tagged with: popupmenu

http://stackoverflow.com/comment/39544845
has text: ravinder, you owe me a detailed description of your problem. My answer is to be considered if your problem is percent encoded characters in URL with which you invoke report. What is your problem then?
comment on: http://stackoverflow.com/a/25359636
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/25292784
has comment: http://stackoverflow.com/comment/39418322
has answer: http://stackoverflow.com/a/25292817
accepted answer: http://stackoverflow.com/a/25292817
duplicate of: http://stackoverflow.com/q/754294
answer count: 1
has comment: http://stackoverflow.com/comment/39418268
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/754294
score: 0
has title: simplest way to convert int[] to LinkedList<Integer> in java?
tagged with: java
has comment: http://stackoverflow.com/comment/39424207
has comment: http://stackoverflow.com/comment/39418178
has body: I'm looking for the simplest way to convert int[] to LinkedList in java I know something like this probably works, but is there a simpler way? Integer[] m = new Integer[n]; for(int i=0; i&lt;n; i++) { m[i] = new Integer(nums[n]); } LinkedList&lt;Integer&gt; l = Arrays.asList(m);
linked to: http://stackoverflow.com/q/1073919
has comment: http://stackoverflow.com/comment/39424178
has comment: http://stackoverflow.com/comment/39417906
type: Question

http://stackoverflow.com/comment/39471631
has text: you can try overriding `onMeasure` of `Button`. you can do the scaling work if the default implement doesn't handle this.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25321500
type: QuestionComment

http://stackoverflow.com/comment/39532142
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25354760
has text: Some of the problems: "day.equal" should be "day.equals". The getNextDay() and getPreDay() methods are probably expecting the string argument day (similar to the setDay(String) method)?
score: 1

http://stackoverflow.com/comment/39367548
score: 0
comment on: http://stackoverflow.com/a/25263570
type: Comment
has text: I don't understand a couple of things: 1) in the exception, does the path which can't be loaded `/C:/Users/Administrator/Desktop/backup%20andrea/windows/workspace/MyElance/bin/nativeCode/hello.dll` need to start with that `/`? Maybe a parsing error? 2) `Exception in thread "main" java.lang.UnsatisfiedLinkError: nativeCode.HelloJNI.sayHello()V`: what the hell is that `V` at the end of the line? 3) the folder that contains Eclipse's workspace has a blankspace in its name (`backup andrea`, seen as `backup%20andrea`): would this be a problem?
type: AnswerComment

http://stackoverflow.com/comment/39348453
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25254852
has text: public E removeFirst() { E x = pollFirst(); if (x == null) throw new NoSuchElementException(); return x; }

http://stackoverflow.com/a/25282187
has comment: http://stackoverflow.com/comment/39404678
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25280377
has comment: http://stackoverflow.com/comment/39398829
score: 1
has body: I don't think there's a way to pass a file name to PDFCreator, because the whole idea is that it is a virtual printer. So to the program that sending the document, it could be being printed on a physical printer somewhere, hence an output file name would be irrelevant. Whenever I need to output reports as PDFs I use JasperExportManager, which is a much simpler solution. The exportReportToPdfFile method accepts the output file path as a string. Example: JasperPrint filledReport = JasperFillManager.fillReport("report.jrxml", params); JasperExportManager.exportReportToPdfFile(filledReport, "report.pdf"); Alternatively, you can keep your code largely the same but change your JRPrintServiceExporter to a JRPdfExporter. The new way to set the output format (now that setParameter is deprecated) is to construct an ExporterOutput and then call setExporterOutput on your exporter.
accepted answer of: http://stackoverflow.com/q/25280377
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/123460766
has text: In my scenario i do not care about each change of the file - therefore no need for listeners. I just care that if file exists - just reliably read its latest content.
type: Comment
comment on: http://stackoverflow.com/a/69817342
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39347885
type: Comment
comment on: http://stackoverflow.com/a/25254375
score: 0
type: AnswerComment
has text: @Code-Apprentice Oh, ok. I think I understand. With e.getModifiersEx() and thennn... I'm not too familiar with this. Something with a bit-wise and I think... ?

http://stackoverflow.com/comment/39316398
type: Comment
type: AnswerComment
has text: hmm u doing something wronfg i guess
comment on: http://stackoverflow.com/a/25235967
score: 0

http://stackoverflow.com/comment/39354184
score: 0
comment on: http://stackoverflow.com/q/25257920
type: Comment
type: QuestionComment
has text: @Smutje also when i am creating a `.htaccess` file it says you must specify file name.

http://stackoverflow.com/comment/39510006
has text: I managed to fix that issue. I removed that protocol part "ftp." and it connects successfully. But still file upload is not working. It looks setting transferring mode not successfully taken. I can see in server log it is printed as "504 Unknown MODE type".
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25340510
type: AnswerComment

http://stackoverflow.com/a/25304997
has comment: http://stackoverflow.com/comment/39442928
accepted answer of: http://stackoverflow.com/q/25304707
type: Answer
answers question: http://stackoverflow.com/q/25304707
has body: You have to use proper layout managers: http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html Certain layout managers will use all the available space and size/lay out components inside them to fill the whole area. Examples for such layout managers are BorderLayout, GridLayout.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/52907250
comment on: http://stackoverflow.com/a/25363817
type: AnswerComment
score: 1
type: Comment
has text: check my response for a simpler solution

http://stackoverflow.com/a/25269506
upvote count: 1
type: Answer
has body: The lesson: Once again, not following naming conventions causes error. Next time I suggest you prefix your TextView with tv, seekbars with sb, buttons with b and etc. As of Oracle Docs: Subsequent characters may be letters, digits, dollar signs, or underscore characters. Conventions (and common sense) apply to this rule as well. When choosing a name for your variables, use full words instead of cryptic abbreviations. Doing so will make your code easier to read and understand. In many cases it will also make your code self-documenting; fields named cadence, speed, and gear, for example, are much more intuitive than abbreviated versions, such as s, c, and g. Also keep in mind that the name you choose must not be a keyword or reserved word. And finally, the problem itself: In Activity.java: seekBarDistance = (SeekBar) findViewById(R.id.seekBarDistanceValue); final TextView seekBarValue = (TextView) findViewById(R.id.seekBarDistanceValue); In layout.xml: &lt;TextView android:id="@+id/seekBarDistanceValue"
answers question: http://stackoverflow.com/q/25267057
score: 1
has comment: http://stackoverflow.com/comment/39387979
downvote count: 0

http://stackoverflow.com/comment/39499505
type: QuestionComment
comment on: http://stackoverflow.com/q/25335954
type: Comment
score: 0
has text: sorry. I will keep in mind about the rules.

http://stackoverflow.com/a/25367587
upvote count: 8
type: Answer
score: 8
has body: I ran into the same problem. I guess Android has not finished calculating the new layout when onLayoutChanges() is called, and a recalculation cannot be triggered from within the method. The solution is to use a Handler to post layout changes to the end of the UI thread. I am not really sure about requestLayout(), maybe replace it with another call of setLayoutParams(). It probably has the same effect. So implement your re-layout in a class implementing Runnable, instantiate a Handler in onCreate() and in onLayoutChanges() instantiate the Runnable class and post it to the Handler: public class HauptAktivitaet extends Activity implements OnLayoutChangeListener, OnClickListener{ // this class updates the layout private class LayoutUpdater implements Runnable { private final int width; private final int height; private LayoutUpdater(int width, int height) { this.width = width; this.height = height; } public void run() { mGridLayout_LayoutParams_Above.width = width; mGridLayout_LayoutParams_Above.height = height; mGridLayout_LayoutParams_Below.width = width; mGridLayout_LayoutParams_Below.height = height; // might be necessary or not: set layout parameters to trigger update mButtonAbove.setLayoutParams(mGridLayout_LayoutParams_Above); mButtonBelow.setLayoutParams(mGridLayout_LayoutParams_Below); } } /* snip */ // add handler running in UI thread private Handler uiHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // instantiate handler uiHandler = new Handler(); inline(); setContentView(mGridLayout); } /* snip */ @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { /* Width and height on this time are known */ int width = mGridLayout.getWidth(); int height = mGridLayout.getHeight(); // post layout update to the end of queue uiHandler.post(new LayoutUpdater(width, height / 2); } }
downvote count: 0
answers question: http://stackoverflow.com/q/25329934

http://stackoverflow.com/comment/39568933
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25374168
has text: @PM77-1 Seems to be in the wrong place then. I would not say that `personCount` is an attribute of a `Person`

http://stackoverflow.com/comment/39302936
score: 0
has text: I'm trying to display the key located at the i index
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25231154

http://stackoverflow.com/comment/109894180
type: AnswerComment
has text: @BrunoLowagie Can you suggest how could we restore back to original size of the content considering the 2 example solution being implemented initially with 80% shrinkage. I mean do we have to change any calculations to the shrink percentage and Offset values, if so please post that code too...
comment on: http://stackoverflow.com/a/25720438
score: 0
type: Comment

http://stackoverflow.com/q/25352081
score: 3
upvote count: 3
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/24809584
tagged with: java
has answer: http://stackoverflow.com/a/25354557
has comment: http://stackoverflow.com/comment/39533438
tagged with: cas
possible better answer: http://stackoverflow.com/a/25352239
favorite count: 0
linked to: http://stackoverflow.com/q/4217107
type: Question
has answer: http://stackoverflow.com/a/25352239
linked to: http://stackoverflow.com/q/9299133
has body: I have been given a p12 public/private key signed by a certain CA. I have a local tomcat server that I am doing development work on. I am new to security but I believe that need to get the CA public cert into my tomcats truststore. (I am trying to get x509 certs working with CAS) How do I get my tomcat (and JVM) to trust this CA? Is there a way to get the CA public cert out of a p12 and into my tomcat truststore? (I have also exported the cert from firefox to get a PEM file for the CA) I see a lot of posts for jsk to pem, but not the other way round. I just need the CA. (I think) :)
accepted answer: http://stackoverflow.com/a/25354557
tagged with: ssl
tagged with: x509certificate
tagged with: tomcat
has title: CA PEM file to jks tomcat truststore
type: AnsweredQuestion

http://stackoverflow.com/comment/39390050
has text: @SteveC The struts.jar is included in my WEB-INF/lib.
comment on: http://stackoverflow.com/q/25244221
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39388295
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25276638
has text: Clash of languages, i'm coming from JS background, @SotiriosDelimanolis to me you are wrong :) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in

http://stackoverflow.com/a/25346309
type: Answer
accepted answer of: http://stackoverflow.com/q/25346062
type: AcceptedAnswer
has body: Not sure why you would be reading and writing at the same time, and the spacing of how you are saving the data doesn't seem to lend itself well to being read from. I'd try saving the data as, for example HP=10 ATK=2 DEF=5 And then when you're reading the data: Scanner s = new Scanner(tagFile); while(s.hasNextLine()) { String info = s.nextLine(); if (info.startsWith("HP") { int hp = Integer.parseInt(info.substring(info.indexOf("=" + 1),info.length())); p.setHP(hp); } else if (...) //Etc... for all the other values } The other way to do it, without the if/else, is to always keep the data in a certain order (e.g. hp first, then atk, then def), in which case you don't have to check. But that will probably end up being confusing.
score: 0
answers question: http://stackoverflow.com/q/25346062

http://stackoverflow.com/a/40853731
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25231196
has body: An alternative to Apache commons (StringUtils) is Guava's Joiner. For example: List&lt;String&gt; words = new ArrayList&lt;&gt;(); words.add("word"); words.add("anotherWord"); String joinedWords = Joiner.on(",").join(words); This may also be useful if you're not able to use Java 8. See wiki: https://github.com/google/guava/wiki/StringsExplained
score: 1
downvote count: 0

http://stackoverflow.com/comment/39515454
type: QuestionComment
score: 0
has text: can you give an concrete example where the autocomplete drop down box is blank? What did you type? What do you expect to be in the drop down box?
comment on: http://stackoverflow.com/q/25344759
type: Comment

http://stackoverflow.com/comment/39506713
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25340110
type: QuestionComment
has text: You are passing an object Ìalgo<Integer> algo`- is this meant to be stored in this.algo? If not: what's its purpose?

http://stackoverflow.com/q/25250754
type: UnansweredQuestion
tagged with: java
has body: How can you prevent a JNA method-call from exceeding thresholds for CPU utilization, thread-counts, and memory limits? Background: I'm working on a safety critical application and one of the non-safety-critical features requires the use of a library written in C. The dlls have been given to me as a black-box and there's no chance that I'll get access to the source code beyond the java interface files. Is there a way to limit the CPU usage, thread-count, and memory used by the JNA code?
answer count: 2
has answer: http://stackoverflow.com/a/25251586
has title: Limit resource utilization of JNA calls without changing dll
downvote count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/28955575
favorite count: 0
tagged with: resources
type: Question
tagged with: safety-critical
tagged with: jna
tagged with: dll

http://stackoverflow.com/comment/39361495
score: 0
type: Comment
type: QuestionComment
has text: Give me overview to do this task.
comment on: http://stackoverflow.com/q/25259158

http://stackoverflow.com/comment/39534741
score: 0
comment on: http://stackoverflow.com/a/25349859
type: AnswerComment
has text: @MichielAriens How is `class A extends DBObject<MetaObject>` not a dependency? ;) Please provide actual code we can hack on, that will be more precise.
type: Comment

http://stackoverflow.com/comment/39534982
type: QuestionComment
comment on: http://stackoverflow.com/q/25356493
score: 0
type: Comment
has text: java.lang.NullPointerException

http://stackoverflow.com/q/25366651
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39553983
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question
has title: Update Java object with a Hashmap
has answer: http://stackoverflow.com/a/25366838
accepted answer: http://stackoverflow.com/a/25366838
has body: I have a model with some properties e.g. public class Example { long id; String a, b; int c, d; boolean e; } Now I want to create a method like this public void update(long id, Map&lt;String, Object&gt; properties) { .... } in this properties map I want to have sth like properties.put("a","Test"); properties.put("c", 8); I'm not exactly sure on how to achieve this. at the end I want to do sth like this: Example e = new Example(....); ..... e.update(5L,properties); can some1 point me to the correct path? I cant figure out a searchterm that doesnt lead me to the Properties or HashMap entries. thanks in advance
has comment: http://stackoverflow.com/comment/39554046
type: AnsweredQuestion

http://stackoverflow.com/q/25369416
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/25369494
score: 2
type: AnsweredQuestion
tagged with: abstract-class
answer count: 3
has answer: http://stackoverflow.com/a/25369444
possible better answer: http://stackoverflow.com/a/25369463
tagged with: java
downvote count: 0
has title: Java: new AbstractClass(){} What is this declaration called?
has answer: http://stackoverflow.com/a/25369494
has answer: http://stackoverflow.com/a/25369463
has body: In my application there is an abstract class which is used multiple time as follows: public class Myclass{ int amount; String name; public void printResultsFromDB(){ new MyabstractClass(name){ @Override String getDataFromDB(){ //some implementation } }; } } public abstract MyabstractClass{ String name; public MyabstractClass(String name){ this.name = name; } abstract String getDataFromDB(); void execute(){ //Some implementation } } I want to know what line number 5 in code called? I know we cannot instantiate an abstract class. Is this declaration called an anonymous class?

http://stackoverflow.com/comment/39585951
comment on: http://stackoverflow.com/q/25383322
has text: Which are those _"other values"_? Could you describe them?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25274775
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39419901
has comment: http://stackoverflow.com/comment/39396282
has comment: http://stackoverflow.com/comment/39386544
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39385713
tagged with: jsp
has comment: http://stackoverflow.com/comment/39385959
has comment: http://stackoverflow.com/comment/39394270
score: 0
has title: Eclipse Luna: Built in browser won't redirect from .jsp
has body: The code I'm using is in HTML: &lt;meta http-equiv="refresh" content="3;Page.jsp"&gt; I'm running this on a different PC than I developed it on, and as far as I'm aware the entire server/website project works when exported as a .war file from either PC, but it just doesn't work in Eclipse's built in browser. Any ideas on what the problem is?
tagged with: java
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/25316519
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25315729
score: 3
upvote count: 3
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25315729
has body: You'll need three things: // this should be like defined in your yarn-site.xml conf.set("yarn.resourcemanager.address", "yarn-manager.com:50001"); // framework is now "yarn", should be defined like this in mapred-site.xm conf.set("mapreduce.framework.name", "yarn"); // like defined in hdfs-site.xml conf.set("fs.default.name", "hdfs://namenode.com:9000"); Here is a more detailed explanation in the Hadoop 2.2.0 documentation.

http://stackoverflow.com/comment/39448913
type: QuestionComment
comment on: http://stackoverflow.com/q/25309388
has text: From [Joda](http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html) : "Firstly, it holds the datetime as milliseconds from the Java epoch of 1970-01-01T00:00:00Z" --> Could this be the reason? (You are asking for 1966)
score: 0
type: Comment

http://stackoverflow.com/comment/39492412
score: 1
type: Comment
type: QuestionComment
has text: Your `private int Salary` should really be lowercase "s", `salary`... http://www.oracle.com/technetwork/java/codeconventions-135099.html
comment on: http://stackoverflow.com/q/25332249

http://stackoverflow.com/q/25374356
tagged with: actionresult
has body: I'm really racking my head here with Struts2 - I'm able to access the JSP pages by omitting part of the path. Note the path suppose to include pages/welcome_user.jsp. The key is to look at the word pages in the path. here's the struts.xml file: <?xml version="1.0" encoding="UTF-8" ?> pages/login.jsp pages/welcome_user.jsp I'm able to access login.jsp via: http://localhost/Struts2Example/User/Login and welcome_user.jsp via: http://localhost/Struts2Example/User/Welcome Note that in both URL, I'm able to drop pages, why? source: http://www.mkyong.com/misc/how-to-use-mkyong-tutorial/ Can someone go through the above tutorial and tell me what's wrong?
downvote count: 0
answer count: 1
tagged with: xml-configuration
favorite count: 0
tagged with: struts2
has comment: http://stackoverflow.com/comment/39576992
score: 2
type: AnsweredQuestion
tagged with: struts2-namespace
has title: Struts2 URL unreachable
tagged with: java
accepted answer: http://stackoverflow.com/a/25379797
has answer: http://stackoverflow.com/a/25379797
has comment: http://stackoverflow.com/comment/39584628
type: Question
upvote count: 2

http://stackoverflow.com/q/25316641
has answer: http://stackoverflow.com/a/25316974
favorite count: 0
has title: How do you override @JsonSerialize() on an object you don't have the source for?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25317191
type: Question
has comment: http://stackoverflow.com/comment/39462645
has answer: http://stackoverflow.com/a/25317191
answer count: 2
possible better answer: http://stackoverflow.com/a/25316974
downvote count: 0
has body: I have a class that is in a .jar that I can't modify. It has an @JsonSerialize() annotation on the class. @JsonSerialize(using = SomeClassSerializer.class) @JsonDeserialize(using = SomceClassDeserializer.class) public class SomeClass { /* ommitted */ } Now I need to run a custom serializer on this class to output completely different JSON. Here is what I have tried: final SomeClass sc = new SomeClass(); // setup ommitted final ObjectMapper m = new ObjectMapper(); final SimpleModule module = new SimpleModule(); module.addSerializer(SomeClass.class, new CustomClassSerializer()); m.registerModule(module); m.enable(SerializationFeature.INDENT_OUTPUT); m.writer().writeValue(System.out, sc); The problem is I get the default annotated SomeClassSerializer output and not the CustomClassSerializer output. How to I tell the ObjectMapper to ignore the annotations?
upvote count: 1
score: 1
tagged with: jackson

android-notifications
type: Tag
tags question: http://stackoverflow.com/q/25373200
tag name: android-notifications

http://stackoverflow.com/q/25341640
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25341784
has title: AlarmManager sets alarm twice instead of updating current one
has body: am setting an alarm at midnight and sometimes I set alarm again with the same id so why does alarm manager create another alarm instead of updating the present. I end up with 2 alarms instead 1. how can I change that so if this code executes while a current alarm is present it will update it instead creating a duplicate Intent intent = new Intent(con,MyReceiver.class); intent.setAction("ACTIVATE_MIDNIGHT_SERVICE"); PendingIntent pendingIntent = PendingIntent.getBroadcast( con, -1, intent, PendingIntent.FLAG_CANCEL_CURRENT); Date d = new Date(); d.setDate(d.getDate()+1); d.setHours(0); d.setMinutes(0); d.setSeconds(0); alarm.setRepeating(AlarmManager.RTC_WAKEUP, d.getTime(),AlarmManager.INTERVAL_DAY, pendingIntent);
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/46178885
favorite count: 0

http://stackoverflow.com/comment/39533612
has text: Relook at setHourlyRate
type: Comment
type: QuestionComment
score: 9
comment on: http://stackoverflow.com/q/25355711

http://stackoverflow.com/comment/39473343
score: 0
type: AnswerComment
has text: @predicador37 to question one: since we're doing design here (which should be independend of the programming language and use general OO paragigms) interfaces may contain properties at this level. If you're language doesn't support attributes in interfaces, then you need a work around. Either you define getters and setters in your interface, or you use an abstract class instead of an interface. I'm not sure about the exact semantic of your attributes, but they look like implementation details to me, which should not be part of an interface.
comment on: http://stackoverflow.com/a/25314438
type: Comment

http://stackoverflow.com/a/50257520
score: 11
has comment: http://stackoverflow.com/comment/117246636
type: Answer
answers question: http://stackoverflow.com/q/25264358
has body: Here is another way. Copied from here. In this example, a new custom TokenGranter, named CustomTokenGranter, is added to a CompositeTokenGranter with the default TokenGranters. I like this example because it uses the AuthorizationServerEndpointsConfigurer's public method getTokenGranter() to retrieve the default TokenGranter's. @Configuration @EnableAuthorizationServer protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter { @Autowired private AuthenticationManager authenticationManager; @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.authenticationManager(authenticationManager); endpoints.tokenGranter(tokenGranter(endpoints)); } private TokenGranter tokenGranter(final AuthorizationServerEndpointsConfigurer endpoints) { List&lt;TokenGranter&gt; granters = new ArrayList&lt;TokenGranter&gt;(Arrays.asList(endpoints.getTokenGranter())); granters.add(new CustomTokenGranter(endpoints.getTokenServices(), endpoints.getClientDetailsService(), endpoints.getOAuth2RequestFactory(), "custom")); return new CompositeTokenGranter(granters); }
has comment: http://stackoverflow.com/comment/117269314
upvote count: 11
has comment: http://stackoverflow.com/comment/117229936
has comment: http://stackoverflow.com/comment/117274925
downvote count: 0

http://stackoverflow.com/q/25322347
has comment: http://stackoverflow.com/comment/47855854
has answer: http://stackoverflow.com/a/25322374
tagged with: eclipse
has answer: http://stackoverflow.com/a/25322612
has body: I was trying to test how forName() works, but I'm getting ClassNotFoundException for some reason. Here's my code: package practicePackage; import java.lang.Class; public class mainClass { public static void main(String[] args) { // TODO Auto-generated method stub try { Class testSar = Class.forName("practicePackage.Animal"); testSar.eat(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Here's the complete view of my package What am I doing wrong? EDIT: Here's my Animal.java file: package practicePackage; public class Animal { int hunger; char[] food; int[] pos; int[] boundary; public Animal() { System.out.println("Animal Constructed.."); } public void makeNoise() { System.out.println("Animal noise.."); } public void eat() { System.out.println("Animal eat.."); } public void sleep() { System.out.println("Animal sleep.."); } public void roam() { System.out.println("Animal roam.."); } }
type: Question
has comment: http://stackoverflow.com/comment/39473198
possible better answer: http://stackoverflow.com/a/25322369
has comment: http://stackoverflow.com/comment/39473272
has comment: http://stackoverflow.com/comment/39473341
accepted answer: http://stackoverflow.com/a/25322599
has comment: http://stackoverflow.com/comment/39473332
tagged with: android
has answer: http://stackoverflow.com/a/25322369
has answer: http://stackoverflow.com/a/25322599
answer count: 4
type: AnsweredQuestion
score: 0
tagged with: reflection
has title: Android - forName() method ClassNotFoundException
tagged with: java

http://stackoverflow.com/comment/39472622
type: AnswerComment
has text: True - had failed to spot that we'd just increment as normal. Multiplication would be okay for a single element array :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25321954

http://stackoverflow.com/a/25278262
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25269383
score: 2
answers question: http://stackoverflow.com/q/25269383
type: Answer
has body: It does delete the texture data. The memory might not be freed immediately when you make the call, but it will get freed eventually. Or at least made available for reuse by other allocations. The details of memory management are highly platform and driver specific. But as a user of the OpenGL API, you can consider the memory freed after the glDeleteTextures() call. The reason why the memory might not be freed immediately is that OpenGL operates asynchronously. In a typical call sequence like this: glBindTexture(GL_TEXTURE_2D, texId); glDrawArrays(...); glDeleteTextures(1, &amp;texId); The draw call is most likely still queued up for execution by the GPU when the glDeleteTextures() call is made. Since the draw call uses the texture data, it cannot be deleted immediately. The memory can only be freed after the GPU finished executing the draw call. There are a couple of exceptions where the texture will actually not be freed after glDeleteTextures() is called on it. They are not very common scenarios, but should be mentioned for completeness: If the texture is attached to an FBO, and that FBO is not currently bound, the texture reference of the FBO will keep the texture alive until either the texture is detached from the FBO, or the FBO is deleted. Note that for a currently bound FBO, the texture will automatically be detached when it is deleted. If resources are shared between multiple contexts, things also get more complicated. It's best to consult the specs about the exact behavior in this case.
upvote count: 2

http://stackoverflow.com/comment/39422274
type: QuestionComment
type: Comment
score: 0
has text: possible duplicate of http://stackoverflow.com/questions/19831660/smartgwt-select-all-functionality
comment on: http://stackoverflow.com/q/25284410

http://stackoverflow.com/comment/39534600
has text: This is exactly what he was trying to avoid?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25356239

http://stackoverflow.com/q/25356302
has comment: http://stackoverflow.com/comment/40211397
type: Question
has comment: http://stackoverflow.com/comment/40242924
has comment: http://stackoverflow.com/comment/40243472
has body: I am using following code to shrink every pages (Top and bottom) of existing pdf using iText library. Code working fine. But now if i process result pdf, i get 0 value for rotation of every page, while old pdf has other rotation too(i.e. 90deg). I want to keep rotation as it is but unable to do it. Code i am using As below to shrink pages public void shrinkPDFPages() throws Exception { PdfReader reader = new PdfReader("D:/testpdfs/test.pdf"); Document doc = new Document(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream( "D://testpdfs/result.pdf")); doc.open(); PdfContentByte cb = writer.getDirectContent(); for (int i = 1; i &lt;= reader.getNumberOfPages(); i++) { PdfImportedPage page = writer.getImportedPage(reader, i); float pageHeight = reader.getPageSizeWithRotation(i).getHeight(); float pageWidth = reader.getPageSizeWithRotation(i).getWidth(); int rotation = reader.getPageRotation(i); Rectangle pageRectangle = reader.getPageSizeWithRotation(i); Rectangle PageRect = null; System.out.println(rotation); switch (rotation) { case 0: PageRect = new Rectangle(pageRectangle.getWidth(), pageRectangle .getHeight()); doc.setPageSize(PageRect); doc.newPage(); AffineTransform af = new AffineTransform(); af.scale(1, 0.84f); af.translate(1, 50); cb.addTemplate(page, af); break; case 90: PageRect = new Rectangle(pageRectangle.getWidth(), pageRectangle .getHeight()); doc.setPageSize(PageRect); doc.newPage(); cb.addTemplate(page, 0, -1f, 0.84f, 0, 50, pageHeight); break; case 270: PageRect = new Rectangle(pageRectangle.getWidth(), pageRectangle .getHeight()); doc.setPageSize(PageRect); doc.newPage(); cb.addTemplate(page, 0, 1f, -0.84f, 0, pageWidth - 50, 0); break; case 180: PageRect = new Rectangle(pageRectangle.getWidth(), pageRectangle .getHeight()); doc.setPageSize(PageRect); doc.newPage(); cb.addTemplate(page, -1f, 0, 0, -0.84f, pageWidth, pageHeight - 50); break; default: break; } } doc.close(); } What should i do? so rotation remains as it is. One more …
has comment: http://stackoverflow.com/comment/40250169
has comment: http://stackoverflow.com/comment/40248259
has comment: http://stackoverflow.com/comment/39536653
has answer: http://stackoverflow.com/a/25720438
tagged with: itextpdf
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39536113
has comment: http://stackoverflow.com/comment/39536602
has title: Shrink PDF pages with rotation using Rectangle in existing PDF
has comment: http://stackoverflow.com/comment/40245775
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25720438
answer count: 1
tagged with: itext
downvote count: 1
has comment: http://stackoverflow.com/comment/40241437
has comment: http://stackoverflow.com/comment/39536473
favorite count: 0

http://stackoverflow.com/comment/39490665
has text: @Raghunandan Yes me too think so. He must have copy pasted the onCreate() method and forgot to change the layout.
comment on: http://stackoverflow.com/q/25331379
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39530586
comment on: http://stackoverflow.com/a/25353990
type: AnswerComment
has text: I haven't found any options to disable Grep Console, only options to modify the colors of the matches and colors of the grep view. I've uninstalled Grep Console but I still don't get full stack traces. Is there some XML or ini file I can edit to get stack traces back or do I have to reinstall eclipse?
score: 1
type: Comment

http://stackoverflow.com/a/25362213
type: Answer
answers question: http://stackoverflow.com/q/25362078
score: 0
has body: Try Below Xml File Use Relative layout Or One MAin LinearLayout with Vertical Orientation and in sub take Horizontal as you required. <TextView android:id="@+id/mynumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Number +961" android:textSize="20sp" android:color="@android:color/white" /> <EditText android:id="@+id/editTextNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="Number" android:textColor="#FFFFFF" />

http://stackoverflow.com/a/25317447
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25307171
has body: Using the condition queue for this purpose seems like an excellent idea, especially for waiting on a condition to become true or false. However, I suggest that you use the Condition libraries from Lock#newCondition(). Here is an example off the top of my head: public class Waiter { // Happens-before is strong enough to make sure the view // of running is visible to other threads // Even if the lock is not held, writes to a boolean // is atomic and non-compound, therefore, no synchronization // is needed because threads cannot be interleaved private boolean running = false; private final ReentrantLock taskLock = new ReentrantLock(); private final Condition condition = this.taskLock.newCondition(); public void check() throws InterruptedException { if (!this.taskLock.isLocked()) return; while (this.running) this.condition.await(); } public void run() { this.taskLock.lock(); this.running = true; } public void done() { // Wait for the while loop to finish, // Release the threads held in the queue, // then the lock can be released try { this.running = false; this.condition.signalAll(); } finally { this.taskLock.unlock(); } } } Sample usage: public static final Waiter WAITER = new Waiter(); // First task WAITER.run(); try { // ... } finally { WAITER.done(); } // Second task try { WAITER.check(); } catch (InterruptedException x) { Thread.currentThread().interrupt(); x.printStackTrace(); } // ...

http://stackoverflow.com/a/27619227
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25325801
type: Answer
has body: I'm not sure how relevant this is to your specific case, but the problem may be AutoBeans. RequestFactory makes extensive use of AutoBeans. I have recently been able to solve a performance problem in a GWT application by reducing the use of AutoBeans, which seem to be very slow. The use of a hierarchical perfomance profiler such as the one in IE's F12 tools identified the Autobean code as the root of the problem, so the performance problem was client-side. IIRC the solution was to copy the AutoBeans to "real" Java objects after completion of the call.

http://stackoverflow.com/comment/39399774
comment on: http://stackoverflow.com/a/25282952
type: Comment
type: AnswerComment
has text: Okay, I have added where I check my intent at the end of my question.
score: 0

http://stackoverflow.com/comment/39784861
score: 0
comment on: http://stackoverflow.com/a/25478590
has text: In that case I should create a class with singleton to have a unique instance and just call to send2ZMQ...
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25337628
has comment: http://stackoverflow.com/comment/64094455
has comment: http://stackoverflow.com/comment/71474180
answers question: http://stackoverflow.com/q/25333711
has comment: http://stackoverflow.com/comment/63215244
type: Answer
score: 145
upvote count: 145
has comment: http://stackoverflow.com/comment/71473277
has comment: http://stackoverflow.com/comment/71474122
has comment: http://stackoverflow.com/comment/71472427
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25333711
has body: This annotation must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar. It may only be specified for fields or properties of these types. The Temporal annotation may be used in conjunction with the Basic annotation, the Id annotation, or the ElementCollection annotation (when the element collection value is of such a temporal type. In plain Java APIs, the temporal precision of time is not defined. When dealing with temporal data, you might want to describe the expected precision in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (i.e., the actual date, only the time, or both). Use the @Temporal annotation to fine tune that. The temporal data is the data related to time. For example, in a content management system, the creation-date and last-updated date of an article are temporal data. In some cases, temporal data needs precision and you want to store precise date/time or both (TIMESTAMP) in database table. The temporal precision is not specified in core Java APIs. @Temporal is a JPA annotation that converts back and forth between timestamp and java.util.Date. It also converts time-stamp into time. For example, in the snippet below, @Temporal(TemporalType.DATE) drops the time value and only preserves the date. @Temporal(TemporalType.DATE) private java.util.Date creationDate; As per javadocs, Annotation to declare an appropriate {@code TemporalType} on query method parameters. Note that this annotation can only be used on parameters of type {@link Date} with default TemporalType.DATE [Information above collected from various sources]
has comment: http://stackoverflow.com/comment/89498934

http://stackoverflow.com/a/25331764
accepted answer of: http://stackoverflow.com/q/25331727
downvote count: 0
has comment: http://stackoverflow.com/comment/39491416
has body: Yes. One option is to save the user locale preference in a shared database. Another is to manually send a browser cookie.
score: 3
has comment: http://stackoverflow.com/comment/39491357
type: Answer
answers question: http://stackoverflow.com/q/25331727
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/25325127
has title: Splitting a height-map into quadrants
tagged with: quadtree
accepted answer: http://stackoverflow.com/a/25326448
upvote count: 2
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/25326448
downvote count: 1
favorite count: 0
tagged with: heightmap
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/2512082
tagged with: java
has body: I am rendering terrain using a quad-tree system. I need to split a height-map into four sections using the method splitHeightmap(float[] originalMap, int quadrant) with the quadrant being a number from 0-3. The map needs to be split into quarters so if 0 is passed as the quadrant, the bottom left quarter of the array is returned as a new float array. I have a little base code, but I'm not sure how to actually sample the map depending on the desired quadrant: protected float[] splitHeightMap(float[] heightMap, TerrainQuadrant quadrant) { float[] newHeightMap = new float[size &gt;&gt; 1]; int newSize = size &gt;&gt; 1; for (int i = 0; i &lt; newSize; i++) for (int j = 0; j &lt; newSize; j++) newHeightMap[i * newSize + j] = sampleHeightAt(heightMap, i, j); return newHeightMap; } protected float sampleHeightAt(float[] heightMap, int x, int z) { return heightMap[z + x * size]; } Edit: I have written what I think should work, but am getting a ArrayIndexOutOfBoundsException for index 65792 (with a original heightmap of 512x512): protected float[] splitHeightMap(float[] heightMap, TerrainQuadrant quadrant) { float[] newHeightMap = new float[(size &gt;&gt; 1) * (size &gt;&gt; 1)]; int newSize = size &gt;&gt; 1; int xOffset = 0, zOffset = 0; int xCount = 0, yCount = 0; switch (quadrant) { case BottomRight: xOffset = newSize; break; case TopLeft: zOffset = newSize; break; case TopRight: xOffset = newSize; zOffset = newSize; break; default: break; } for (int x = xOffset; x &lt; xOffset + newSize; x++) for (int z = zOffset; z &lt; zOffset + newSize; z++) { newHeightMap[xCount + yCount * newSize] = heightMap[z + x * size]; // should this be 'z + x * size' or 'x + z * size'? xCount++; yCount++; } return newHeightMap; }
type: Question

http://stackoverflow.com/q/25337676
tagged with: jlabel
tagged with: event-dispatch-thread
answer count: 2
upvote count: 2
tagged with: swing
tagged with: ping
possible better answer: http://stackoverflow.com/a/25337741
has comment: http://stackoverflow.com/comment/39502327
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25338142
has answer: http://stackoverflow.com/a/25337741
has body: I'm writing a program that constantly pings a server. I wrote the code to check it once and put the ping in a JLabel and put it in a method called setPing(). Here is my code private void formWindowOpened(java.awt.event.WindowEvent evt) { setPing(); } That worked but only did it once, so I did: private void formWindowOpened(java.awt.event.WindowEvent evt) { for(;;){ setPing(); } } But this doesn't even work for the first time. I didnt put the setPing method because it was too long so here it is: public String setPing(){ Runtime runtime = Runtime.getRuntime(); try{ Process process = runtime.exec("ping lol.garena.com"); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { int i = 0; i = line.indexOf("Average"); if(i &gt; 0){ String finalPing = ""; line.toCharArray(); try { finalPing = ""; for(int x = i; x &lt; i + 17; x++) { finalPing = finalPing + (line.charAt(x)); } }catch(IndexOutOfBoundsException e) { try { finalPing = ""; for(int x = i; x &lt; i + 16; x++) { finalPing = finalPing + (line.charAt(x)); } }catch(IndexOutOfBoundsException f) { try { finalPing = ""; for(int x = i; x &lt; i + 15; x++) { finalPing = finalPing + (line.charAt(x)); } }catch(IndexOutOfBoundsException g){} } } String final1Ping = finalPing.replaceAll("[^0-9]", ""); return final1Ping; } } }catch(IOException e){ } return ""; } UPDATE Just in case this is important, Im using netbeans. I created a form and put this code in the formWindowOpened evt instead of calling it in main: private void formWindowOpened(java.awt.event.WindowEvent evt) { ActionListener timerListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new PingWorker().execute(); } }; Timer timer = new Timer(1000, timerListener); timer.start(); jLabel1.setText(label.getText()); timer.stop(); // TODO add your handling code here: } class PingWorker extends SwingWorke…
tagged with: java
has answer: http://stackoverflow.com/a/25338142
has title: Update JLabel repeatedly with results of long running task
score: 1
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39600701
comment on: http://stackoverflow.com/q/25347187
has text: So you could just have a flag that indicates whether the timer is running. Set it and clear it when the timer starts and stops. And in your `MouseListener`, check whether the flag is set before doing any processing. Or have I misunderstood your problem?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25365930
has comment: http://stackoverflow.com/comment/39555986
has comment: http://stackoverflow.com/comment/39555863
has title: JSON Parsing Error - Unable to update core database values
has comment: http://stackoverflow.com/comment/39555774
has comment: http://stackoverflow.com/comment/39554992
has body: I am using JAX-RS over AngularJS, but I have hit a stumbling block due to json parsing errors. Using jsonlint I can see the issues, but as I cannot update the underlying database values which are causing the issue to correct the characters (corporate data warehouse)...I am now in trouble as I can't return any data at all into the application because just a small handful of records have non compliant characters in them. What is the general approach for dealing with these kind of issues? Is it to search and replace for non ascii- characters at the java end in the setter? Update: Error from Chrome: SyntaxError: Unexpected token at Object.parse (native) at ub (http://localhost:8080/misf-web/lib/angular/angular.min.js:13:122) at e.defaults.transformResponse (http://localhost:8080/misf-web/lib/angular/angular.min.js:98:83) at http://localhost:8080/misf-web/lib/angular/angular.min.js:97:347 at Array.forEach (native) at n (http://localhost:8080/misf-web/lib/angular/angular.min.js:6:470) at Yb (http://localhost:8080/misf-web/lib/angular/angular.min.js:97:329) at c (http://localhost:8080/misf-web/lib/angular/angular.min.js:99:14) at i (http://localhost:8080/misf-web/lib/angular/angular.min.js:79:437) at http://localhost:8080/misf-web/lib/angular/angular.min.js:80:485 angular.min.js:63 (anonymous function) Sample JSON output - just one example which is causing me issues...it is not always "umlauts"... { "approvedPriority": "Approved", "disease": "primary Sj�grens Syndrome", "diseaseArea": "Inflammation", "projectType": "NME", "therapyArea": "RI" } In the database this disease appears as "primary Sjögren’s Syndrome" jsonlint reports: Parse error on line 3: ...ed", "disease": "primary Sj�grens S ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' It is not always "umlauts" causing me issues, sometimes it is a non printable charachter it seems, and one odd error I hunted down due to what appears to be a slightly wider hyphen than normal. Update…
accepted answer: http://stackoverflow.com/a/25511102
answer count: 1
has comment: http://stackoverflow.com/comment/39556510
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/39558228
has comment: http://stackoverflow.com/comment/39565301
has comment: http://stackoverflow.com/comment/39556167
has comment: http://stackoverflow.com/comment/39555942
type: Question
has comment: http://stackoverflow.com/comment/39560965
has comment: http://stackoverflow.com/comment/39556793
has comment: http://stackoverflow.com/comment/39555643
type: AnsweredQuestion
score: 0
tagged with: angularjs
has comment: http://stackoverflow.com/comment/39558267
has comment: http://stackoverflow.com/comment/39560737
has answer: http://stackoverflow.com/a/25511102
has comment: http://stackoverflow.com/comment/39555697
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39556452
has comment: http://stackoverflow.com/comment/39645342

http://stackoverflow.com/comment/39378899
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25271352
has text: Fair point, I'm going to shorten it.
type: Comment

http://stackoverflow.com/q/25361919
tagged with: jackson
upvote count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25362883
answer count: 2
possible better answer: http://stackoverflow.com/a/25363617
has answer: http://stackoverflow.com/a/25362883
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
favorite count: 0
type: Question
score: 3
has title: Jackson Deserialization: How to map specific properties to getters and setters as well as loading all the properties into map of a same POJO?
has answer: http://stackoverflow.com/a/25363617
has body: I need to deserialize JSON string into POJO class with following scenario: Some basic JSON properties should be mapped to the getters and setters fields in POJO class. And again all JSON properties should be loaded into the Map filed of the same POJO class. For example I have the following JSON String: "entry":[ { "id": "1", "name": "Type", "type": "General", "updated": "Tue, 12 Aug 2014 05:24:01.397Z", "summary": { "lang": "en", "value": "Testing for content" } }, { "id": "1", "name": "Type", "type": "General", "updated": "Tue, 12 Aug 2014 05:24:01.397Z", "summary": { "lang": "en", "value": "Testing for content" } } ] Now I need to deserialize the above JSON String into following POJO class: public class EntryType { private String id; private String name; private String type; private String updated; private Map&lt;String,Object&gt; allJsonProperties; 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 getType() { return type; } public void setType(String type) { this.type = type; } public String getUpdated() { return updated; } public void setUpdated(String updated) { this.updated = updated; } public Map&lt;String, Object&gt; getAllJsonProperties() { return allJsonProperties; } public void setAllJsonProperties(Map&lt;String, Object&gt; allJsonProperties) { this.allJsonProperties = allJsonProperties; } } I am able to map id,name,type,updated to the appropriate POJO class fields. But I don not know how to load id,name,type,updated,summary properties again into Map(allJsonProperties) field. Can any one guide me how to work out this?. Note: I use Jackson API version 2.2.2

http://stackoverflow.com/q/25350514
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39524324
has comment: http://stackoverflow.com/comment/39524323
downvote count: 5
has comment: http://stackoverflow.com/comment/39524343
has comment: http://stackoverflow.com/comment/39524744
has title: Change characters in Java
score: -5
has comment: http://stackoverflow.com/comment/39524434
upvote count: 0
tagged with: java
tagged with: uppercase
answer count: 1
has body: I have a question that is related to changing character in Java For instance : this is my string value Sue sells sea shellS on the seashore! How to change the capital letter of "S" to small letter and change the small letter of "s" to capital letter. this only change the letter "s" and "S" to uppercase and lowercase not other letter. I've tried this: String phrase= new String("Sue sells sea shells on the seashore!"); String r= ""; for(int z=0; z&lt;phrase.length();++z) { Character c = phrase.charAt(z); if(Character.isLowerCase(c)) r += Character.toUpperCase(c); else if(Character.isUpperCase(c)) r += Character.toLowerCase(c); else r += c; } System.out.println(r); but the problem is the code changes whole characters not only change letter "s" and "S". so, how to change it?
tagged with: lowercase
has answer: http://stackoverflow.com/a/25350681
tagged with: loops
tagged with: string
has comment: http://stackoverflow.com/comment/39524426
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39524610
has comment: http://stackoverflow.com/comment/39524630

http://stackoverflow.com/comment/39568682
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25374037
has text: Read my code again please. I change the first and the second `manages(P0,MT0)`. What do you want the output to be?

http://stackoverflow.com/q/25238110
score: 9
has answer: http://stackoverflow.com/a/48821002
has body: This is the code I'm running: import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; public class Main { public static void main(String[] args) throws Exception { String filePath = "D:/temp/file"; RandomAccessFile file = new RandomAccessFile(filePath, "rw"); try { MappedByteBuffer buffer = file.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, 128); // Do something buffer.putInt(4); } finally { file.close(); System.out.println("File closed"); } System.out.println("Press any key..."); System.in.read(); System.out.println("Finished"); } } Before pressing a key, I'm trying to delete the file manually in FAR Manager. But FAR says that the file is locked: The process cannot access the file because it is being used by another process. Cannot delete the file D:\temp\file Object is being opened in: Java(TM) Platform SE binary (PID: 5768, C:\Program Files\Java\jdk1.8.0_05\bin\javaw.exe) Only after pressing a key, the application terminates and I can delete the file. What is wrong with my code?
upvote count: 9
answer count: 5
tagged with: windows
tagged with: java
has answer: http://stackoverflow.com/a/70163286
has answer: http://stackoverflow.com/a/78929757
possible better answer: http://stackoverflow.com/a/48821002
has comment: http://stackoverflow.com/comment/127955914
has comment: http://stackoverflow.com/comment/139336384
has title: How to properly close MappedByteBuffer?
tagged with: java-9
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137383619
accepted answer: http://stackoverflow.com/a/25239834
has comment: http://stackoverflow.com/comment/39318433
has answer: http://stackoverflow.com/a/72432691
downvote count: 0
tagged with: mappedbytebuffer
has answer: http://stackoverflow.com/a/25239834
has comment: http://stackoverflow.com/comment/39316824
has comment: http://stackoverflow.com/comment/139334440
tagged with: randomaccessfile
favorite count: 0
type: Question

http://stackoverflow.com/comment/39497207
comment on: http://stackoverflow.com/a/25333893
type: Comment
has text: Yes, I did that, just realised I forgot to 'reload' then 'update'. It works now.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25326407
has answer: http://stackoverflow.com/a/25326581
accepted answer: http://stackoverflow.com/a/25326581
tagged with: japplet
tagged with: java
tagged with: html5-canvas
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/39632448
has title: Need assistance on HTML5 japplet or canvas
has body: So basically I am building a GUI type interface for my website that needs to have multiple requirements. Image to interact with i.e draw straight lines on it, curved lines, circles etc (different color lines too) The image will need to have the option to "save" the current state and access it later The image will have different objects on it that will have different "states" i.e active or not active etc. What is the best way to accomplish this? I have looked into GUI builder and Canvas for HTML5 but have not found a solid guide to satisfy my needs. Any further assistance will be much appreciated!
type: Question
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39614151
type: Comment
has text: Is someone knows the right way to do this. Please Help me.
type: QuestionComment
comment on: http://stackoverflow.com/q/25364756
score: 0

http://stackoverflow.com/q/25253418
has title: Java : Extract numbers from a string
has answer: http://stackoverflow.com/a/25253686
has comment: http://stackoverflow.com/comment/39345805
has answer: http://stackoverflow.com/a/25253476
has answer: http://stackoverflow.com/a/25253498
score: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25253474
upvote count: 1
tagged with: string
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39346023
has answer: http://stackoverflow.com/a/25253508
accepted answer: http://stackoverflow.com/a/25253508
possible better answer: http://stackoverflow.com/a/25253476
tagged with: java
has body: I was trying to extract my data from a string by using regular expression. My data looks like: 12 170 0.11918 170 12 0.11918 12 182 0.06361 182 12 0.06361 12 198 0.05807 198 12 0.05807 12 242 0.08457 242 12 0.08457 11 30 0.08689 30 11 0.08689 The problems here are the different number of whitespace between two numbers. All in all i want to extract from each line two Integers and one Double. Therefore i tried to use regular expressions. Pattern p = Pattern.compile("(([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+))"); Matcher m = p.matcher(" 6 7781 0.01684000"); while (m.find()) { System.out.println(m.group(0)); } I now my regular expression doesn't work. Has anyone some help for a suitable regular expression therefore i can work with the data or any other help for me?
answer count: 6
tagged with: regex
has answer: http://stackoverflow.com/a/25253588
type: AnsweredQuestion

http://stackoverflow.com/a/25282855
upvote count: 10
score: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/25282833
has body: you will have to add this to your build.gradle ( into the android section ) compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39399428
has comment: http://stackoverflow.com/comment/39399674
answers question: http://stackoverflow.com/q/25282833
has comment: http://stackoverflow.com/comment/39399279

http://stackoverflow.com/comment/39582565
score: 0
type: AnswerComment
has text: As the exception message says, you are running the snippet despite a compile error. Replace "local/path/to/repo" with a File that points to the directory where the cloned repository should go - same as you did in the snippet from the question.
type: Comment
comment on: http://stackoverflow.com/a/25316716

http://stackoverflow.com/a/25319291
has body: It's called "Shadowing". See tutorial: http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
answers question: http://stackoverflow.com/q/25319116
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/39467733
has comment: http://stackoverflow.com/comment/39467559
type: Answer
score: -1

http://stackoverflow.com/a/25323093
answers question: http://stackoverflow.com/q/25322955
has body: The following code will help you Calendar cal = Calendar.getInstance(); Date date=timestampFormat.parse(tempEXPDATE); cal.setTime(date); cal.add(Calendar.DATE, 1); String newDate=timestampFormat.format(date); Note that I have picked timestampFormat and tempEXPDATE from your code.
upvote count: 1
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25322955
has comment: http://stackoverflow.com/comment/39474652
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39435574
score: 0
comment on: http://stackoverflow.com/a/25301559
type: AnswerComment
has text: Check if you have specified the correct port, default port is 27017. If DB is password protected then you need to key in the user credentials as well.
type: Comment

http://stackoverflow.com/q/25334004
has title: Why is the protected method not visible?
has comment: http://stackoverflow.com/comment/48905830
score: 4
answer count: 4
has comment: http://stackoverflow.com/comment/39495829
upvote count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/215497
has comment: http://stackoverflow.com/comment/39495877
tagged with: java
has answer: http://stackoverflow.com/a/25334039
downvote count: 0
has answer: http://stackoverflow.com/a/25334030
accepted answer: http://stackoverflow.com/a/25334030
has body: Java experts, I would sincerely appreciate any insights! I have an abstract class in a package with a protected method. I also have a subclass of this class in the same package. Now, when I try to instantiate the subclass from a class outside the package, and invoke the protected method on the subclass' instance, Eclipse is complaining the protected method is not visible. I thought, protected methods will be visible to all children - in or out of the package - as long as the class visibility does not restrict it - in this case, both the parent and the child class are public. What am I missing? Thanks in advance! package X; public abstract class Transformation { protected OutputSet genOutputSet (List list) { .. } } package X; public class LookupTransformation extends Transformation { } package Y; import X.*; public class Test { public static void main(String[] args) { List&lt;field&gt; fld_list = new ArrayList(); .. LookupTransformation lkpCDC = new LookupTransformation(); OutputSet o = lkpCDC.genOutputSet(fld_list); // Eclipse errors out here saying genOutputSet from the Type Transformation is not visible. WWWWWWWWHHHHHAAAATTTTTT???? } }
has answer: http://stackoverflow.com/a/25334048
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25334032
possible better answer: http://stackoverflow.com/a/25334032

http://stackoverflow.com/a/25249942
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25249889
has comment: http://stackoverflow.com/comment/39339073
has comment: http://stackoverflow.com/comment/39338927
has body: Use DateFormat to parse the value: long l=20140811; DateFormat df = new SimpleDateFormat("yyyyMMdd"); df.parse(String.valueOf(l));
type: Answer
answers question: http://stackoverflow.com/q/25249889
has comment: http://stackoverflow.com/comment/39339298
score: 2
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39339134

http://stackoverflow.com/a/25388396
has body: use the keyPressed listener for each textfield to run your check wherever the text of a textfield is changed. the method to disable the buttons is setEnabled(false); Note that you will have to make the buttons dissabled when the program starts if your textfiends are empty at that time (listeners won't run)
type: Answer
answers question: http://stackoverflow.com/q/25387983
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39596432

http://stackoverflow.com/comment/39397609
score: 0
comment on: http://stackoverflow.com/q/25281976
type: Comment
has text: see http://www.javacodegeeks.com/2011/01/android-proximity-alerts-tutorial.html
type: QuestionComment

http://stackoverflow.com/q/25343674
type: AnsweredQuestion
has title: cannot find symbol class Currency (enum)
answer count: 2
has comment: http://stackoverflow.com/comment/39513296
upvote count: 2
has answer: http://stackoverflow.com/a/25344426
has comment: http://stackoverflow.com/comment/39512684
downvote count: 0
has body: I am using an enum class as following: public enum Currency { INR(100, '₹'), USD(100, '$'), EUR(100, '€' ); private final char currencySymbol; private final int subUnitsPerUnit; private Currency(int subUnitsPerUnit, char currencySymbol) { this.subUnitsPerUnit = subUnitsPerUnit; this.currencySymbol = currencySymbol; } public final char getCurrencySymbol() { return this.currencySymbol; } public final int getSubUnitsPerUnit() { return this.subUnitsPerUnit; } } and using following code in my fragment (in android) to use it: private Currency currency = Currency.INR; Both enum and fragment are in same package but when I run the app I keep getting the following error in Android Studio 0.8.6 Error:(44, 13) cannot find symbol class Currency Error:(44, 33) cannot find symbol variable Currency Can please somebody point me in right direction? Thanks.
possible better answer: http://stackoverflow.com/a/66952280
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39512786
tagged with: enums
has answer: http://stackoverflow.com/a/66952280
has comment: http://stackoverflow.com/comment/39512794
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39512644
has comment: http://stackoverflow.com/comment/39512933
has comment: http://stackoverflow.com/comment/39512872
tagged with: android-studio
score: 2
accepted answer: http://stackoverflow.com/a/25344426

http://stackoverflow.com/a/25320640
has body: Try File#mkdirs instead of File#mkdir. Embedded resources can't be accessed via a File reference. Instead you need to use Class#getResource or Class#getResourceAsStream
type: Answer
answers question: http://stackoverflow.com/q/25320474
has comment: http://stackoverflow.com/comment/39497263
has comment: http://stackoverflow.com/comment/39496636
accepted answer of: http://stackoverflow.com/q/25320474
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39502359
has comment: http://stackoverflow.com/comment/39495785

http://stackoverflow.com/a/25363135
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39547114
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25362990
has body: I am guessing you are looking for something like the following. public class ClsMessage { public String username = ""; public String password = ""; public String request = ""; public List&lt;Parameters&gt; parameters = new ArrayList&lt;Parameters&gt;(); public static class Parameters { public String name = ""; public String value = ""; } } for(ClsMessage.Parameters param : clsMessage.parameters) { .... } Just declaring an inner class won't actually have an "inner class" as a field. You would need to make a field for it. Considering you wanted to iterate through it with a for-loop, I assumed you wanted more than one Parameters in your message, so I added a List.
has comment: http://stackoverflow.com/comment/39629126
type: Answer
accepted answer of: http://stackoverflow.com/q/25362990

http://stackoverflow.com/comment/39622728
type: Comment
comment on: http://stackoverflow.com/q/25379340
type: QuestionComment
has text: As to reading (and setting) custom properties on java objects in javascript - it seems to be another flaw in Nashorn (I do not remember how it was in Rhino) - I'll give antoher edit to my answer later to address it.
score: 0

http://stackoverflow.com/q/25384741
has answer: http://stackoverflow.com/a/25384845
has comment: http://stackoverflow.com/comment/39588602
has comment: http://stackoverflow.com/comment/39589041
has comment: http://stackoverflow.com/comment/39588555
has comment: http://stackoverflow.com/comment/39588466
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39588472
type: Question
has comment: http://stackoverflow.com/comment/39588407
has title: Why isn't my for-loop executing?
has comment: http://stackoverflow.com/comment/39588668
accepted answer: http://stackoverflow.com/a/25384845
tagged with: android
has body: In my try block i have a for loop which I'm certain isn't working as when I log in the for loop I get nothing back meaning in my application the loop isn't being accessed. Here is my try block which includes the for loop: try { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { anInStream = httpConn.getInputStream(); InputStreamReader in= new InputStreamReader(anInStream); BufferedReader bin= new BufferedReader(in); String line = new String(); while (( (line = bin.readLine())) != null) { result = result + line; } } menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); Log.v(TAG, "index1=" + menuItems); Handler parser = new Handler(); String xml = result; // getting XML Document doc = parser.getDomElement(xml); NodeList nl = doc.getElementsByTagName(KEY_FUEL); Log.v(TAG, "index2=" + nl); for (int i = 0; i &lt; nl.getLength(); i++) { Log.v(TAG, "index3=" + nl); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Element e = (Element) nl.item(i); map.put(KEY_HIGHEST, parser.getValue(e, KEY_HIGHEST)); map.put(KEY_AVERAGE, parser.getValue(e, KEY_AVERAGE)); map.put(KEY_LOWEST, parser.getValue(e, KEY_LOWEST)); map.put(KEY_LINK, parser.getValue(e, KEY_LINK)); Log.v(TAG, "index4=" + map); menuItems.add(map); Log.v(TAG, "index5=" + menuItems); } } catch (IOException ex) { try { throw new IOException("Error connecting"); } catch (IOException e) { e.printStackTrace(); } } return menuItems; i added the catch and return for completeness incase perhaps these are the cause. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/39588523
has comment: http://stackoverflow.com/comment/39588515
has comment: http://stackoverflow.com/comment/39588498
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/76242458
has text: The spec said that value could be no related to the temp folder "If the directory argument is null then the system-dependent default temporary-file directory will be used"
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25308251

http://stackoverflow.com/comment/39519227
comment on: http://stackoverflow.com/a/25340103
type: AnswerComment
type: Comment
has text: Make sure that `mUsers` or `users` isn't `null`. You'll probably want to create the `List` for `mUsers` somewhere, e.g., in `onCreate` via `mUsers = new ArrayList<ParseUser>();`.
score: 0

http://stackoverflow.com/comment/39519681
type: QuestionComment
comment on: http://stackoverflow.com/q/25347903
score: 0
has text: @Juxhin Yes its the lion image that doesnt get drawn sometimes. Maybe gets displayed for a split second
type: Comment

http://stackoverflow.com/a/25280200
score: 5
has comment: http://stackoverflow.com/comment/39416413
accepted answer of: http://stackoverflow.com/q/25280016
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25280016
has comment: http://stackoverflow.com/comment/39399911
upvote count: 5
type: Answer
has body: I would recommend using Handler instead of Timer in android that it can cause memory leaks in your application. sample: Handler mHandler; Runnable mRunnable; void scheduleSyncIn(int aSeconds){ mHandler = new Handler(); mRunnable = new Runnable() { @Override public void run() { mHandler.postDelayed(mRunnable, aSeconds); } }; mHandler.postDelayed(mRunnable, aSeconds); }

http://stackoverflow.com/comment/39514959
score: 0
has text: I think you mean efficiency rather than efficacy, because lambdaj is producing the expected results, it's just slower than you expect.
type: QuestionComment
comment on: http://stackoverflow.com/q/25343897
type: Comment

http://stackoverflow.com/q/25379386
has title: Java swingworker() process() not getting called
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39584780
has comment: http://stackoverflow.com/comment/39579548
type: Question
has comment: http://stackoverflow.com/comment/39578440
answer count: 2
tagged with: swingworker
has comment: http://stackoverflow.com/comment/39578483
has comment: http://stackoverflow.com/comment/39585156
has answer: http://stackoverflow.com/a/25379599
tagged with: windowbuilder
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39578330
accepted answer: http://stackoverflow.com/a/25379760
score: 0
has comment: http://stackoverflow.com/comment/39578795
possible better answer: http://stackoverflow.com/a/25379599
has answer: http://stackoverflow.com/a/25379760
tagged with: java
has body: I am using swingworker() to create a background thread that publishes results and GUI should be updated through process(). But process() never gets called: public class comm { protected Shell shldPrinter; private Text v1time; private static Text cTemp1; static boolean control1 = false; /** * Launch the application. * @param args */ public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { new comm(); //create the user interface named window //window.open(); //invoke open() function } catch (Exception e) { e.printStackTrace(); } } }); } /** * Open the window. */ public comm() { this.open(); } public void open() { Display display = Display.getDefault(); createContents(); shldPrinter.open(); shldPrinter.layout(); while (!shldPrinter.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } private void start() { SwingWorker&lt;Boolean,String&gt; worker = new SwingWorker&lt;Boolean,String&gt; () { //@Override protected Boolean doInBackground() throws Exception { while(control1) { curtemp1++; publish(Double.toString(curtemp1)); System.out.println(curtemp1); try { Thread.sleep(500); // milliseconds } catch (InterruptedException ex) {} } return true; } protected void process(List&lt;String&gt; chunks) { cTemp1.setText("chunks.get(chunks.size()-1)"); } }; worker.execute(); } /** * Create contents of the window. */ protected void createContents() { shldPrinter = new Shell(); shldPrinter.setSize(490, 299); shldPrinter.setText("Robogel Temp Control"); final Button btnCln1 = new Button(shldPrinter, SWT.CHECK); btnCln1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { control1 = btnCln1.getSelection(); if(control1) start(); } }); btnCln1.setBounds(22, 51, 69, 16); btnCln1.setText("Valve 1"); //create text box for valve 1 timing v1time = new Text(shldPrinter, SWT.BORDER | SWT.CENTER); v1time.addFocusListener(new FocusAdapter() { @Override …

http://stackoverflow.com/comment/39510699
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25342407
has text: @Randomdemha-If errors are rectified,please accept the answer!
score: 0

http://stackoverflow.com/comment/39310976
comment on: http://stackoverflow.com/a/25231664
has text: Good answer, but if by *"it is hard to imagine that attributes are used only internally to the class that holds them."* you mean that `private` fields without `public` getters and setters are rare, then allow me to disagree. Good OOP design is about hiding implementation details (the private parts). If every attribute is exposed (by being `public` or having `public` get/setters), then the class is nothing more than a `struct`. I know that JavaBeans demand get/setters, but if you program (your domain) using POJOs (see DDD), having getters/setters/public fields is seldom a desirable goal.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39314004
type: Comment
has text: You should return the resource when you're done using that instance.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25236322

http://stackoverflow.com/a/25261648
type: Answer
accepted answer of: http://stackoverflow.com/q/25261503
has body: You mean with an Intent? Try this: String collapseKey = intent.getStringExtra("collapse_key");
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25261503
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25355377
downvote count: 0
accepted answer: http://stackoverflow.com/a/25355553
tagged with: java
has comment: http://stackoverflow.com/comment/39532932
favorite count: 0
has body: I am pretty new to java, and I'm currently learning how to make GUIs. To test out making them, I tried making one on my own. In order to find out how to make text boxes uneditable, I googled it and found it on the oracle website and tried it out. Unfortunately when I attempt to execute this, I am given the errors 'Syntax error on token(s), misplaced construct(s)' and 'Syntax error on token "false", delete this token'. This is what I had so far for the text area: JTextArea textArea = new JTextArea("Testing the text", 5, 10); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setEditable(false); The error is at the period between 'textArea' and 'setEditable' and (of course) the 'false'. I get the same kind of error when I try to do setText. If it helps, what I imported was: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JScrollPane; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; I also extended JFrame and implemented ActionListener Any help would be appreciated :) So upon request, I am posting the rest of the code here. Unfortunately I haven't gotten very far in the program yet, but I will post what I have so far and try to finish it soon. RunTestGui.java file: import javax.swing.JFrame; public class RunTestGui { public static void main(String[] args) { // TODO Auto-generated method stub TestGui gui = new TestGui(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } TestGui.java file: /*import java.awt.event.ActionEvent; import java.awt.event.ActionListener;*/ //import javax.swing.*; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JScrollPane; //import java.awt.event.ActionEvent; //impor…
type: Question
has answer: http://stackoverflow.com/a/25355553
tagged with: swing
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/25355557
possible better answer: http://stackoverflow.com/a/25355557
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39532941
answer count: 2
has title: Unable to make text areas uneditable in java

http://stackoverflow.com/a/25354557
score: 3
has comment: http://stackoverflow.com/comment/74312208
answers question: http://stackoverflow.com/q/25352081
type: Answer
has body: Firstly, there's no guarantee that the p12 file you have contains the CA certificate with which the End Entity Certificate it contains was issued. Although it is useful for a keystore to contain intermediate certificate (as discussed here), containing the CA at the end of the chain is not necessary: if the remote party doesn't trust it, adding it to the chain won't make a difference (as discussed here). You can check this using openssl pkcs12 -nokeys -out output.pem -in yourstore.p12. Look at the content of output.pem with a text editor, you should see whether the CA certificate is included. If not, contact the CA that issued your certificate, they should be able to provide it to you. Then, to build a new keystore to use as a truststore, use keytool -import, for example keytool -import -keystore mytruststore.jks -file the_ca_file.pem. (That CA file should only contain the certificate of the CA, not the others. If you're copying this from the previous output, only use the relevant --BEGIN--...--END-- block.) You're not saying whether you want this truststore to be used for authenticating clients connecting to your Tomcat server, or to be used for connections made by webapps running within Tomcat (in which case they're clients). Where and how to set up this truststore will depend on it. (In the second case, it's often useful to start from a copy of the default cacerts file, instead of creating a new store from scratch.)
accepted answer of: http://stackoverflow.com/q/25352081
upvote count: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39402453
score: 2
type: QuestionComment
has text: @Draconwolver Do you have the permission to create file in this directory?
type: Comment
comment on: http://stackoverflow.com/q/25277106

http://stackoverflow.com/q/25382093
favorite count: 0
tagged with: javax.imageio
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25387408
tagged with: java
answer count: 1
tagged with: image-processing
score: 1
tagged with: image
has body: Here is my situation. I have a servlet that serves images. I used ImageIO SPI to add support for writing TGA-16 images because Java doesn't support TGA out of the box and unbelievably - TGA is still EXTREMELY prevalent in JDA Space Planning Software. I also used Apache Commons Imaging to support TIF images as well. Thank You @haraldK and @Johan for your much appreciated help. The problem I face is adding support to transform TIF source images to other formats while retaining the Clipping Path. I have searched for months and found a way to do it with im4java, but my problem is that the servlet replaced ImageMagick and all dependencies along with the PHP scripts that use to serve images - so I would rather not go that route. Does anybody know of a Java API that can be used to read the XML embedded in the TIF Header into a Java Shape and doesn't use ImageMagick under the covers? Here is example Clipping Path XML embedded in Tiff Header: Clipping path: &lt;?xml version="1.0" encoding="iso-8859-1"?&gt; &lt;svg width="1753" height="1800"&gt; &lt;g&gt; &lt;path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d=" M 181.459 178.579 V 170.188 180.269 170.188 195.632 Y 170.188 210.994 170.188 1473.63 V 170.554 1491.5 176.721 1500.8 Y 208.469 1548.66 309.381 1683.47 V 331.175 1712.37 358.181 1708.11 Y 385.186 1703.84 1570.59 1559.64 V 1582.38 1559.84 1582.38 1545.63 Y 1582.38 1531.42 1582.38 234.474 V 1583.59 214.93 1574.31 207.599 C 1536.48 177.747 1484.3 147.104 1436.35 125.402 Y 1391.68 105.178 1351.71 93.7894 V 1339.86 90.4736 1321.86 91.8947 C 1315.75 92.377 1190.32 100.732 1024.36 114.142 C 1015.45 114.861 1007.86 121.442 998.722 122.04 C 869.146 130.514 726.84 140.18 595.638 148.72 C 578.398 149.842 551.936 143.832 535.282 144.912 Y 353.926 156.665 207.991 165.316 V 197.568 168.396 197.568 175.737 L 181.459 178.579 Z "/&gt; &lt;/g&gt; &lt;/svg&gt; This is an embedded clipping path created by Photoshop.
type: Question
tagged with: tiff
has comment: http://stackoverflow.com/comment/39591624
downvote count: 0
has answer: http://stackoverflow.com/a/25387408
has title: Java API to create Shape from clipping path embedded in tif source file
upvote count: 1

http://stackoverflow.com/comment/39462378
type: AnswerComment
score: 0
type: Comment
has text: I would use the rule: if the class is not *final* and the method you are calling from the constructor is not *private*, avoid it.
comment on: http://stackoverflow.com/a/25316435

http://stackoverflow.com/comment/39441091
type: AnswerComment
comment on: http://stackoverflow.com/a/25298298
has text: @EMMERZOH - Then you are doomed to building a new list which may bite you if the list gets big. My solution takes no more memory and merges the two lists on the fly.
type: Comment
score: 0

macos
tags question: http://stackoverflow.com/q/25267364
tags question: http://stackoverflow.com/q/25377167
tags question: http://stackoverflow.com/q/25265046
tags question: http://stackoverflow.com/q/25231804
tags question: http://stackoverflow.com/q/25321187
tags question: http://stackoverflow.com/q/25370670
tags question: http://stackoverflow.com/q/25387238
type: Tag
tags question: http://stackoverflow.com/q/25318992
tags question: http://stackoverflow.com/q/25354653
tags question: http://stackoverflow.com/q/25255950
tags question: http://stackoverflow.com/q/25332230
tags question: http://stackoverflow.com/q/25310004
tags question: http://stackoverflow.com/q/25270465
tags question: http://stackoverflow.com/q/25235119
tags question: http://stackoverflow.com/q/25326730
tag name: macos
tags question: http://stackoverflow.com/q/25246578
tags question: http://stackoverflow.com/q/25317674
tags question: http://stackoverflow.com/q/25341182
tags question: http://stackoverflow.com/q/25336173
tags question: http://stackoverflow.com/q/25281802
tags question: http://stackoverflow.com/q/25288954

http://stackoverflow.com/comment/39387632
comment on: http://stackoverflow.com/a/25276233
type: Comment
has text: @Takendarkk,@Scary Wombat Sorry if any ambiguity persist in my solution. Will take care from next time.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25387052
has comment: http://stackoverflow.com/comment/39593204
has title: Creating Map from large file
has body: I have a very large file (10^8 lines) with counts of events as follows, A 10 B 11 C 23 A 11 I need to accumulate the counts for each event, so that my map contains A 21 B 11 C 23 My current approach: Read the lines, maintain a map, and update the counts in the map as follows updateCount(Map&lt;String, Long&gt; countMap, String key, Long c) { if (countMap.containsKey(key)) { Long val = countMap.get(key); countMap.put(key, val + c); } else { countMap.put(key, c); } } Currently this is the slowest part of the code, (takes around 25 ms). Note that the map is based on MapDB, but I doubt that updates are slow due to that (are they?) This is the mapdb configs for the map, DBMaker.newFileDB(dbFile).freeSpaceReclaimQ(3) .mmapFileEnablePartial() .transactionDisable() .cacheLRUEnable() .closeOnJvmShutdown(); Are there ways to speed this up? EDIT: The number of unique keys is of the order of the pages in wikipedia. The data is actually page traffic data from here.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39593139
has comment: http://stackoverflow.com/comment/39594335
has comment: http://stackoverflow.com/comment/39593066
tagged with: dictionary
has comment: http://stackoverflow.com/comment/39594411
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39594149
has answer: http://stackoverflow.com/a/25387591
tagged with: java
has answer: http://stackoverflow.com/a/25455211
has answer: http://stackoverflow.com/a/25387247
tagged with: mapdb
has comment: http://stackoverflow.com/comment/39593065
type: Question

http://stackoverflow.com/q/25344495
accepted answer: http://stackoverflow.com/a/25344856
tagged with: java
tagged with: checkbox
tagged with: eclipse
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25344856
possible better answer: http://stackoverflow.com/a/25344530
has body: I have two extra checkboxes which are set at .50 each when the checkbox is selected it adds the .50 to the total, so far no problems. How can I make it so that the user can change the checkbox text to the topping they like? Here is my code: chckbxAddTopp1 = new JCheckBox("Add Topping1"); chckbxAddTopp1.setBackground(new Color(204, 255, 255)); chckbxAddTopp1.addActionListener(listener); chckbxAddTopp2 = new JCheckBox("Add Topping2"); chckbxAddTopp2.setBackground(new Color(204, 255, 255)); chckbxAddTopp2.addActionListener(listener);
has title: Java Eclipse checkboxes
type: Question
has answer: http://stackoverflow.com/a/25344530

http://stackoverflow.com/comment/39485627
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25328769
has text: Wojtek Surowka and Christian Hackl: tks! I add c++ fragment code
score: 0

http://stackoverflow.com/q/25337184
has comment: http://stackoverflow.com/comment/39557354
score: 0
has title: Mysteriously vanishing object reference
has body: In a netbeans platform project with more than one module there is a TopComponent object. One of the private properties of this TopComponent refers to another object. One of the components of this TopComponent is a button with event handling code in the TopComponent. Before the button is pressed the property refers to the correct object, but as soon as the button is pressed (at the start of the event handling code) the value of this property is null! What happened to my object reference? As far as I can tell I haven't written any code that would set it to null. All my code seems to be working fine according to the debugger. I don't know how to make the debugger stop at the point where the variable is cleared. I used a fixed watch on the TopComponent object to confirm that just before pressing the button the object reference is there, and a break point at the start of the button's event handling code to see that it's gone there. But what happens in between that? I don't know, but whatever it is it's messing up my code. The property is initialised when declared as null, it is given a value when the lookup from another module triggers a method that sets it. That method works fine. I'm pretty sure it's the same instance of the TopComponent because the debugger gives the same id for the object and I used a fixed watch. What am I missing? Here is the relevant class package org.sil.jflavourviewer; // &lt;snip&gt; import statements /** * Top component which displays something. */ @ConvertAsProperties(dtd = "-//org.sil.jflavourviewer//JFlavourViewer//EN", autostore = false) @TopComponent.Description(preferredID = "JFlavourViewerTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS) @TopComponent.Registration(mode = "explorer", openAtStartup = true) @ActionID(category = "Window", id = "org.sil.jflavourviewer.JFlavourViewerTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistrati…
tagged with: java
has comment: http://stackoverflow.com/comment/39501542
answer count: 1
accepted answer: http://stackoverflow.com/a/25368453
has comment: http://stackoverflow.com/comment/39557060
has answer: http://stackoverflow.com/a/25368453
type: Question
has comment: http://stackoverflow.com/comment/39544833
has comment: http://stackoverflow.com/comment/39501478
has comment: http://stackoverflow.com/comment/39501642
has comment: http://stackoverflow.com/comment/39531224
has comment: http://stackoverflow.com/comment/39530930
type: AnsweredQuestion
tagged with: netbeans-platform

http://stackoverflow.com/q/25358380
tagged with: rabbitmq
tagged with: spring-rabbit
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/25358756
has body: On exception while processing the message from RabbitMQ, i just wanted to unacknowledg and put back the particular message to a difference queue instead or re-queue to same queue or completely discard the message(as per the last Boolean flag@requeue in basicNack). The whole idea is later on i can get the count of unack message and check the message format etc instead of re-queue again and again to same channel and also i want to sent unacknowledged signal to current channel. FYI I set the channel ack mode as manual(i.e container.setAcknowledgeMode(AcknowledgeMode.MANUAL);) This is what i am doing now. public class My***Listener implements ChannelAwareMessageListener{ try{ @Override public void onMessage(Message message,Channel channel) throws Exception { String s = new String(message.getBody()); //some logic //after successful ack manually channel.basicAck(message.getMessageProperties().getDeliveryTag(),false); } catch(Exception e){ //currently on exception i am unack the channel channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,false); } Any help is highly appreciable.
answer count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25358756
tagged with: spring-amqp
linked to: http://stackoverflow.com/q/24858880
has comment: http://stackoverflow.com/comment/39557600
possible better answer: http://stackoverflow.com/a/25359544
has title: Put unacknowledged message(on exception) to a different queue in RabbitMQ
has answer: http://stackoverflow.com/a/25363579
has answer: http://stackoverflow.com/a/25359544
tagged with: spring

http://stackoverflow.com/a/48923325
type: Answer
downvote count: 0
upvote count: 1
has body: You have to share the HTTP sessions between the web applications (.war) in the same enterprise application (.ear). In the .ear's weblogic-application.xml add the following setting: true see: http://xmlns.oracle.com/weblogic/weblogic-application/1.2/weblogic-application.xsd and http://xmlns.oracle.com/weblogic/weblogic-javaee/1.2/weblogic-javaee.xsd CAUTION: When you mix several .wars be careful about the cookie names. In our case mixing .wars (static resources) with default cookie name JSESSIONID and applications with explicitly defined session cookie names, the "shared" cookie name turned to be JSESSIONID, not the explicitly defined one.
answers question: http://stackoverflow.com/q/25331727
score: 1

http://stackoverflow.com/comment/39514044
has text: MyBatis can't do this, but the tool you used to create the class diagram should have this capability.
comment on: http://stackoverflow.com/q/25282540
score: 0
type: Comment
type: QuestionComment

maven
tags question: http://stackoverflow.com/q/25301663
tags question: http://stackoverflow.com/q/25327639
tags question: http://stackoverflow.com/q/25385410
tags question: http://stackoverflow.com/q/25326689
tags question: http://stackoverflow.com/q/25241817
tags question: http://stackoverflow.com/q/25261833
tags question: http://stackoverflow.com/q/25240345
tags question: http://stackoverflow.com/q/25302350
tags question: http://stackoverflow.com/q/25349663
tags question: http://stackoverflow.com/q/25238289
tags question: http://stackoverflow.com/q/25326721
tags question: http://stackoverflow.com/q/25386413
tags question: http://stackoverflow.com/q/25367965
tags question: http://stackoverflow.com/q/25283977
tags question: http://stackoverflow.com/q/25305883
tags question: http://stackoverflow.com/q/25269044
tags question: http://stackoverflow.com/q/25262377
type: Tag
tags question: http://stackoverflow.com/q/25284532
tags question: http://stackoverflow.com/q/25387263
tags question: http://stackoverflow.com/q/25385444
tags question: http://stackoverflow.com/q/25282255
tags question: http://stackoverflow.com/q/25267543
tags question: http://stackoverflow.com/q/25389781
tags question: http://stackoverflow.com/q/25365998
tags question: http://stackoverflow.com/q/25240484
tags question: http://stackoverflow.com/q/25292666
tags question: http://stackoverflow.com/q/25319625
tags question: http://stackoverflow.com/q/25368728
tags question: http://stackoverflow.com/q/25255633
tags question: http://stackoverflow.com/q/25293433
tags question: http://stackoverflow.com/q/25352751
tags question: http://stackoverflow.com/q/25256511
tags question: http://stackoverflow.com/q/25278235
tags question: http://stackoverflow.com/q/25384618
tags question: http://stackoverflow.com/q/25288602
tags question: http://stackoverflow.com/q/25299396
tags question: http://stackoverflow.com/q/25263391
tags question: http://stackoverflow.com/q/25257829
tags question: http://stackoverflow.com/q/25235574
tags question: http://stackoverflow.com/q/25277878
tags question: http://stackoverflow.com/q/25245021
tags question: http://stackoverflow.com/q/25306883
tags question: http://stackoverflow.com/q/25388407
tags question: http://stackoverflow.com/q/25284634
tags question: http://stackoverflow.com/q/25245407
tags question: http://stackoverflow.com/q/25302147
tags question: http://stackoverflow.com/q/25264296
tags question: http://stackoverflow.com/q/25244722
tags question: http://stackoverflow.com/q/25373565
tags question: http://stackoverflow.com/q/25386738
tags question: http://stackoverflow.com/q/25312993
tags question: http://stackoverflow.com/q/25327338
tags question: http://stackoverflow.com/q/25290458
tags question: http://stackoverflow.com/q/25241338
tags question: http://stackoverflow.com/q/25288381
tags question: http://stackoverflow.com/q/25279190
tags question: http://stackoverflow.com/q/25246724
tags question: http://stackoverflow.com/q/25281029
tags question: http://stackoverflow.com/q/25242239
tags question: http://stackoverflow.com/q/25377124
tags question: http://stackoverflow.com/q/25260674
tags question: http://stackoverflow.com/q/25386801
tags question: http://stackoverflow.com/q/25269053
tags question: http://stackoverflow.com/q/25232541
tags question: http://stackoverflow.com/q/25239673
tags question: http://stackoverflow.com/q/25273265
tags question: http://stackoverflow.com/q/25337112
tags question: http://stackoverflow.com/q/25281346
tags question: http://stackoverflow.com/q/25241213
tags question: http://stackoverflow.com/q/25237020
tags question: http://stackoverflow.com/q/25351750
tags question: http://stackoverflow.com/q/25245264
tags question: http://stackoverflow.com/q/25308245
tags question: http://stackoverflow.com/q/25379560
tags question: http://stackoverflow.com/q/25246535
tags question: http://stackoverflow.com/q/25271271
tags question: http://stackoverflow.com/q/25243828
tags question: http://stackoverflow.com/q/25362127
tags question: http://stackoverflow.com/q/25368935

http://stackoverflow.com/q/25319414
tagged with: google-app-engine
type: UnansweredQuestion
has body: At Google I/O Keynote this year, they announced Cloud Debugger. Is there any specs? Because I can't find this button on my Google App Engine Developers Console. My app is a classic GWT/Java app packaged in a WAR. The source code is on GitHub and it's linked to my Developers Console "Repository connected". Do I need to package my app with module? Or do something else? THX
type: Question
score: 0
tagged with: java
tagged with: google-cloud-debugger
answer count: 3
has answer: http://stackoverflow.com/a/26788726
has answer: http://stackoverflow.com/a/32379499
has title: Google App Engine - Cloud Debugger availability?
has answer: http://stackoverflow.com/a/25327133

http://stackoverflow.com/q/25263072
tagged with: file-io
has answer: http://stackoverflow.com/a/25263296
has comment: http://stackoverflow.com/comment/39363039
has answer: http://stackoverflow.com/a/25263212
accepted answer: http://stackoverflow.com/a/25263211
tagged with: java
has comment: http://stackoverflow.com/comment/39363104
has title: Run Java program after exception encountered
has answer: http://stackoverflow.com/a/25263211
has answer: http://stackoverflow.com/a/25263214
answer count: 4
type: Question
has body: How can I make my Java run again from the start (main) when it encounters an exception without closing and running it again manually? My program basically writes on a file. When it cannot find the file I will throw the FileNotFoundException then write the file (say for example hello.txt). After it writes, the program closes (in NetBeans cause I am still developing it) and start showing this at the buttom: Exception in thread "main" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:542) at java.lang.Integer.parseInt(Integer.java:615) at app4pics1word.App4pics1word.cache(App4pics1word.java:127) at app4pics1word.App4pics1word.&lt;init&gt;(App4pics1word.java:18) at app4pics1word.App4pics1word.main(App4pics1word.java:146) Java Result: 1
has comment: http://stackoverflow.com/comment/39363117
possible better answer: http://stackoverflow.com/a/25263296
has comment: http://stackoverflow.com/comment/39363040
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25405330
answers question: http://stackoverflow.com/q/25385990
downvote count: 0
has body: Processing might use reflection for some stuff, but in the case of the mousePressed() functions, that's a simple matter of inheritance. Processing contains a PApplet class, the source of which you can view here: https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java At the time of this answer, line 3087 of the PApplet class is the mousePressed(MouseEvent) function that is called via an Event handler, which you can read about here: http://docs.oracle.com/javase/tutorial/uiswing/events/ This mousePressed(MouseEvent) method calls the no-arg mousePressed() function, which is an empty function on line 3084. When you write a Processing sketch, you're secretly extending PApplet. When you write a mousePressed() function in your sketch, you override the empty mousePressed() function of the PApplet class. Now when the PApplet class gets a MouseEvent from its MouseListener, it calls your mousePressed function. That's how inheritance works. If you're asking a more specific question, please provide an MCVE that demonstrates exactly what you're talking about.
type: AcceptedAnswer
score: 5
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25385990

http://stackoverflow.com/comment/39412487
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25289740
has text: Based in what you describe I have no idea. If the local variables are initialized by methods that are not themselves thread safe, then `foo()` is not as well. Do you have some code you can share?

http://stackoverflow.com/q/25304506
accepted answer: http://stackoverflow.com/a/29166501
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39443888
has answer: http://stackoverflow.com/a/27259120
tagged with: eclipse-kepler
has answer: http://stackoverflow.com/a/25305555
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 3
score: 3
possible better answer: http://stackoverflow.com/a/25304589
has body: I am developing a Mobile app for the first time Environment : Eclipse Kepler, Java 1.7 Backend : I have followed the following steps : 1) Installed Android SDK and run the Android SDK Manager, and installed the required files 2) Installed ADT Eclipse ADT Plugin : https://dl-ssl.google.com/android/eclipse At this stage in some standard docs it said that you have to now create an AVD, the AVD icon was suppose to appear in my toolbar, but I couldnt find it anywhere. Now, I am trying to develop my first app as shown on this site : http://developer.android.com/training/basics/firstapp/index.html I am jus adding my code snippets as below for reference : main.xml : <?xml version="1.0" encoding="utf-8"?> strings.xml : <?xml version="1.0" encoding="utf-8"?> My First App Enter a message Send Settings MainActivity Uploading… Hello world! DisplayMessageActivity AndroidManifest.xml : <!-- <?xml version="1.0" encoding="utf-8" standalone="no"?> --> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion ="20" /> <uses-permission android:name="android.permission.INTERNET" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.amazon.demo.MainActivity" /> MainActivity.java public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.amazon.demo.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // 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.onO…
linked to: http://stackoverflow.com/q/22548798
downvote count: 0
linked to: http://stackoverflow.com/q/22482461
favorite count: 0
has title: fragment_display_message : My first Android app error
type: Question
has comment: http://stackoverflow.com/comment/39443920
has answer: http://stackoverflow.com/a/25304589
has answer: http://stackoverflow.com/a/29166501

http://stackoverflow.com/comment/39477134
type: Comment
type: AnswerComment
has text: I think the `Thread.sleep` is perfectly fine. He might want to wrap the `repaint` in an `invokeLater` though.
score: 0
comment on: http://stackoverflow.com/a/25324339

http://stackoverflow.com/comment/39483221
score: 0
type: Comment
type: QuestionComment
has text: I'd expect the ActiveDirectory Auth Mgr to set this, no?
comment on: http://stackoverflow.com/q/25320011

java-8
tags question: http://stackoverflow.com/q/25341219
tags question: http://stackoverflow.com/q/25233853
tags question: http://stackoverflow.com/q/25266718
tags question: http://stackoverflow.com/q/25360927
tags question: http://stackoverflow.com/q/25376242
tags question: http://stackoverflow.com/q/25270467
tags question: http://stackoverflow.com/q/25279300
tags question: http://stackoverflow.com/q/25234881
tags question: http://stackoverflow.com/q/25380168
tags question: http://stackoverflow.com/q/25332640
tags question: http://stackoverflow.com/q/25300804
tags question: http://stackoverflow.com/q/25332849
tags question: http://stackoverflow.com/q/25357043
tags question: http://stackoverflow.com/q/25269346
tags question: http://stackoverflow.com/q/25335495
tags question: http://stackoverflow.com/q/25262580
tags question: http://stackoverflow.com/q/25314344
tag name: java-8
tags question: http://stackoverflow.com/q/25302279
tags question: http://stackoverflow.com/q/25271352
tags question: http://stackoverflow.com/q/25252953
tags question: http://stackoverflow.com/q/25337743
tags question: http://stackoverflow.com/q/25315846
tags question: http://stackoverflow.com/q/25311535
tags question: http://stackoverflow.com/q/25279729
tags question: http://stackoverflow.com/q/25242570
tags question: http://stackoverflow.com/q/25299653
tags question: http://stackoverflow.com/q/25315752
tags question: http://stackoverflow.com/q/25354032
tags question: http://stackoverflow.com/q/25258748
tags question: http://stackoverflow.com/q/25338376
type: Tag
tags question: http://stackoverflow.com/q/25365952
tags question: http://stackoverflow.com/q/25251388
tags question: http://stackoverflow.com/q/25291771
tags question: http://stackoverflow.com/q/25372761
tags question: http://stackoverflow.com/q/25291720
tags question: http://stackoverflow.com/q/25280693

http://stackoverflow.com/q/25256399
tagged with: imageview
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/15261088
score: 2
type: AnsweredQuestion
has title: Programmatically set the width and height of GridView And ImageView
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25256679
linked to: http://stackoverflow.com/q/22267843
tagged with: textview
has body: I have seen SO questions regarding how to set the height and width of an ImageView, and a GridView separately. Here, here and here for starters But, I'm wondering how to set both. Here's my setup. In my GridView, I have an ImageView and a TextView. I have a few images of various widths and sizes, which I want to resize to always be 1/3 the size of the screen square. Underneath, I have a text description. Here's the code for what I have so far... gallerygridview.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/imgNoMedia" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/app_name" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp" android:textStyle="bold" android:typeface="sans" android:layout_below="@+id/imageView1" android:layout_marginTop="2dp" android:layout_centerHorizontal="true" android:textColorHighlight="#000000" android:gravity="center" /> In my Activity... protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallerygridview); GridView gridView = (GridView) findViewById(R.id.gridGallery); m_adapter = new PhotoImageAdapter(getBaseContext(),m_images); gridView.setAdapter(m_adapter); // uses the view to get the context instead of getActivity(). registerForContextMenu(gridView); } And in my Adapter class... public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; Holder holder=new Holder(); if (view == null) { LayoutInflater inflater = LayoutInflater.from(mContext); view = inflater.inflate(R.layout.gallerygridview, parent, false); holder.img = new ImageView(mContext); holder.img = (ImageView) view.findViewById(R.id.imgNoMedia); holder.tv = (TextView) view.findViewById(R.id.textView1); int iDisplayWidth = mContext.getResources().getDisplayMetrics().widthPixels ; int i…
linked to: http://stackoverflow.com/q/18511484
tagged with: android-gridview
type: Question
possible better answer: http://stackoverflow.com/a/25257297
linked to: http://stackoverflow.com/q/22372269
answer count: 2
accepted answer: http://stackoverflow.com/a/25256679
upvote count: 2
has answer: http://stackoverflow.com/a/25257297

casting
tags question: http://stackoverflow.com/q/25386502
tags question: http://stackoverflow.com/q/25354032
tags question: http://stackoverflow.com/q/25268510
tags question: http://stackoverflow.com/q/25290474
tags question: http://stackoverflow.com/q/25262686
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/25379446
tags question: http://stackoverflow.com/q/25234029

http://stackoverflow.com/q/25330208
has title: How to avoid implicit type conversion when pass varargs in Scala?
tagged with: variadic-functions
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39497315
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/25288212
upvote count: 1
has answer: http://stackoverflow.com/a/25336109
favorite count: 0
type: Question
tagged with: type-conversion
score: 1
tagged with: java
has body: I wrote a function like this: def a (params:Any*) = { val clazzes = params.map(_.getClass) ... } But when I pass in a param with type of Scala Long, it is automatically converted to java.lang.Long Is there any way to avoid that?

http://stackoverflow.com/comment/39362856
comment on: http://stackoverflow.com/q/25262338
type: Comment
type: QuestionComment
score: 0
has text: So you want to reduce the output?

http://stackoverflow.com/comment/39448834
has text: In addition to those syntax problems, it seems like that SQL query would still produce an error, without a reference to a `t2` rowsource.
comment on: http://stackoverflow.com/a/25309369
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25295864
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39424259
has comment: http://stackoverflow.com/comment/39424545
has comment: http://stackoverflow.com/comment/39424901
has body: You first need to be synchronized on the Object before calling wait. This is where you are getting the exception from. void test() { String s = "AAA"; synchronized( s ) { s.wait(); } } The same thing must be done when you call notify, but in this case it is a very very bad idea because if a thread enters this method it will never return. Although considering it is a String literal you may be able to get away with it by using the same literal in another method in the same class, but don't count on it.
score: 4
has comment: http://stackoverflow.com/comment/39424520
has comment: http://stackoverflow.com/comment/39424126
downvote count: 0
has comment: http://stackoverflow.com/comment/39424446
has comment: http://stackoverflow.com/comment/39424666
answers question: http://stackoverflow.com/q/25295756
has comment: http://stackoverflow.com/comment/39466912

http://stackoverflow.com/comment/39461264
type: QuestionComment
has text: Can you add your 'not working' code? And explain better what 'not working' actually means?
score: 2
comment on: http://stackoverflow.com/q/25315912
type: Comment

http://stackoverflow.com/comment/52563806
type: QuestionComment
has text: I have this same question, too. According to this discussion https://github.com/square/retrofit/issues/490, seems like retrofit doesn't support the nested query/field. Thanks.
comment on: http://stackoverflow.com/q/25334499
score: 0
type: Comment

http://stackoverflow.com/q/25335341
answer count: 1
has answer: http://stackoverflow.com/a/25335935
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25335935
has body: I wanted to figure out what is difference between openGL(LWJGL) and swing when it comes to rendering simple squares. Unsurprisingly, openGL won, but at some tests the result was close, or even in favor to swing. Why is it so?? My test results: Testing for a total of 500000 rectangles Swing time: 0.16367821 OpenGL time: 0.06317429 OpenGL relative to SWING is faster by 159.0899% Testing for a total of 750000 rectangles OpenGL time: 0.066062525 Swing time: 0.16988374 OpenGL relative to SWING is faster by 157.156% Testing for a total of 1000000 rectangles OpenGL time: 0.0907693 Swing time: 0.15694521 OpenGL relative to SWING is faster by 72.90561% Testing for a total of 1250000 rectangles OpenGL time: 0.09591239 Swing time: 0.17011923 OpenGL relative to SWING is faster by 77.369385% Testing for a total of 1500000 rectangles OpenGL time: 0.11926948 Swing time: 0.21623997 OpenGL relative to SWING is faster by 81.303696% Testing for a total of 1750000 rectangles OpenGL time: 0.16327758 Swing time: 0.25741237 OpenGL relative to SWING is faster by 57.65323% Testing for a total of 2000000 rectangles OpenGL time: 0.17265266 Swing time: 0.2788536 OpenGL relative to SWING is faster by 61.511322% Testing for a total of 2250000 rectangles OpenGL time: 0.2492242 Swing time: 0.3022127 OpenGL relative to SWING is faster by 21.261368% Testing for a total of 2500000 rectangles Swing time: 0.3231118 OpenGL time: 0.29499054 OpenGL relative to SWING is faster by 9.532944% Testing for a total of 2750000 rectangles OpenGL time: 0.34329778 Swing time: 0.38381234 OpenGL relative to SWING is faster by 11.801575% Testing for a total of 3000000 rectangles OpenGL time: 0.34859535 Swing time: 0.39274055 OpenGL relative to SWING is faster by 12.663734% Testing for a total of 3250000 rectangles Swing time: 0.4241282 OpenGL time: 0.44056854 OpenGL relative to SWING is faster by -3.7316208% Testing for a total of 3500000 rectangles Swing time: 0.4600469 OpenGL time: 0.4737318 OpenGL relative to SWING …
has title: SWING is sometimes faster than openGL
tagged with: swing
type: AnsweredQuestion
score: 0
tagged with: opengl
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/q/25239801
tagged with: sql
has title: Hibernate error : unexpected end of subtree select TIMEDIFF
tagged with: java
tagged with: hibernate
answer count: 1
accepted answer: http://stackoverflow.com/a/25240111
tagged with: mysql
has answer: http://stackoverflow.com/a/25240111
type: Question
has body: when I use the below query in mysql db, it returns me difference time. SELECT TIMEDIFF('2007-12-31 10:02:00','2007-12-30 12:01:01'); But when I use the same query in hibernate (hql), it throws me the below error Query : hql="SELECT TIMEDIFF('2007-12-31 10:02:00','2007-12-30 12:01:01')"; query = session.createQuery(hql); Error: unexpected end of subtree [SELECT TIMEDIFF('2007-12-31 10:02:00','2007-12-30 12:01:01')] Can anybody let me know a solution on this to find the timedifference
has comment: http://stackoverflow.com/comment/39319879
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39320037

http://stackoverflow.com/q/25247822
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25249092
tagged with: cursor
has title: Java, MongoDB Convert Cursor to an Array
has answer: http://stackoverflow.com/a/25251520
tagged with: mongodb
has body: I'm using MongoDB with the Java driver. I've written a query that finds the minimum year for each region in the data. Full code: public void minYearPerRegion() { for (int i = 0; i &lt; uniqueRegions.size(); i++) { BasicDBObject query = new BasicDBObject("Region", uniqueRegions.get(i)); BasicDBObject field = new BasicDBObject("Year", 1) .append("Region", 1) .append("Population", 1); cursor = coll.find(query,field).sort(new BasicDBObject("Year",1)).limit(1); try { List&lt;DBObject&gt; documents = new ArrayList&lt;DBObject&gt;(); for (DBObject dbObject : cursor) { DBObject o = cursor.next(); documents.add(o); } System.out.println("Document contains: " + documents.size() + " document/s"); } finally { cursor.close(); }//end finally }//end for }//end minYearPerRegion I'm trying to store my findings as individual documents but the cursor seems to present it as object. I've tried to split the object doing the following: List&lt;DBObject&gt; documents = new ArrayList&lt;DBObject&gt;(); for (DBObject dbObject : cursor) { DBObject o = cursor.next(); documents.add(o); } System.out.println("Document contains: " + documents.size() + " document/s"); However the print line always says the documents list only contains one documents when it should contain 4 (as there are 4 unique regions). Please tell me how to get each document individually from the cursor and store it in an Array or List.
answer count: 2
type: UnansweredQuestion
downvote count: 0
tagged with: loops
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39496788
has text: @SotiriosDelimanolis,thanks ,I wasn't planning of mocking X,I was just giving an example.
comment on: http://stackoverflow.com/q/25334486
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39583984
score: 0
has text: Sorry - I'm confused... you say to last SUB-TOTAL or to TAX... Is TAX after SUB-TOTAL like in the example? Then this answer gives you exactly that.
comment on: http://stackoverflow.com/a/25381746
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39434454
type: Comment
has text: You should have told earlier that you had written some code.. Voting to reopen.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25301474

http://stackoverflow.com/q/25246578
upvote count: 4
has answer: http://stackoverflow.com/a/27696177
answer count: 3
tagged with: activemq-classic
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39354846
downvote count: 0
has comment: http://stackoverflow.com/comment/39355359
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39354686
has title: Issues installation HermesJMS on OSX
has answer: http://stackoverflow.com/a/41604451
has answer: http://stackoverflow.com/a/41559216
has comment: http://stackoverflow.com/comment/39354955
tagged with: java
tagged with: jms
tagged with: macos
has body: I am currently having huge issues installing HermesJMS (1.14 or 1.15) on OSX 10.9.2 Downloading the dmg file from their site fails with an error saying the .app file is damaged So I download the jar file, with the installation being successful. I downloaded the jar files from here: 1.14 1.15 I then switch to the terminal and run the hermes.sh in the bin directory and I get the following error ~$ ./hermes.sh Exception in thread "main" java.lang.ExceptionInInitializerError at com.jidesoft.swing.SplashScreen.create(Unknown Source) at hermes.browser.HermesBrowser.main(HermesBrowser.java:224) Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.awt.RenderingHints at com.jidesoft.swing.JideSwingUtilities.&lt;clinit&gt;(Unknown Source) ... 2 more Here are my java versions: ~$ java -version java version "1.7.0_55" Java(TM) SE Runtime Environment (build 1.7.0_55-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode) Does anyone have a clue as to why this is so? I am basically wanting to use it to view a ActiveMQ topic Any help would be much appreciated Thanks
has comment: http://stackoverflow.com/comment/39353247
score: 4

http://stackoverflow.com/comment/39425161
comment on: http://stackoverflow.com/q/25296388
type: Comment
type: QuestionComment
has text: You need to close before you return true/false, or put the close in a finally block.
score: 8

http://stackoverflow.com/q/25259864
answer count: 2
has comment: http://stackoverflow.com/comment/39357699
upvote count: 2
has answer: http://stackoverflow.com/a/27671942
downvote count: 0
has comment: http://stackoverflow.com/comment/39357556
has comment: http://stackoverflow.com/comment/39357538
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39357670
has comment: http://stackoverflow.com/comment/39369055
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39366255
has body: I am attempting to use the addTo* method in Grails one class to another. These classes have a many to many relationship. I have defined the hasMany in the first class.. static hasMany = [operators: Operator] And have done the same in the other: static hasMany = [matches: MatchDB] And I have set the owner of the relationship: static belongsTo = MatchDB However, when I attempt to access addToOperators, as follows: def matchDBInstance = MatchDB.get(result.matchId); Operator operatorInstance = Operator.get(result.operatorId); matchDBInstance.addToOperators(operatorInstance); matchDBInstance.save(flush: true); I am seeing the following error: groovy.lang.MissingMethodException: No signature of method: footballservices.MatchDB.addToOperators() is applicable for argument types: (footballservices.Operator) values: [footballservices.Operator : Op1] Possible solutions: getOperators() at footballservices.RestfulController.mapOperator(RestfulController.groovy:63) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53) at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49) at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82) at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) I have tried.. I've spent some time trawling through the internet. I have ran grails clean, which didn't help. I have also attempted to add: List&lt;Operator&gt; operators; to the MatchDB clas…
has answer: http://stackoverflow.com/a/26559990
tagged with: grails
has comment: http://stackoverflow.com/comment/39359216
score: 2
has comment: http://stackoverflow.com/comment/39366375
has title: Missing addTo Method

http://stackoverflow.com/a/25304316
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25304272
has body: All such things are described in DataInputStream/DataOutputStream java classes a long time ago. More specifically in your task it will be: return (short)(((int)(buffer[0] &amp; 0xff) &lt;&lt; 8) + ((int)(buffer[1] &amp; 0xff) &lt;&lt; 0));

http://stackoverflow.com/comment/39617165
has text: Did you `import java.util.ArrayList`?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25376107
score: 0

http://stackoverflow.com/comment/39549753
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25364451
type: Comment
has text: I can't even build the application. I get an "MainForm can't be resolved to a type". This works if I use in any place of my java code, but don't work in the jsp/jstl code.

http://stackoverflow.com/comment/39520995
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25348702
has text: @BackSlash Yeah, my bad. I've just found an article here at stackoverflow http://stackoverflow.com/questions/301563/difference-fnstring-args-vs-fnstring-args you are totally right, as I said I'm entry level, but I will take note of this. Thank you :)
type: Comment

http://stackoverflow.com/a/25247856
accepted answer of: http://stackoverflow.com/q/25247762
upvote count: 2
answers question: http://stackoverflow.com/q/25247762
score: 2
has comment: http://stackoverflow.com/comment/39335764
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39335602
has comment: http://stackoverflow.com/comment/39335109
has body: Stop converting the values to strings and back. A java.sql.Timestamp already is a java.util.Date: long now = System.currentTimeMillis(); while (rs.next()) { Timestamp ts = rs.getTimestamp("HIGH_VALUE"); long diff = ts.getTime() - now; ... use diff ... } You should only be dealing with strings when you fundamentally want to do so. In this case, "finding the difference between a stored timestamp and the current time" has nothing to do with a string representation.
type: Answer

http://stackoverflow.com/q/25352728
has body: I've got an assignment for a computer science class. I've been thinking about the answer for more than two weeks now without success so I decided to give it a try in here. The game consists of 4 CIA agents using 4 adjacent telephone booths. They arrive at the set of booths one at a time, following certain rules: 1 - An agent chooses a booth that has its two neighbouring booths unoccupied (this includes the booths at the edges of the set); 2 - If the condition above isn't met, the agent chooses a booth that has only one neighbouring booth unoccupied; and 3 - If both conditions fail, the agent chooses any booth. There are eight different ways of occupying the booths given 4 agents and 4 booths, according to the rules. An example: agent #1 occupies the first booth (the left edge one), then agent #2 occupies the third booth (from left to right), then agent #3 occupies the fourth booth and finally agent #4 occupies the second booth. We are asked to write a code that counts the number of ways that 19 agents occupy 19 booths, according to these rules. My natural choice for this problem was creating an array of boolean, in which false represents a vacant booth and true represents an occupied booth: public class AgentGame { private boolean[] booths; private int numberOfBooths, counter; public AgentGame(int nb) { counter = 0; numberOfBooths = nb; booths = new boolean[numberOfBooths]; } I've been trying to think of a way of implementing two methods, one for filling the booths according to the rules and another one for counting all the different combinations in which the booths can be occupied. But I wasn't able to figure it out, not yet. Any ideas here? Thanks in advance.
possible better answer: http://stackoverflow.com/a/25353331
tagged with: arrays
has answer: http://stackoverflow.com/a/25353331
downvote count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
has title: Combinatorial game in java
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/25353250
has answer: http://stackoverflow.com/a/25353250
tagged with: combinatorics
tagged with: boolean
has comment: http://stackoverflow.com/comment/39528436
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/39555777
type: QuestionComment
comment on: http://stackoverflow.com/q/25367448
has text: See if this [link](http://stackoverflow.com/questions/25366924/generate-json-from-java-for-flexigrid-using-json-simple-libary/25367231#25367231) can help you.
score: 0
type: Comment

http://stackoverflow.com/comment/39373196
has text: This is missing the case for `n == 0`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25268552

http://stackoverflow.com/q/25256670
tagged with: java
answer count: 1
downvote count: 0
tagged with: annotations
tagged with: web-applications
has answer: http://stackoverflow.com/a/57969803
has comment: http://stackoverflow.com/comment/48026396
favorite count: 0
type: Question
tagged with: jakarta-ee
upvote count: 2
type: UnansweredQuestion
has title: Using Annotation for Authorization Checks in Java
has body: I have some methods like the following in my Class: addOrder(long orderId){...} updateOrder(long orderId, int qty){...} deleteOrder(long orderId){...} I want add Authorization behavior to them. For example: Only if you are owner of the Order, you can updateOrder. Only if you are a paid user, you can addOrder. Only if your Order is in status 'NEW', you can deleteOrder. What is the best way to do this? Can we do this using Annotations? @checkAuthorization addOrder(long orderId){...} @checkAuthorization updateOrder(long orderId, int qty){...} @checkAuthorization deleteOrder(long orderId){...} The checkAuthorization annotation presence should itself result in a call to a custom method that i would implement where i check if this invocations is allowed or not. If not Annotations, any other best practice? If it matters this code exists in a web-application (Struts-1).
score: 2

http://stackoverflow.com/comment/39392322
score: 0
comment on: http://stackoverflow.com/q/25279129
has text: may be u r sending proplely post ur code
type: Comment
type: QuestionComment

jpa
tags question: http://stackoverflow.com/q/25252609
tags question: http://stackoverflow.com/q/25277255
tags question: http://stackoverflow.com/q/25272192
tags question: http://stackoverflow.com/q/25362540
tags question: http://stackoverflow.com/q/25382249
tags question: http://stackoverflow.com/q/25378132
tags question: http://stackoverflow.com/q/25319880
tags question: http://stackoverflow.com/q/25280815
tags question: http://stackoverflow.com/q/25383286
tags question: http://stackoverflow.com/q/25306709
tags question: http://stackoverflow.com/q/25286999
tags question: http://stackoverflow.com/q/25368515
tags question: http://stackoverflow.com/q/25362831
tags question: http://stackoverflow.com/q/25309388
tags question: http://stackoverflow.com/q/25235367
tags question: http://stackoverflow.com/q/25329965
tags question: http://stackoverflow.com/q/25387419
tags question: http://stackoverflow.com/q/25286674
tags question: http://stackoverflow.com/q/25386209
tags question: http://stackoverflow.com/q/25252541
tags question: http://stackoverflow.com/q/25267209
tags question: http://stackoverflow.com/q/25365271
tags question: http://stackoverflow.com/q/25264729
tags question: http://stackoverflow.com/q/25282567
tags question: http://stackoverflow.com/q/25361218
tags question: http://stackoverflow.com/q/25321720
tags question: http://stackoverflow.com/q/25291582
tags question: http://stackoverflow.com/q/25380392
tags question: http://stackoverflow.com/q/25298168
tags question: http://stackoverflow.com/q/25247863
tags question: http://stackoverflow.com/q/25355237
tags question: http://stackoverflow.com/q/25263468
tags question: http://stackoverflow.com/q/25267432
tags question: http://stackoverflow.com/q/25378173
tags question: http://stackoverflow.com/q/25361304
tags question: http://stackoverflow.com/q/25295054
tags question: http://stackoverflow.com/q/25255599
tags question: http://stackoverflow.com/q/25264994
tags question: http://stackoverflow.com/q/25251111
tags question: http://stackoverflow.com/q/25311090
tags question: http://stackoverflow.com/q/25344826
tag name: jpa
tags question: http://stackoverflow.com/q/25379762
tags question: http://stackoverflow.com/q/25239440
tags question: http://stackoverflow.com/q/25286745
tags question: http://stackoverflow.com/q/25360336
tags question: http://stackoverflow.com/q/25252995
tags question: http://stackoverflow.com/q/25322550
tags question: http://stackoverflow.com/q/25262338
tags question: http://stackoverflow.com/q/25255183
tags question: http://stackoverflow.com/q/25278583
tags question: http://stackoverflow.com/q/25257117
tags question: http://stackoverflow.com/q/25274356
tags question: http://stackoverflow.com/q/25236798
tags question: http://stackoverflow.com/q/25242396
tags question: http://stackoverflow.com/q/25322658
tags question: http://stackoverflow.com/q/25338923
tags question: http://stackoverflow.com/q/25276690
tags question: http://stackoverflow.com/q/25371481
tags question: http://stackoverflow.com/q/25251014
tags question: http://stackoverflow.com/q/25236449
tags question: http://stackoverflow.com/q/25339817
tags question: http://stackoverflow.com/q/25232462
tags question: http://stackoverflow.com/q/25233029
tags question: http://stackoverflow.com/q/25245838
tags question: http://stackoverflow.com/q/25376101
tags question: http://stackoverflow.com/q/25380984
tags question: http://stackoverflow.com/q/25283198
tags question: http://stackoverflow.com/q/25249086
tags question: http://stackoverflow.com/q/25382598
tags question: http://stackoverflow.com/q/25248682
tags question: http://stackoverflow.com/q/25247001
tags question: http://stackoverflow.com/q/25262933
tags question: http://stackoverflow.com/q/25307316
type: Tag
tags question: http://stackoverflow.com/q/25236742
tags question: http://stackoverflow.com/q/25237664
tags question: http://stackoverflow.com/q/25264272
tags question: http://stackoverflow.com/q/25337069
tags question: http://stackoverflow.com/q/25379046

http://stackoverflow.com/a/25310723
answers question: http://stackoverflow.com/q/25294554
type: Answer
score: 4
has body: Try it manually by using the following ref spec: git.push().setRefSpecs(new RefSpec("+refs/*:refs/*")).call();
downvote count: 0
upvote count: 4

http://stackoverflow.com/a/25336781
has comment: http://stackoverflow.com/comment/39500865
has body: integer overflow in int literals, in your case int literals gets evaluted before and that results in negative result and than gets assigned to long sometime = 30* 24 * 60 * 60 * 1000; //a month this results in -1702967296 convert it to sometime = 30* 24 * 60 * 60 * 1000L; //a month note: L to make it long literal and then multiply Better to use Calendar class for Date manipulation Also See How to subtract X day from a Date object in Java?
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25336770
has comment: http://stackoverflow.com/comment/39500892
has comment: http://stackoverflow.com/comment/39500800
score: 5
accepted answer of: http://stackoverflow.com/q/25336770
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39428943
has text: So the issue was in how I called the mergeSort method. My new issue is how to iterate through the list. The enhanced for loop I am using does not seem to be working.
comment on: http://stackoverflow.com/a/25298113
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25252715
type: AnsweredQuestion
has body: [ { "id": 8, "name": "D.F. y Área Metropolitana", "areas": [ { "id": 15, "name": "Centro", "state_id": 8 }, { "id": 1008, "name": "Todo D.F. y Área Metropolitana", "state_id": 8 } ] } ]
score: -5
has title: How to read and parse this JSON using Jackson?
accepted answer: http://stackoverflow.com/a/25252971
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25252971
has comment: http://stackoverflow.com/comment/39344438
favorite count: 0
downvote count: 6
type: Question
has comment: http://stackoverflow.com/comment/39344446
answer count: 1
upvote count: 1
tagged with: jackson

http://stackoverflow.com/comment/39468154
type: Comment
comment on: http://stackoverflow.com/q/25319625
score: 0
has text: Get them to spend the dough and fix the certificate. It isn't worth wasting the time of an expensive software developer on this.
type: QuestionComment

http://stackoverflow.com/comment/39549905
comment on: http://stackoverflow.com/a/25362883
type: AnswerComment
score: 0
has text: It seems ObjectReader.readerForUpdating(Object valueToUpdate) api does not support updating array of objects.
type: Comment

http://stackoverflow.com/comment/39472000
has text: Sure, I'll test it and let you know.
comment on: http://stackoverflow.com/a/25292095
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39402998
score: 0
has text: Are you running a Tomcat standalone instance then? Even there, you can tell it which Java installation to use (it's somewhere in the Tomcat management window).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25284707

http://stackoverflow.com/a/25288220
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25287722
has body: I had same problem with one API that was expecting particular format (javax.xml.datatype.XMLGregorianCalendar). In my case I solve this by the help of java 7 and my_date.setTimezone(DatatypeConstants.FIELD_UNDEFINED); By doing so you can get your final result for date with 00:00:00.

http://stackoverflow.com/q/25298427
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25298817
answer count: 3
tagged with: java
has body: I'm learning Spring and I'm having some problems trying to set up a relatively basic Spring project. I'm creating an application to simply read from a database, but I'm having problems with Autowiring, or lack thereof. My GetCustomerEvent class is throwing a null pointer exception in the GetCustomers() method, as the CustomerService variable hasn't been initialised. Can someone point me in the right direction here? Application.class package org.ben.test.main; @Configuration @ComponentScan(basePackages={"org.ben.test.persistence", "org.ben.test.main"}) public class Application { @Bean public CustomerService customerService() { return new CustomerService(); } @Bean public DataSource getDataSource() { DriverManagerDataSource dmds = new DriverManagerDataSource(); dmds.setDriverClassName("org.postgresql.Driver"); dmds.setUrl("jdbc:postgresql://localhost:5432/Customers"); dmds.setUsername("postgres"); dmds.setPassword("postgres"); return dmds; } @Bean public JdbcTemplate jdbcTemplate() { DataSource ds = getDataSource(); JdbcTemplate jdbc = new JdbcTemplate(ds); return jdbc; } public static void main(String[] args) { GetCustomerEvent ev = new GetCustomerEvent(); ev.GetCustomers(); } } CustomerService.class package org.ben.test.persistence; @Component public class CustomerService { @Autowired JdbcTemplate jdbcTemplate; public CustomerService() { } public void getCustomers() { jdbcTemplate.query("SELECT * FROM Customers", new RowMapper() { @Override public Object mapRow(ResultSet arg0, int arg1) throws SQLException { System.out.println(arg0.getString("firstName")); return null; } }); } } GetCustomerEvent.class package org.ben.test.persistence; @Component public class GetCustomerEvent { @Autowired CustomerService customerService; public GetCustomerEvent() { } public void GetCustomers() { customerService.getCustomers(); } }
tagged with: jdbc
score: 1
linked to: http://stackoverflow.com/q/19896870
type: Question
possible better answer: http://stackoverflow.com/a/25298513
has title: Spring Framework Autowired Null Pointer Exception
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/25298513
downvote count: 0
linked to: http://stackoverflow.com/q/6451377
upvote count: 1
accepted answer: http://stackoverflow.com/a/25298523
tagged with: spring
favorite count: 0
has answer: http://stackoverflow.com/a/25298523
has comment: http://stackoverflow.com/comment/39429181

http://stackoverflow.com/comment/39446091
type: AnswerComment
comment on: http://stackoverflow.com/a/25307860
has text: Or use the `shutdown hook thread` http://stackoverflow.com/questions/2921945/useful-example-of-a-shutdown-hook-in-java
score: 0
type: Comment

http://stackoverflow.com/q/25327175
has answer: http://stackoverflow.com/a/25327416
has comment: http://stackoverflow.com/comment/39482252
answer count: 2
has comment: http://stackoverflow.com/comment/39482233
accepted answer: http://stackoverflow.com/a/25327312
has comment: http://stackoverflow.com/comment/39482146
tagged with: java
has answer: http://stackoverflow.com/a/25327312
upvote count: 1
has title: How to create a single 3 element collection list using three foreach loop in JAVA.?
tagged with: collections
has comment: http://stackoverflow.com/comment/39482270
downvote count: 1
favorite count: 0
type: Question
tagged with: arrays
has body: I want to create a single list which consist 3 elements, each one get value from 3 different foreach loop. for (WebElement webElement : li) { key = webElement.getText().trim().substring(10, 16) ; } //e.g {1,2,3,4,5,.......1000} for (String string : defectidList) { defectid =string; } //e.g {abc-1,abc-2,abc-3,abc-4,abc-5,......1000} for (WebElement element : hreflist) { hreflink =element.getText(); } //e.g. {abc.com,bcd.com,def.com,abc.com,bcd.com,....1000} Class Pair{ String key; String defectid; String hreflinks; Pair(String k,String d, String h){ this.key=k; this.defectid=d; this.hreflinks=h; } } ArrayList&lt;Pair&gt; pairlist = new ArrayList&lt;Pair&gt; Pair p = new Pair(key,defectid,hreflinks) pairlist.add(p) How i should add each element from each loop so that i should get pairlist as 1 abc-1 abc.com 2 abc-2 bcd.com 3 abc-3 def.com 4 abc-4 abc.com 5 abc-5 bcd.com
possible better answer: http://stackoverflow.com/a/25327416
has comment: http://stackoverflow.com/comment/39482229
tagged with: arraylist
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25373077
score: 2
upvote count: 3
downvote count: 1
has body: You could try adding a default statement to the switch, so that there is fallback for when the answer is not recognized; like that: switch (domino) { //... default: System.out.println("Sorry, I don't understand that."); break; } Furthermore, you can try printing the domino String, to see what is actually being read. System.out.println(domino); Also, a tip: you can join multiple equal case statements in a switch like so: switch (domino) { case "hello": case "hi": case "howdy": case "heyo": case "hello?": case "hey": case "sup": System.out.println("How are you?"); break; case "good": case "great": case "awesome": case "splendid": case "fantastic": case "fine": System.out.println("Glad to hear it"); break; }
type: Answer
answers question: http://stackoverflow.com/q/25372949

http://stackoverflow.com/a/25256083
type: Answer
has comment: http://stackoverflow.com/comment/39372928
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/25255950
downvote count: 1
has body: I remember having to run a key tool command... Found it here: How Do You Configure BouncyCastle For Mac OSX Maverick
has comment: http://stackoverflow.com/comment/39486591

http://stackoverflow.com/q/25386928
type: Question
has body: According to API the ceiling should return number greater then or equal to the given element or null, in the code below why ceiling of -12 is -12? NavigableSet&lt;Integer&gt; sset = new TreeSet&lt;&gt;(); sset.add(-12); sset.add(-13); sset.add(-11); sset.add(24); //why the ceiling of -12 is -12? there are number greater then -12 in the set System.out.println(sset.ceiling(-12)); System.out.println(sset.ceiling(0)); System.out.println(sset.ceiling(24)); System.out.println(sset.ceiling(100));
has title: Navigable Set ceiling on negative number
accepted answer: http://stackoverflow.com/a/25387013
possible better answer: http://stackoverflow.com/a/25387159
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25387013
answer count: 2
has answer: http://stackoverflow.com/a/25387159
tagged with: java
tagged with: set

http://stackoverflow.com/q/25264731
tagged with: java
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25264760
tagged with: regex
score: 4
upvote count: 4
has body: Is it possible to exclude the use of certain characters if another character has been found already? For example, in a phone number field 123-456-7890 and 123.456.7890 are valid, but 123-456.7890 is not. at the minute i have: static String pattern = "\\d{3}[-.]\\d{3}[-.]\\d{4}"; How can this be improved to fulfill the above requirement? To clarify, it will be used in a string, which will be compiled to a Pattern object: Pattern p = Pattern.compile(pattern); Then used in a Matcher: Matcher m = p.matcher(phoneNumber); if(m.find()){ //do stuff }
type: AnsweredQuestion
has title: Regex: Only allow a character if another character has been found in a string
downvote count: 0
accepted answer: http://stackoverflow.com/a/25264760

http://stackoverflow.com/comment/39436505
type: AnswerComment
has text: and your problem comes when you paste multiple character at once? right?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25302158

javafx
tags question: http://stackoverflow.com/q/25344354
tags question: http://stackoverflow.com/q/25266520
tags question: http://stackoverflow.com/q/25273818
tags question: http://stackoverflow.com/q/25367480
type: Tag
tags question: http://stackoverflow.com/q/25259446
tags question: http://stackoverflow.com/q/25364687
tags question: http://stackoverflow.com/q/25258167
tags question: http://stackoverflow.com/q/25282104
tags question: http://stackoverflow.com/q/25279967
tags question: http://stackoverflow.com/q/25302177
tags question: http://stackoverflow.com/q/25283168
tags question: http://stackoverflow.com/q/25309275
tags question: http://stackoverflow.com/q/25317879
tags question: http://stackoverflow.com/q/25317684
tags question: http://stackoverflow.com/q/25280693
tags question: http://stackoverflow.com/q/25307080
tags question: http://stackoverflow.com/q/25252558
tags question: http://stackoverflow.com/q/25345307
tags question: http://stackoverflow.com/q/25254769
tags question: http://stackoverflow.com/q/25353233
tags question: http://stackoverflow.com/q/25318352
tags question: http://stackoverflow.com/q/25343629
tags question: http://stackoverflow.com/q/25269247
tags question: http://stackoverflow.com/q/25384442
tags question: http://stackoverflow.com/q/25250077
tags question: http://stackoverflow.com/q/25316103
tags question: http://stackoverflow.com/q/25341533
tags question: http://stackoverflow.com/q/25383912
tags question: http://stackoverflow.com/q/25364025
tags question: http://stackoverflow.com/q/25251168
tags question: http://stackoverflow.com/q/25388378
tags question: http://stackoverflow.com/q/25276940
tags question: http://stackoverflow.com/q/25324920
tag name: javafx
tags question: http://stackoverflow.com/q/25347347
tags question: http://stackoverflow.com/q/25372599
tags question: http://stackoverflow.com/q/25307749
tags question: http://stackoverflow.com/q/25348044
tags question: http://stackoverflow.com/q/25372680
tags question: http://stackoverflow.com/q/25235135
tags question: http://stackoverflow.com/q/25337743
tags question: http://stackoverflow.com/q/25264093
tags question: http://stackoverflow.com/q/25252161

http://stackoverflow.com/q/25338376
answer count: 2
has title: CompletableFuture withFallback / handle only some errors
has answer: http://stackoverflow.com/a/25368130
downvote count: 0
tagged with: java-8
favorite count: 0
type: AnsweredQuestion
has body: I'm receiving responses from a service call via CompletableFuture. I'd like to handle some known exceptions the service returns &mdash; such as optimistic concurrency control conflicts. Here's what I've got. Is there a better way to do this which does not wrap the exceptions or use SneakyThrows? Wrapping exceptions would mean other exception handlers must inspect causal chains instead of merely using instanceof. someService.call(request) .handle((response, error) -&gt; { if (error == null) return CompletableFuture.completedFuture(response); else if (error instanceof OCCException) return CompletableFuture.completedFuture(makeDefaultResponse()); CompletableFuture&lt;Response&gt; errorFuture = new CompletableFuture&lt;&gt;(); errorFuture.completeExceptionally(error); return errorFuture; }).thenCompose(Function.identity()); Along the same vein, is there a way to replicated guava's withFallback without the wrap-unwrap? CompletableFuture&lt;T&gt; withFallback(CompletableFuture&lt;T&gt; future, Function&lt;Throwable, ? extends CompletableFuture&lt;T&gt;&gt; fallback) { return future.handle((response, error) -&gt; { if (error == null) return CompletableFuture.completedFuture(response); else return fallback.apply(error); }).thenCompose(Function.identity()); } ... // Here's the first part of the question implemented using withFallback. // It's a little cleaner, but it still requires wrapping as a future. withFallback(someService.call(request), error -&gt; { if (error instanceof OCCException) return CompletableFuture.completedFuture(makeDefaultResponse()); CompletableFuture&lt;Response&gt; errorFuture = new CompletableFuture&lt;&gt;(); errorFuture.completeExceptionally(error); return errorFuture; }); For completeness, here is what it would look like if I allowed the exceptions to be wrapped. (I've got a unit test to verify the thrown exception propagates down the chain): someService.call(request) .exceptionally(error -&gt; { if (error instanceof OCCException) return makeDefaul…
upvote count: 8
possible better answer: http://stackoverflow.com/a/25344619
tagged with: completable-future
tagged with: java
has answer: http://stackoverflow.com/a/25344619
score: 8
type: Question
accepted answer: http://stackoverflow.com/a/25368130

http://stackoverflow.com/q/25378448
has comment: http://stackoverflow.com/comment/39577271
type: Question
linked to: http://stackoverflow.com/q/2983248
has title: Communications link failure The last packet successfully received from etc
type: UnansweredQuestion
tagged with: jdbc
score: 0
has body: I have a little jsp site with a mysql DB (both hosted by a provider). From time to time i get this error when i try to connection to the DB. Communications link failure The last packet successfully received from the server was 441,197 milliseconds ago. The last packet sent successfully to the server was 26 milliseconds ago. I read several posts on the internet talking about similar problem, i but no one seems to suits my issue. Mine is a very simple site, maybe i should set some attributes in the context.xml file. I Created a context.xml similar to the one shown on the book i used to study java and jsp. Here it is: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context path="/prova" reloadable="true"&gt; &lt;Resource name="jdbc/myDataSource" auth="Container" type="javax.sql.DataSource" url="..." username="..." password="..." driverClassName="com.mysql.jdbc.Driver"/&gt; &lt;/Context&gt; the way i "query" the DB is this: 1) i open the connection 2) i make the select 3) i close connection, statement and resultset I use mysql-connector-java-5.1.17-bin.jar
has comment: http://stackoverflow.com/comment/39577260
answer count: 0
tagged with: sql
tagged with: java
has comment: http://stackoverflow.com/comment/39577001
tagged with: mysql
tagged with: jsp
has comment: http://stackoverflow.com/comment/39577515
has comment: http://stackoverflow.com/comment/39576974
has comment: http://stackoverflow.com/comment/39579478

http://stackoverflow.com/a/25303982
answers question: http://stackoverflow.com/q/25274197
type: AcceptedAnswer
has body: I find the answer how can I solve this problem it can solve easily by adding animFadeout.setFillAfter(true); it works very well right now. ;)
score: 0
accepted answer of: http://stackoverflow.com/q/25274197
type: Answer

http://stackoverflow.com/a/27830760
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25389158
has body: When it wants to scale down, AWS Auto Scaling will terminate your EC2 instances without warning. There's no way to allow any queue workers to drain before terminating. If your workers are processing messages transactionally, and you're not deleting messages from SQS until after they have been successfully processed, then this shouldn't be a problem. The processing will stop when the instance is terminated, and the transaction will not commit. The message won't be deleted from the SQS queue, and can be picked up and processed by another worker later on. The only kind of draining behavior it supports is HTTP connection draining from an ELB: "If connection draining is enabled for your load balancer, Auto Scaling waits for the in-flight requests to complete or for the maximum timeout to expire, whichever comes first, before terminating instances".
type: Answer

http://stackoverflow.com/comment/39412685
comment on: http://stackoverflow.com/q/25284967
type: Comment
type: QuestionComment
score: 0
has text: can you please show ur code

http://stackoverflow.com/comment/39494451
comment on: http://stackoverflow.com/a/25319954
type: Comment
score: 0
type: AnswerComment
has text: Man, I can't thank you enough. It will take some time to figure all this out and to learn from it, especially with dialogs. I'll give my best. :D Btw., you think I should use JTree? Ok, I can create parent-child relationship, but can I create, for example, man-wife relation via JTree?

http://stackoverflow.com/q/25259165
has title: Entire Tiles layout loaded in a tile on ajax failure
has body: Am not sure if i had pinned a proper title, though here goes my issue: I have a tiles layout with a header, body and footer. I use ajax request to get any data from server and populate on jsp using jquery. On server side (Spring 3.1.2), i have used @ExceptionHandler provided by Spring as below: @ExceptionHandler(Exception.class) public ModelAndView handleAllException(Exception ex) { ModelAndView model = new ModelAndView("error"); model.addObject("errMsg", ex.getMessage()); return model; } And the tiles definition for error will be as: &lt;definition name="error" template="/WEB-INF/jsp/layout.jsp"&gt; &lt;put-attribute name="header" value="/WEB-INF/jsp/header.jsp" /&gt; &lt;put-attribute name="body" value="/WEB-INF/jsp/error.jsp" /&gt; &lt;put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" /&gt; &lt;/definition&gt; So, this works good, as when any exception thrown in the application, the user will be redirected to error.jsp, where he will displayed with the error details. NOW, comes the actual problem. In body (in one of the jsp), i have a few search fields, after entering which user could click on 'Search' to get the results and this transaction happens as an ajax request. When there is any service exception raised during this ajax transaction, the exception is still handled by the ExceptionHandler and the response is routed to the error view. But on the UI, in the body part, entire template is getting loaded such that there is a 'header', 'footer' and the error page in the body part. if you could visualize, its like an entire screen within the body. To avoid this, i tried response.redirect() inside the exception handler (also inside the catch{} block) to render the entire page again with error jsp. But nothing worked out...!!! Request some help on this issue. TIA, Prince
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25259667
tagged with: spring
tagged with: ajax
score: 0
tagged with: exception
tagged with: tiles
tagged with: java
answer count: 1

http://stackoverflow.com/a/25283565
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/25283140
has body: For such case i suggest you to use catch-exception library from Google, code sample (from their homepage): import static com.googlecode.catchexception.CatchException.*; import static com.googlecode.catchexception.apis.CatchExceptionBdd.*; // given: an empty list List myList = new ArrayList(); // when: we try to get the first element of the list when(myList).get(1); // then: we expect an IndexOutOfBoundsException then(caughtException()) .isInstanceOf(IndexOutOfBoundsException.class) .hasMessage("Index: 1, Size: 0") .hasNoCause(); See also catch-exception AssertJ api if above example is not enough.
type: Answer
score: 2

http://stackoverflow.com/q/25332168
score: 0
linked to: http://stackoverflow.com/q/7552596
linked to: http://stackoverflow.com/q/409932
has comment: http://stackoverflow.com/comment/39492410
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39492884
has comment: http://stackoverflow.com/comment/39492448
favorite count: 0
type: Question
tagged with: timer
has body: Hi guys I have to create a timer that every 2 seconds repeat a part of my code, can you tell me the code? I don't need the graphic on this timer.
has comment: http://stackoverflow.com/comment/39492160
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39493394
tagged with: swt
has answer: http://stackoverflow.com/a/25332383
tagged with: repeat
upvote count: 1
downvote count: 1
has title: How to create a Timer in swt java

http://stackoverflow.com/comment/39822158
has text: I used `containsAll` in the end. But I want to know how to use the Hamcrest library. It claims it can compare two collections but I am struggling to get it working.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25481724
type: Comment

http://stackoverflow.com/comment/39330517
comment on: http://stackoverflow.com/q/25245421
score: 0
has text: @JonSkeet:: Can you please confirm is that approach wrong? I am getting byte...taking it as string,and then getting the bytes out of it and sending them.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39551048
comment on: http://stackoverflow.com/q/25365184
has text: (Additionally, please put more effort into formatting your code. Look at the preview before you post.)
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25299009
accepted answer: http://stackoverflow.com/a/25299053
type: Question
tagged with: sockets
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/25299043
has answer: http://stackoverflow.com/a/25299043
has answer: http://stackoverflow.com/a/25299053
type: AnsweredQuestion
score: 0
tagged with: tcp
tagged with: java
has title: Android tcp socket can not receive data
has body: I am trying to work with sockets in android programming, sending to the server works fine but i have problems with receiving a string from the server. the socket is connected, but if the server is sending a string the android app only prints out: java.io.BufferedReader@418daee0 i dont know what that mean..is it an error or something like that? this is my code: Maybe someone could help me a little bit to get that work. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Client extends Activity { private Socket socket; private static final int SERVERPORT = 2000; private static final String SERVER_IP = "192.168.1.1"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); new Thread(new ClientThread()).start(); } class ClientThread implements Runnable { @Override public void run() { try { InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr, SERVERPORT); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } try { InputStream in = socket.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String test = br.toString(); TextView message = (TextView) findViewById(R.id.received); message.setText(test); //in.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } }

http://stackoverflow.com/q/25235466
downvote count: 0
tagged with: mysql
has body: In JDBCTemplate, I'm calling public &lt;T&gt; List&lt;T&gt; query(String sql, Object[] args, RowMapper&lt;T&gt; rowMapper) throws DataAccessException { return query(sql, args, new RowMapperResultSetExtractor&lt;T&gt;(rowMapper)); } with getJdbcTemplate().query(usersByUsernameQuery, new String[] {username}, new RowMapper&lt;UserDetails&gt;() My problem is I only have access to the usersByUsernameQuery argument, and I want to use the 'username' variable twice in it. For example: usersByUsernameQuery = "Select * from ... ... where someColumn=? or anotherColumn=?" Since I'm only passing a string array with one element (username), how should I build my query?
linked to: http://stackoverflow.com/q/1327074
has title: JDBCTemplate query use arguments many times
tagged with: jdbctemplate
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25235824
type: Question
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: sql
has answer: http://stackoverflow.com/a/25235824
tagged with: java

http://stackoverflow.com/comment/39338100
type: AnswerComment
has text: I dont understand. I want the condition of done to become true when the user says it is true.
comment on: http://stackoverflow.com/a/25248887
type: Comment
score: 0

http://stackoverflow.com/a/25270858
has comment: http://stackoverflow.com/comment/39377987
answers question: http://stackoverflow.com/q/25270399
type: AcceptedAnswer
has body: I tried this code and works as expected: public class SimpleServer implements Runnable { static ServerSocket serverSocket; public static void main(String[] args) throws IOException { serverSocket = new ServerSocket(8000); Thread t = new Thread(new SimpleServer()); t.start(); } @Override public void run() { while (true) { try (Socket socket = serverSocket.accept(); DataInputStream in = new DataInputStream(socket.getInputStream()); //this is too much noise //you can directly wrap the result from socket.getInputStream() //into the BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(in) )) { System.out.println("request from browser client:"); String line; //reads and prints every line from the request while ( (line = br.readLine()) != null) { System.out.println(line); } } catch (IOException ioe) { ioe.printStackTrace(); } } } } Now you just need to write an appropriate response for your client. More info: A Simple Http Server with Java/Socket? simple HTTP server in Java using only Java SE API
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25270399

http://stackoverflow.com/comment/73493330
has text: Spring Boot will, by default, permit access to `/css/**`, `/js/**`, `/images/**`, and `/**/favicon.ico`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25368637
score: 1

http://stackoverflow.com/q/25284620
tagged with: nested-loops
tagged with: java
accepted answer: http://stackoverflow.com/a/25330898
has comment: http://stackoverflow.com/comment/39402944
has body: So basically, I need to search for the next empty value of an index (which is designated as 0), and replace the whole row with a variety of information. for instance, if there is a blank element in the third row, instead of "0, 0, 0 ,0" it will be "(row number), a, b, c". This is what i have so far and i just get a long line of run-time errors String[][] clientsArray = new String[20][4]; int rows = 20; int columns = 4; for (int r = 0; r &lt; rows ; r++ ) { for (int c = 0; c &lt; columns ; c++ ) { if (clientsArray[r][c].equals ("0")) { String key = Integer.toString(r); clientsArray[r][0] = key; clientsArray[r][0+1] = "a" clientsArray[r][0+2] = "b" clientsArray[r][0+3] = "c" break; } } } At the moment, the whole 2d array is filled with '0's, I just haven't included that section of code. **note: i have changed the values which were 'c' to 0
has comment: http://stackoverflow.com/comment/39403264
type: AnsweredQuestion
score: 0
tagged with: arrays
answer count: 1
has title: scanning for next empty value in a 2d array and replacing values in the row
type: Question
has comment: http://stackoverflow.com/comment/39403192
has answer: http://stackoverflow.com/a/25330898
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/39402756

http://stackoverflow.com/a/25327071
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25326661
accepted answer of: http://stackoverflow.com/q/25326661
type: Answer
has body: You are trying to execute update with the string although you have already created the statement. You have to use: preparedStatement.executeUpdate();
score: 0

http://stackoverflow.com/a/71770603
answers question: http://stackoverflow.com/q/25357518
score: 0
has body: I had a problem with the following: In my html that I set in the login settings I didn't put / In the end I was able to but it should have been As a result, i could not login > got a 302 redirect error > and redirected again to a broken login page. This is what the full working page looks like. Login customer Login Username Password Sign in
type: Answer

http://stackoverflow.com/a/25239503
downvote count: 0
has comment: http://stackoverflow.com/comment/39319604
has comment: http://stackoverflow.com/comment/39320455
has comment: http://stackoverflow.com/comment/39319362
has comment: http://stackoverflow.com/comment/39351265
has comment: http://stackoverflow.com/comment/39319348
has comment: http://stackoverflow.com/comment/39319187
has comment: http://stackoverflow.com/comment/39320392
type: Answer
answers question: http://stackoverflow.com/q/25239432
score: 2
has body: NullPointerExceptions occur if you try to access a field or a method from something that is null. In the line you marked, you try to access the length property of samples. So chances are high that samples is null.
upvote count: 2

http://stackoverflow.com/comment/39427432
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25297407
has text: great answer however i had actually returned the value it was a silly mistake in which i was accessing the doInBackground method again in the onPostExecute which was completely useless as this is called when i execute asyncTask anyways. I see my error but thank you very much for the answer

http://stackoverflow.com/q/25369715
has comment: http://stackoverflow.com/comment/39560441
has comment: http://stackoverflow.com/comment/39560245
has comment: http://stackoverflow.com/comment/39564268
has comment: http://stackoverflow.com/comment/39560412
has comment: http://stackoverflow.com/comment/39560373
has comment: http://stackoverflow.com/comment/39560454
has comment: http://stackoverflow.com/comment/39560114
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39560331
has comment: http://stackoverflow.com/comment/39560358
has title: Bug in Comparator Class
tagged with: comparator
has comment: http://stackoverflow.com/comment/39560438
has comment: http://stackoverflow.com/comment/39560378
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25371738
has body: I have implemented a comparator class which sorts an array of objects, or "Persons", in my case. However, there seem to be a few bugs, so when I click the next button of my GUI, I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at RectangleProgram$CustomComparator.compare(RectangleProgram.java:30) at RectangleProgram$CustomComparator.compare(RectangleProgram.java:26) at java.util.TimSort.binarySort(TimSort.java:265) at java.util.TimSort.sort(TimSort.java:208) Here are snippets of the code that are relevant: public class Person//HERE IS THE OBJECT THE COMPARATOR IS REFERRING TO { String firstname; String lastname; int z; public Person(String l, String m, int e) { firstname=l; lastname=m; z=e; } public String getFirstName() { return firstname; } } public class CustomComparator implements Comparator&lt;Person&gt; { // COMPARATOR BEGINS HERE @Override public int compare(Person object1, Person object2) { return object1.getFirstName().compareTo(object2.getFirstName()); } } // COMPARATOR ENDS HERE public static Person [] arr=new Person [100]; // ARRAY TO BE SORTED // class implementing the sort public class re implements ActionListener { public void actionPerformed (ActionEvent e) { if (counter==0) { getData(); Arrays.sort(arr, new CustomComparator()); } } } Could someone tell me what is wrong with the code, and is causing the error? Note, it is not a compilation error, it is just that clicking the next button [of which class re is the action listener] does not make it do anything.
favorite count: 0
has comment: http://stackoverflow.com/comment/39560926
has comment: http://stackoverflow.com/comment/39560485
has comment: http://stackoverflow.com/comment/39560341
tagged with: debugging
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
score: 1
has comment: http://stackoverflow.com/comment/39560152
tagged with: java
accepted answer: http://stackoverflow.com/a/25371738
has comment: http://stackoverflow.com/comment/39560404

http://stackoverflow.com/comment/123132050
type: AnswerComment
comment on: http://stackoverflow.com/a/27258414
score: 3
type: Comment
has text: Can mention keys like this `@CacheEvict(value = { "cache1", "cache2" }, key = "key")`

sockets
tags question: http://stackoverflow.com/q/25234619
tags question: http://stackoverflow.com/q/25286348
tags question: http://stackoverflow.com/q/25246346
tags question: http://stackoverflow.com/q/25303751
tags question: http://stackoverflow.com/q/25260668
tags question: http://stackoverflow.com/q/25306124
tags question: http://stackoverflow.com/q/25341563
tags question: http://stackoverflow.com/q/25299009
tags question: http://stackoverflow.com/q/25322452
tags question: http://stackoverflow.com/q/25377578
tags question: http://stackoverflow.com/q/25249661
tags question: http://stackoverflow.com/q/25316550
tags question: http://stackoverflow.com/q/25259911
tags question: http://stackoverflow.com/q/25363641
tags question: http://stackoverflow.com/q/25361086
tags question: http://stackoverflow.com/q/25239436
tags question: http://stackoverflow.com/q/25269771
tags question: http://stackoverflow.com/q/25291952
tags question: http://stackoverflow.com/q/25364505
tags question: http://stackoverflow.com/q/25377242
tag name: sockets
tags question: http://stackoverflow.com/q/25369708
tags question: http://stackoverflow.com/q/25236977
tags question: http://stackoverflow.com/q/25261224
tags question: http://stackoverflow.com/q/25372515
tags question: http://stackoverflow.com/q/25276964
tags question: http://stackoverflow.com/q/25332101
tags question: http://stackoverflow.com/q/25380162
tags question: http://stackoverflow.com/q/25237064
tags question: http://stackoverflow.com/q/25256529
tags question: http://stackoverflow.com/q/25284724
tags question: http://stackoverflow.com/q/25248612
tags question: http://stackoverflow.com/q/25362049
tags question: http://stackoverflow.com/q/25282126
type: Tag
tags question: http://stackoverflow.com/q/25278033
tags question: http://stackoverflow.com/q/25299349
tags question: http://stackoverflow.com/q/25328892
tags question: http://stackoverflow.com/q/25255806
tags question: http://stackoverflow.com/q/25356004
tags question: http://stackoverflow.com/q/25330071
tags question: http://stackoverflow.com/q/25368907

http://stackoverflow.com/a/25251150
has comment: http://stackoverflow.com/comment/39353585
type: AcceptedAnswer
score: 6
accepted answer of: http://stackoverflow.com/q/25250791
answers question: http://stackoverflow.com/q/25250791
has body: ConcurrentHashMap guarantees this: The view's iterator is a "weakly consistent" iterator that will never throw ConcurrentModificationException, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction. What this means is that in the worst case scenario, an update made by one thread won't be seen by the second one until its next iteration. Let's look at what that means for your application: If a new server is added by the synchronization thread while the pinging thread is running, it might not be pinged at this iteration. It will be pinged only in the next iteration, after 15 seconds. That doesn't seem to be a problem as long as you take this behavior into account (i.e. if you don't run a third thread that removes anything that hasn't been pinged in the last 15 seconds or something similar) If a server is deleted by the synchronization thread while pinging is in progress, the server might still be pinged, but the server's record will still be deleted from the cache. Again, not a problem. If the pinging thread removes a server while synchronization is in progress, the synchronization thread might still see that server in the cache. Again, I don't think that's a problem.
upvote count: 6
type: Answer
has comment: http://stackoverflow.com/comment/39359266
downvote count: 0

http://stackoverflow.com/q/25280911
downvote count: 0
answer count: 3
type: UnansweredQuestion
has title: How to read XML server response in JavaScript?
tagged with: javascript
has answer: http://stackoverflow.com/a/25281246
favorite count: 0
type: Question
tagged with: ajax
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39395926
linked to: http://stackoverflow.com/q/649614
tagged with: java
has answer: http://stackoverflow.com/a/25281198
has answer: http://stackoverflow.com/a/25281072
has comment: http://stackoverflow.com/comment/39395652
tagged with: http://stackoverflow.com/tag/xml
has body: I work on a web project and at this point I need to pass a hard-coded xml from Java to JavaScript to parse that xml; the problem is that I don't know exactly how to do this. As shown below, my xml is stored in a String variable, so I need to pass this variable to JavaScript. I'm using tomcat as a server. Java Code - that creates xml: @Path("/getXml") @GET @Produces(MediaType.TEXT_XML) @Consumes(MediaType.TEXT_PLAIN) public String getXml(@Context HttpServletRequest request) throws TransformerConfigurationException, TransformerException{ try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document document = docBuilder.newDocument(); Element rootElement = document.createElement("news-counts"); document.appendChild(rootElement); int j=12; for(int i=1; i&lt;10; i++) { Element item = document.createElement("item"); rootElement.appendChild(item); item.setAttribute("count", "" + j); item.setAttribute("date", "201408" + "0" + i); j=j+2; } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); // transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); StringWriter writer = new StringWriter(); transformer.transform(new DOMSource(document), new StreamResult(writer)); String xmlOutput = writer.getBuffer().toString().replaceAll("\n|\r", ""); // return Response.status(Status.NOT_ACCEPTABLE).entity("xmlOutput").build(); //System.out.println(xmlOutput); return xmlOutput; } catch (ParserConfigurationException ex) { Logger.getLogger(Searcher.class.getName()).log(Level.SEVERE, null, ex); } finally { return null; } } JavaScript code - how I tried to acces the xmlOutput variable function test() { var r=new XMLHttpRequest(); r.open("GET", "http://localhost:8080/WebApplication6/tavi/searcher/getXml" , false); r.send(); var responseText = r.responseText; alert(responseText); }

http://stackoverflow.com/q/25293368
type: Question
has comment: http://stackoverflow.com/comment/39419595
tagged with: return
has comment: http://stackoverflow.com/comment/39419068
has comment: http://stackoverflow.com/comment/39420095
has answer: http://stackoverflow.com/a/25293834
tagged with: android
has comment: http://stackoverflow.com/comment/39419556
has comment: http://stackoverflow.com/comment/39419222
has comment: http://stackoverflow.com/comment/39419256
has comment: http://stackoverflow.com/comment/39420305
has comment: http://stackoverflow.com/comment/39420089
score: -1
has comment: http://stackoverflow.com/comment/39419023
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39419024
has comment: http://stackoverflow.com/comment/39419502
has comment: http://stackoverflow.com/comment/39419259
accepted answer: http://stackoverflow.com/a/25293834
tagged with: java
has comment: http://stackoverflow.com/comment/39419085
has comment: http://stackoverflow.com/comment/39419151
has comment: http://stackoverflow.com/comment/39419064
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39419030
has body: I've developed an android application, I know that return; within a void return method would break out of the flow. But, the android application does not return instead it continues to execute the code next to this block eg: public static void displayImage(String img){ if(img.contains("http")){ loadImage(img); return; } Uri uri = Uri.parseUri(img); // even though it hit the return statement above, it continued to this block ..... } Even though the return; is executed, it continues to call the methods that are next to this block. Is it my compilation problem? or is it the way Java in Android works when debugging? I'm stumped please help me understand. Update: The method is a static method, just to be precise Detailed explanation I have dropbox support for my android application, as per the chooser api I have implemeneted the following in my MainActivity.java @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == DBX_CHOOSER_REQUEST) { if (resultCode == Activity.RESULT_OK) { DbxChooser.Result result = new DbxChooser.Result(data); .. ContentHelper.displayImage(result.getData().toString()); } else { // Failed or was cancelled by the user Now in my ContentHelper.java public static void displayImage(String img){ if(img.contains("http")){ loadImage(img); return; } Uri uri = Uri.parseUri(img); // even though it hit the return statement above, it continued to this block ..... //load some activity etc., } Because this displayImage is capable of loading images from SD card and any link that it is given it has if block and return statements. (I know I can put if .. else and create a work on it. But my question is why did it not break at return;) Thanks.
has comment: http://stackoverflow.com/comment/39419005
favorite count: 0
has title: Java and Void return statement

http://stackoverflow.com/q/25380329
has comment: http://stackoverflow.com/comment/39580812
type: Question
type: AnsweredQuestion
has body: I have some troubles with deployment project configuration in PhpStorm7.0 (I have the same problem in IDE WebStrom) When I trying to connect through ftp - everything fine. But if choice sftp - I have this error: Test SFTP Connection Connection to 'echuvelev.ihc.ru' Java.lang.ArrayIndexOutOfBoundsException Logs: 2014-08-19 14:06:29,038 [ 73753] WARN - loyment.ui.WebServerConfigForm - Could not connect to SFTP server at "sftp://echuvelev.ihc.ru/". org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp://echuvelev.ihc.ru/". at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:108) at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:102) at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:80) at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:64) at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:698) at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:624) at com.jetbrains.plugins.webDeployment.connections.RemoteConnectionPool.createConnection(RemoteConnectionPool.java:139) at com.jetbrains.plugins.webDeployment.connections.RemoteConnectionManager.openConnection(RemoteConnectionManager.java:103) at com.jetbrains.plugins.webDeployment.PublishUtils$1$1.run(PublishUtils.java:115) at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:420) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadP…
accepted answer: http://stackoverflow.com/a/25381063
has answer: http://stackoverflow.com/a/25381063
tagged with: sftp
has comment: http://stackoverflow.com/comment/39580083
score: 1
tagged with: java
tagged with: phpstorm
answer count: 1
downvote count: 0
upvote count: 1
tagged with: ide
has title: PhpStrom7 SFTP Connection failed
favorite count: 0
tagged with: synchronization

http://stackoverflow.com/a/25241968
has body: You have not reinitialized your StringBuffer variable response. In addition, you don't really need to use StringBuffer, since you are not manipulating the string information. I suggest you try the following (and at some point you won't want to use localhost): URL url = new URL("http://localhost:9090/service.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); int i = 0; ArrayList&lt;String&gt; arr = new ArrayList&lt;String&gt;(); while ((line = reader.readLine()) != null) { arr.add(line); // debug information System.out.println(arr.get(i)); i++; }
answers question: http://stackoverflow.com/q/25241635
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/q/25285681
tagged with: jsp
has answer: http://stackoverflow.com/a/25286408
tagged with: image
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25286408
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has title: How to Fetch data by clicking image
answer count: 1
has comment: http://stackoverflow.com/comment/39405654
type: Question
tagged with: href
has body: I have the following code in edit.jsp <% while (rs.next()) { %> <%=rs.getString(1)%> //for text box name <%=rs.getString(2)%> //for text box address <%=rs.getString(3)%> //for text box origin while clicking the image/editdetail.png i am redirecting the page to create.jsp, where i have three text boxes("name", "address" and "origin"). how to get the getString value also getting displayed in the text box when i click the png image, so that i can edit the details.

http://stackoverflow.com/q/25282244
has comment: http://stackoverflow.com/comment/39419385
has body: Is there any way in Java to avoid instantiating a stateless object? There is no real difference between a static function and a stateless object for example: class CompareInts { Integer compare(Integer a, Integer b) { return a.compareTo(b); } static Integer compare(Integer a, Integer b) { return a.compareTo(b); } Functionality wise these two alternatives do the same thing and in general every stateless class can be converted to a static function. There are two main differences though: Instantiating a static class takes both time and memory where neither are needed. You only really need to store the code you don't need to allocate an object on the heap and a pointer to a vtable. static functions are very limited in Java. They can not be used with Generics, the static compare can never be used by a class that must receive a compare. Therefore a static function is better in theory because it provides all the functionality of a stateless class but without the runtime and memory overheads. A static function is much less powerful in Java because it can't be called through a Generic type. Is there any way to benefit from both worlds? Edit I want to write a generic class as follows: class Array&lt;Type, Comparator&gt; { Type[] elements; // array stuff Type getMax() { Type maxElement = Type.getSmallestLegalValue(); for (Type element : elements) { maxElement = Comparator.compare(maxElement, element) &gt; 0 ? maxElement : element; } return maxElement; } } I can't write this. I have to accept a Comparator in Array's constructor and create aComparator interface that CompareInts implements.
has answer: http://stackoverflow.com/a/25282417
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25282325
downvote count: 2
has comment: http://stackoverflow.com/comment/39398426
has answer: http://stackoverflow.com/a/25282977
accepted answer: http://stackoverflow.com/a/25282431
tagged with: java
has comment: http://stackoverflow.com/comment/39398689
has comment: http://stackoverflow.com/comment/39398192
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39436177
tagged with: static
upvote count: 5
score: 3
has answer: http://stackoverflow.com/a/25282414
has title: Instantiation of stateless objects in Java
has comment: http://stackoverflow.com/comment/39398320
has answer: http://stackoverflow.com/a/25282431
has comment: http://stackoverflow.com/comment/39398269
answer count: 5
has answer: http://stackoverflow.com/a/25282325
has comment: http://stackoverflow.com/comment/39398234
has comment: http://stackoverflow.com/comment/39398322

http://stackoverflow.com/q/25326643
has comment: http://stackoverflow.com/comment/39481024
has answer: http://stackoverflow.com/a/25326695
has answer: http://stackoverflow.com/a/25326797
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39481168
tagged with: formatting
tagged with: date
tagged with: string
possible better answer: http://stackoverflow.com/a/25326797
has comment: http://stackoverflow.com/comment/39499358
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39481050
has title: Java Formatting Date String
has body: I need to convert this 20140815 into 15.08.2014 and into 15.08.2014 00:00:00 How do I do that, what opportunities are there in Java
accepted answer: http://stackoverflow.com/a/25326695

http://stackoverflow.com/comment/39426042
has text: didnt work either. that means only that something in code is entirely wrong or missing. but still could not find it...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25296278
type: Comment

http://stackoverflow.com/q/25273268
tagged with: java
has comment: http://stackoverflow.com/comment/94887941
has answer: http://stackoverflow.com/a/25283559
has answer: http://stackoverflow.com/a/29942663
has title: java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager
tagged with: maven-plugin
has body: Getting an issue with this dependency although it isn't being referenced as a dependency explicitly in my pom.xml. The actual maven dependency is: org.apache.httpcomponents httpclient 4.2.5 The stacktrace from my console is: java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager at com.gbi.gsa.Bridge.createClient(Bridge.java:50) at com.gbi.gsa.Bridge.<init>(Bridge.java:46) at com.gbi.gsa.SimpleBridge.<init>(SimpleBridge.java:34) at com.gbi.quickstart.controller.NavigationController.handleRequestInternal(NavigationController.java:114) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560) at org.eclipse.jetty.…
tagged with: maven-2
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/39402161
type: UnansweredQuestion
downvote count: 0
tagged with: spring
linked to: http://stackoverflow.com/q/1457863
has answer: http://stackoverflow.com/a/25430678
has answer: http://stackoverflow.com/a/28062933
type: Question
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/28061915

http://stackoverflow.com/comment/39416885
type: AnswerComment
comment on: http://stackoverflow.com/a/25288354
has text: also you might want to take a look to [The use of Multiple JFrames, Good Bad Practice](http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice/9554657#9554657) :)
type: Comment
score: 0

http://stackoverflow.com/q/25341888
score: 0
has comment: http://stackoverflow.com/comment/39529372
has comment: http://stackoverflow.com/comment/39509755
tagged with: java
has body: I am looking for my java home directory. When I tried "whereis java" I got java: /usr/share/java but then when I did ls -lah /usr/share/java I got: total 12K drwxr-xr-x 2 root root 4.0K Aug 13 04:37 . drwxr-xr-x 100 root root 4.0K Aug 13 04:38 .. -rw-r--r-- 1 root root 2.6K Apr 28 15:43 libintl.jar Could someone please clue me in?
answer count: 1
has comment: http://stackoverflow.com/comment/39526734
has title: Java Home Directory
type: Question
has comment: http://stackoverflow.com/comment/39512221
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34067071
has comment: http://stackoverflow.com/comment/39512559
tagged with: java-home
has comment: http://stackoverflow.com/comment/39512585
has comment: http://stackoverflow.com/comment/39512333
has comment: http://stackoverflow.com/comment/39510349
has comment: http://stackoverflow.com/comment/39509847

http://stackoverflow.com/q/25255806
has title: Java Server to Android Client: Cannot receive TCP packets
type: AnsweredQuestion
score: 0
tagged with: serversocket
tagged with: tcp
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25255876
has answer: http://stackoverflow.com/a/25255876
type: Question
has body: I'm trying to write a Java server so that an Android client can send a string to it, and the server would reply with its own string. The first part of this works, where the client sends a string to the server, but the server sending a message to the does not work: the packet makes it out of the server, but the Android client does not pick it up. Does anyone have suggestions on how to fix this? This entire process worked previously on a Python server, but I am changing to Java because of library support (Java has better support for NAT traversal) Server (Java): public class TCPServer implements Runnable { private Thread t = null; @Override public void run() { // TODO Auto-generated method stub String receive; String response = "1||2||3||4\n"; ServerSocket tcpServer = null; Socket tcpClient = null; try { tcpServer = new ServerSocket(4999); System.out.println(" TCP open for connections"); while(true) { tcpClient = tcpServer.accept(); BufferedReader inStream = new BufferedReader(new InputStreamReader(tcpClient.getInputStream())); receive = inStream.readLine(); System.out.println("Server &lt;&lt;&lt; " + receive); DataOutputStream outStream = new DataOutputStream(tcpClient.getOutputStream()); outStream.write(response.getBytes("UTF-8")); outStream.flush(); System.out.println("Server &gt;&gt;&gt; " + response); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("IOException: " + e.toString()); } finally { if (tcpServer != null) { try { tcpServer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("IOException: " + e.toString()); } } if (tcpClient != null) { try { tcpClient.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("IOException: " + e.toString()); } } } } public void start() { // TODO Auto-generated method stub if(t == null) { t = new Thread(this); t.start(); System.out.println("Start TCP Server"); …
tagged with: sockets
tagged with: android

http://stackoverflow.com/q/25380932
tagged with: telephonymanager
has body: I am developing an android application.My problem is that when an call is arrived application crashes. @Override public void onRestart(){ Log.d(WebServiceHelper.TAG, "Dashboard onRestart---------------->"); super.onRestart(); Intent intent = new Intent(this,DashBoard.class); startActivity(intent); finish(); } I used thid code to restart the DashBoard activity And I also used an Endcall listner to handle the phone call Here is the code public class EndCallListener extends PhoneStateListener { private boolean active = false; //EndCallListener context=this; private Context _context; public EndCallListener(Context context){ this._context = context; } @Override public void onCallStateChanged(int state, String incomingNumber) { if(TelephonyManager.CALL_STATE_RINGING == state) { Log.i("EndCallListener", "RINGING, number: " + incomingNumber); } if(TelephonyManager.CALL_STATE_OFFHOOK == state) { //wait for phone to go offhook (probably set a boolean flag) so you know your app initiated the call. active = true; Log.i("EndCallListener", "OFFHOOK"); } if(TelephonyManager.CALL_STATE_IDLE == state) { //when this state occurs, and your flag is set, restart your app Log.i("EndCallListener", "IDLE"); if (active) { active = false; // stop listening TelephonyManager mTM = (TelephonyManager)_context.getSystemService(Context.TELEPHONY_SERVICE); mTM.listen(this, PhoneStateListener.LISTEN_NONE); // restart the inbox activity Intent intent = new Intent(_context, DashBoard.class); _context.startActivity(intent); } } } } I call endcalllistner using EndCallListener callListener = new EndCallListener(this); TelephonyManager mTM = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); mTM.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE); Please help me.How to fix this? Thanks in advance 08-19 15:58:57.215: E/ActivityThread(14434): Performing stop of activity that is not resumed: {com.exalt.vts/com.exalt.vts.DashBoard} 08-19 15:58:57.215: E/ActivityThread(14434): java.la…
tagged with: java
has comment: http://stackoverflow.com/comment/39583125
type: Question
tagged with: android
score: 0
has comment: http://stackoverflow.com/comment/39582176
answer count: 0
has title: Application crashes when a call is received
has comment: http://stackoverflow.com/comment/39581025
type: UnansweredQuestion

http://stackoverflow.com/comment/39509899
type: Comment
type: QuestionComment
has text: Not the JMenu. I meant a JMenuItem. Is it also highlighted even if disabled?
comment on: http://stackoverflow.com/q/25341801
score: 0

http://stackoverflow.com/a/25327164
has comment: http://stackoverflow.com/comment/39483245
has body: Perhaps this would be sufficient: import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; import java.util.Map; import java.util.List; public class DataSet implements Serializable, PropertyChangeListener{ Map&lt;Class&lt;?&gt;, Vector&lt;Serializable&gt;&gt; contents = new HashMap&lt;Class&lt;?&gt;, Vector&lt;Serializable&gt;&gt;(); @Override public void propertyChange(PropertyChangeEvent arg0) { // TODO Auto-generated method stub } public void &lt;T extends Serializable&gt; addObject(T obj){ Vector&lt;T&gt; vector = (Vector&lt;T&gt;)contents.get(obj.getClass()); if (vector == null){ vector = new Vector&lt;T&gt;(); contents.put(obj.getClass(), vector); } vector.add(obj); } public &lt;T extends Serializable&gt; Vector&lt;T&gt; getObjects(Class&lt;T&gt; objType){ if (contents.contains(objType)){ return (Vector&lt;T&gt;)contents.get(objType); } else{ return new Vector&lt;T&gt;(); } } } I've edited my original post. Indeed, as pointed by Duncan in his comments, a DataSet structure has no point of being generic itself. Still, some generics could still add some syntax sugar in attempt to avoid casting
type: Answer
has comment: http://stackoverflow.com/comment/39483099
has comment: http://stackoverflow.com/comment/39482062
has comment: http://stackoverflow.com/comment/39483298
answers question: http://stackoverflow.com/q/25327038
has comment: http://stackoverflow.com/comment/39483182
score: 0
has comment: http://stackoverflow.com/comment/39482072

http://stackoverflow.com/comment/102657438
has text: never mind. I got this working..Your post was helpful.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25299787

http://stackoverflow.com/a/25322190
answers question: http://stackoverflow.com/q/25322154
type: Answer
has body: Threads synchronize with each other using a shared object. It's on this shared object, which is not a thread, that these methods are called. BTW, the documentation explicitely recommends to never use these methods on Thread instances, as that confuses things. For example, let's say that you have a thread adding dished to a buffet, and several threads trying to take dishes out of this buffet. The buffet will be the synchronization point: the filling thread will call notifyAll() on the shared buffet once it has added a dish to wake up threads waiting on the buffet to be filled.
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39594568
has text: Also fun fact yyy is 2 digit year in JVM6 and 4 in JVM7
comment on: http://stackoverflow.com/q/25386425
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/45323286
comment on: http://stackoverflow.com/a/28465802
score: 0
type: Comment
type: AnswerComment
has text: And you're doing exactly what I mentioned - passing parameters to your remote EJB (in this case, it's via an interceptor)

http://stackoverflow.com/a/25387633
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25386187
upvote count: 2
has body: If you haven't started writing anything to the response output stream, you can call ServletResponse.setBufferSize ... on a per-request basis. There is no way to change Tomcat's default response buffer size. It is hardwired into the code. (Look for the place where outputBuffer is initialized, and what it is initialized to ...)

http://stackoverflow.com/comment/39320066
score: 0
comment on: http://stackoverflow.com/q/25234029
type: Comment
type: QuestionComment
has text: Eran, my IDE says that House cannot be casted to IFurniture, and of course my class hierarchy doesn't make much sense, that was not the point. The point was to show my current setup.

http://stackoverflow.com/comment/39305306
has text: Tried but I get the same problem.
score: 0
comment on: http://stackoverflow.com/q/25231804
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39545647
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25362346
has text: +1 use buffering instead of trying to do the whole file in one go. It will likely work for small files but it isn't scalable.

http://stackoverflow.com/a/25254375
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39348001
has comment: http://stackoverflow.com/comment/39347811
upvote count: 2
type: Answer
has body: If you trying to detect if the Alt button is pressed while clicking/dragging/etc. with the mouse, you can use the getModifiersEx() method of MouseEvent. The MouseEvent object will be sent to your listener in each of the methods of the MouseInputListener impelementation.
has comment: http://stackoverflow.com/comment/39347885
score: 2
has comment: http://stackoverflow.com/comment/39347866
answers question: http://stackoverflow.com/q/25254327
accepted answer of: http://stackoverflow.com/q/25254327

http://stackoverflow.com/a/25235101
type: Answer
score: 0
has body: I recommend that you will access the build folder after you've built your project on the IDE under your project folder (in your workspace) and copy both the libraries folder and the .jar and post them wherever you want the program to be "installed", you'll then have an executable jar that should run smoothly without problems, just as I said don't forget the lib folder.
answers question: http://stackoverflow.com/q/25235060
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/25267328
tagged with: tablet
has comment: http://stackoverflow.com/comment/39373190
has comment: http://stackoverflow.com/comment/39372298
has body: I have a file dimen.xml in folder values-sw720dp-mdpi, but my tablet samsung GT-P7510 use folder values-sw720dp-xhdpi why ? Thank's for your responses
type: Question
has title: my tablet tablet samsung GT-P7510 not use values-sw720dp-mdpi
tagged with: resolution
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39371352
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39372470
tagged with: java

c++
tags question: http://stackoverflow.com/q/25306644
tags question: http://stackoverflow.com/q/25326519
tags question: http://stackoverflow.com/q/25379557
tags question: http://stackoverflow.com/q/25325365
tags question: http://stackoverflow.com/q/25259602
tags question: http://stackoverflow.com/q/25274826
tags question: http://stackoverflow.com/q/25374325
tags question: http://stackoverflow.com/q/25348334
tags question: http://stackoverflow.com/q/25346712
tags question: http://stackoverflow.com/q/25257232
tags question: http://stackoverflow.com/q/25328769
tags question: http://stackoverflow.com/q/25297729
tags question: http://stackoverflow.com/q/25270377
tags question: http://stackoverflow.com/q/25323202
tags question: http://stackoverflow.com/q/25387267
tags question: http://stackoverflow.com/q/25376254
type: Tag
tags question: http://stackoverflow.com/q/25288954
tags question: http://stackoverflow.com/q/25338651
tags question: http://stackoverflow.com/q/25356928
tags question: http://stackoverflow.com/q/25318651
tags question: http://stackoverflow.com/q/25372414
tags question: http://stackoverflow.com/q/25259873
tags question: http://stackoverflow.com/q/25352557
tag name: c++
tags question: http://stackoverflow.com/q/25247893
tags question: http://stackoverflow.com/q/25231084

http://stackoverflow.com/comment/39507217
has text: Hmmm that's an interesting problem to have. could I maybe ask you to glance at the testcases that I edited into my file. Even though the key is present in the hashmap the function is not returning the appropriate result. Also I've changed my hashcode function so it parses in all the ints from each line and multiplies each integer by a unique factor to get a final hashcode. I thought this might be able to fix the problem, but clearly I was wrong
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25340176
type: Comment

http://stackoverflow.com/q/25325262
tagged with: android
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25325297
has body: I'm trying to do 3 TextView in a row. I worked up an example and now I have: I would like have: id:TextView01 on the left, id:TextView02 on the middle and id:TextView03 on the right. Now id:TextView01 and id:TextView03 working good, but id:TextView02 is applied to the id:TextView01. I can use other layout, but I want to have it centered automatically from left to right.
answer count: 4
type: AnsweredQuestion
has title: Three textView in one row
has answer: http://stackoverflow.com/a/25325317
tagged with: java
has answer: http://stackoverflow.com/a/25325311
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
accepted answer: http://stackoverflow.com/a/25325321
possible better answer: http://stackoverflow.com/a/25325297
has answer: http://stackoverflow.com/a/25325321

http://stackoverflow.com/a/44615283
answers question: http://stackoverflow.com/q/25295089
has body: As other have already pointed out, receiving DataProvider results along with suite parameters is not possible. This answer proves this by stepping through the code: The Invoker.invokeTestMethods() will call Parameters.handleParameters(). There it will try to lookup a DataProvider If found, it will be invoked. And through it does not add the suite parameters afterwards, it passes the context to the DataProvider If not found, it will resort to the xmlParameters Though a DataProvider can receive the context via a ITestContext this only makes parameters available configured in the suite (XML), not specified through system properties.
score: 0
type: Answer

http://stackoverflow.com/a/25336223
upvote count: 23
has body: The exception is a bit misleading; there's no real relative path being parsed, the issue here is that Hadoop "Path" doesn't support ':' in filenames. In your case, "rsrc:hbase-common-0.98.1-hadoop2.jar" is being interpreted as "rsrc" being the "scheme", whereas I suspect you really intended to add the resource file:///path/to/your/jarfile/rsrc:hbase-common-0.98.1-hadoop2.jar". Here's an old JIRA discussing the illegal character: https://issues.apache.org/jira/browse/HADOOP-3257 Note that you probably won't be able use that absolute path either, since it still has ':' in the filename. You can try escaping the filename like "rsrc%3Ahbase-common-0.98.1-hadoop2.jar", but then it may not be found correctly on the other end where it is being used either. The best way to fix this is to tackle the root cause of "rsrc:hbase-common-0.98.1-hadoop2.jar" being introduced--using Eclipse to build your runnable jar is one likely cause of the issue. If possible, try to build your jar using something other than Eclipse and see if the same problem occurs; you can also try to select "Package required libraries into generated jar" when creating your jar in Eclipse. If the uber-jar ends up too large, you can also try to place the original dependency jars like hbase-common-0.98.1-hadoop2.jar into the classpath on all your nodes along with any other dependencies you may need, and then skip the call to "TableMapReduceUtil.addHBaseDependencyJars(conf);". Here's an old thread of another user running into a similar problem as what you're seeing: http://lucene.472066.n3.nabble.com/Error-while-running-MapR-program-on-multinode-configuration-td4053610.html
downvote count: 0
score: 23
answers question: http://stackoverflow.com/q/25334604
type: Answer

http://stackoverflow.com/q/25285572
favorite count: 0
has body: I want to parse an String from an Object[] into an Integer and save it at the same place like this: public class ArrParseTest { public static void main(String[] args) { Object[] arr = new Object[2]; String input = "Boo;Foo;1000"; Integer somInt = new Integer(0); arr = input.split(";", -1); somInt = Integer.parseInt((String) arr[2]); arr[2] = somInt; for (int i = 0; i &lt; arr.length; i++) { System.out.println(arr[i]); } } } but i receive allways this exception: Exception in thread "main" java.lang.ArrayStoreException: java.lang.Integer at main.ArrParseTest.main(ArrParseTest.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) I don't understand why I can't simply save that parsed object into the array, I though that an Object[] arr = new Object[2]; is exactly made to store diffrent objects in an Array. Anybody now how I can parse this String to an Integer and save it in the array??
has answer: http://stackoverflow.com/a/25285684
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25285619
possible better answer: http://stackoverflow.com/a/25286105
tagged with: java
has answer: http://stackoverflow.com/a/25286105
answer count: 4
accepted answer: http://stackoverflow.com/a/25285619
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/39404474
upvote count: 3
has title: Couldn't save an Integer in a Object Array
has answer: http://stackoverflow.com/a/25285660
tagged with: arrays
downvote count: 0

http://stackoverflow.com/q/25255994
linked to: http://stackoverflow.com/q/139534
has answer: http://stackoverflow.com/a/25296952
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39391731
has title: ClassCastException for implements class
has comment: http://stackoverflow.com/comment/39350875
tagged with: java
has comment: http://stackoverflow.com/comment/39352210
answer count: 1
linked to: http://stackoverflow.com/q/12576035
has comment: http://stackoverflow.com/comment/39391664
type: Question
has body: This question is very similar to the questions in can&#39;t cast to implemented interface. Classloader issues - How to determine which library versions (jar-files) are loaded I have a class Apple which implements Beet. Beet extends Carrot Carrot c= x.getCarrot(); c.getClass() //returns Apple c.getClass().getInterfaces()[0] //returns Beet. I want to access methods inside Apple. So what I did was cast c to Beet. Beet b=(Beet)c; At this point I am receiving a ClassCastException. I think this is due to the ClassLoader problem discussed in the above links. But I don't understand how to fix this. I don't know OSGi much and I don't know how to refer bundles. Can someone explain to me how to fix this problem and a good reference point.
has comment: http://stackoverflow.com/comment/39350492
tagged with: classloader
linked to: http://stackoverflow.com/q/8035877
has comment: http://stackoverflow.com/comment/39351112
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/39391748
accepted answer: http://stackoverflow.com/a/25296952

http://stackoverflow.com/q/25337389
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/25338662
has title: How to refresh Data in JTable and show updated list
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39501855
has comment: http://stackoverflow.com/comment/39501853
type: Question
has body: I am a newbie to java and trying to refresh the jTable. What i am trying to do is the list of data in Jtable is displayed now i do have a refresh icon on which if i click, it refreshes the table and updates the records in it. i have tried lot many things but not succeeded. What all i have tried is: // took ref. help from this: try 1: private void remakeData(CollectionType&lt; Objects &gt; name) { model.setRowCount(0); for (CollectionType Objects : name){ String n = Object.getName(); String e = Object.getEmail(); model.insertRow(model.getRowCount(),new Object[] { n,e }); }} try 2: tableModel.fireTableDataChanged(); try 3: list_asset.invalidate(); // list_asset is my jTable list_asset.repaint(); try 4: ((AbstractTableModel) list_asset.getModel()).fireTableCellUpdated(data.size(), 0); try 5: jPanel1.revalidate(); jPanel1.repaint(); tableModel.setRowCount(0); tableModel = new DefaultTableModel(data,columnNames); list_asset.setModel(tableModel); I have tried lot many things and while searching on google or Stackoverflow finding these things only which i have already tried. Please help me in achieving this thing. Thankx
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19471404
tagged with: swing
has comment: http://stackoverflow.com/comment/39501949
has comment: http://stackoverflow.com/comment/39501885

http://stackoverflow.com/comment/39592103
type: AnswerComment
comment on: http://stackoverflow.com/a/25385531
type: Comment
has text: You need two jenkins-jobs, one for the dev-profile and one for the prod-profile. the dev-profile could be the ci-build
score: 0

http://stackoverflow.com/a/25257959
has comment: http://stackoverflow.com/comment/39354345
answers question: http://stackoverflow.com/q/25241213
type: Answer
score: 3
has body: The problem should be SLF4J API jars. Make sure you have no duplicate jars in your classpath. If exists exclude them and add these dependencies to your classpath this should be suitable with the hibernate version that you use. org.slf4j slf4j-api 1.6.2 org.slf4j slf4j-log4j12 1.6.2
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25241213

http://stackoverflow.com/comment/39341033
comment on: http://stackoverflow.com/q/25250761
type: Comment
type: QuestionComment
has text: @OlegGordiichuk Thanks for reply. Running latest versions of Google Now and Google Search.
score: 0

http://stackoverflow.com/a/25299092
has comment: http://stackoverflow.com/comment/39466228
accepted answer of: http://stackoverflow.com/q/25299031
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39466268
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39840710
has comment: http://stackoverflow.com/comment/39430529
has comment: http://stackoverflow.com/comment/39430467
answers question: http://stackoverflow.com/q/25299031
has body: The basic answer is, you've overused static... You declare the JRadioButtons in Q_Panel as ... public static JRadioButton one = new JRadioButton("none"); public static JRadioButton two = new JRadioButton("none"); public static JRadioButton three = new JRadioButton("none"); public static JRadioButton four = new JRadioButton("none"); Then in radio_button class you start doing things like... qnum = new Q_Panel[10]; qnum[i].one = new JRadioButton(); qnum[i].one.setText("male"); The problem is, each instance of Q_Panel is using the last instance of one, two, three and four...which means if your select one in qnum[0], all the other instances will also have selected one... Remove the static references and modify your code to allow Q_Panel to manage the JRadio buttons. You could even provide Q_Panel with a method that would return an int or String or a enum which described what was selected...

jquery
tags question: http://stackoverflow.com/q/25332208
tags question: http://stackoverflow.com/q/25364756
tags question: http://stackoverflow.com/q/25233804
tags question: http://stackoverflow.com/q/25337610
tags question: http://stackoverflow.com/q/25242380
type: Tag
tag name: jquery
tags question: http://stackoverflow.com/q/25300937
tags question: http://stackoverflow.com/q/25312277
tags question: http://stackoverflow.com/q/25283846
tags question: http://stackoverflow.com/q/25303420
tags question: http://stackoverflow.com/q/25255028
tags question: http://stackoverflow.com/q/25370751
tags question: http://stackoverflow.com/q/25261715
tags question: http://stackoverflow.com/q/25309540
tags question: http://stackoverflow.com/q/25288330
tags question: http://stackoverflow.com/q/25307459

http://stackoverflow.com/comment/39541083
comment on: http://stackoverflow.com/a/25358091
has text: I think that is due to OS system as you are supplying system layout in adapter like android.R.layout.simple_spinner_item. So you create own layout to display elements with textview in it and apply to arrayadapter.
type: Comment
score: 0
type: AnswerComment

eclipse
tags question: http://stackoverflow.com/q/25379864
tags question: http://stackoverflow.com/q/25306224
tags question: http://stackoverflow.com/q/25381022
tags question: http://stackoverflow.com/q/25309498
tags question: http://stackoverflow.com/q/25264880
tags question: http://stackoverflow.com/q/25346231
tags question: http://stackoverflow.com/q/25378778
tag name: eclipse
tags question: http://stackoverflow.com/q/25238691
tags question: http://stackoverflow.com/q/25326638
tags question: http://stackoverflow.com/q/25298965
tags question: http://stackoverflow.com/q/25250726
tags question: http://stackoverflow.com/q/25255950
tags question: http://stackoverflow.com/q/25343899
tags question: http://stackoverflow.com/q/25316237
tags question: http://stackoverflow.com/q/25278802
tags question: http://stackoverflow.com/q/25275262
tags question: http://stackoverflow.com/q/25344676
tags question: http://stackoverflow.com/q/25372614
tags question: http://stackoverflow.com/q/25239413
tags question: http://stackoverflow.com/q/25283095
tags question: http://stackoverflow.com/q/25303692
tags question: http://stackoverflow.com/q/25255310
tags question: http://stackoverflow.com/q/25384210
tags question: http://stackoverflow.com/q/25305957
tags question: http://stackoverflow.com/q/25348321
tags question: http://stackoverflow.com/q/25333228
tags question: http://stackoverflow.com/q/25312590
tags question: http://stackoverflow.com/q/25289107
tags question: http://stackoverflow.com/q/25351435
tags question: http://stackoverflow.com/q/25336472
tags question: http://stackoverflow.com/q/25366639
tags question: http://stackoverflow.com/q/25252317
tags question: http://stackoverflow.com/q/25339977
tags question: http://stackoverflow.com/q/25348511
tags question: http://stackoverflow.com/q/25358461
tags question: http://stackoverflow.com/q/25353534
tags question: http://stackoverflow.com/q/25325894
tags question: http://stackoverflow.com/q/25388407
tags question: http://stackoverflow.com/q/25307240
tags question: http://stackoverflow.com/q/25234810
tags question: http://stackoverflow.com/q/25290904
tags question: http://stackoverflow.com/q/25250971
tags question: http://stackoverflow.com/q/25331214
tags question: http://stackoverflow.com/q/25243342
tags question: http://stackoverflow.com/q/25344495
tags question: http://stackoverflow.com/q/25367321
tags question: http://stackoverflow.com/q/25347567
tags question: http://stackoverflow.com/q/25370194
tags question: http://stackoverflow.com/q/25270916
tags question: http://stackoverflow.com/q/25254220
tags question: http://stackoverflow.com/q/25244315
tags question: http://stackoverflow.com/q/25368590
tags question: http://stackoverflow.com/q/25250801
tags question: http://stackoverflow.com/q/25360391
tags question: http://stackoverflow.com/q/25338624
tags question: http://stackoverflow.com/q/25279190
tags question: http://stackoverflow.com/q/25377708
tags question: http://stackoverflow.com/q/25306367
tags question: http://stackoverflow.com/q/25364192
tags question: http://stackoverflow.com/q/25376512
tags question: http://stackoverflow.com/q/25385880
tags question: http://stackoverflow.com/q/25388322
tags question: http://stackoverflow.com/q/25247083
tags question: http://stackoverflow.com/q/25320934
tags question: http://stackoverflow.com/q/25237726
tags question: http://stackoverflow.com/q/25299020
tags question: http://stackoverflow.com/q/25230408
tags question: http://stackoverflow.com/q/25337182
tags question: http://stackoverflow.com/q/25262996
tags question: http://stackoverflow.com/q/25328237
tags question: http://stackoverflow.com/q/25338592
tags question: http://stackoverflow.com/q/25331797
tags question: http://stackoverflow.com/q/25332067
tags question: http://stackoverflow.com/q/25316564
tags question: http://stackoverflow.com/q/25371359
tags question: http://stackoverflow.com/q/25345787
tags question: http://stackoverflow.com/q/25301663
tags question: http://stackoverflow.com/q/25287150
tags question: http://stackoverflow.com/q/25359812

http://stackoverflow.com/comment/39500500
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25336472
type: Comment
has text: That thing Eclipse does with every other method in content-assist? I want that exact same thing to happen with readObject and writeObject.

http://stackoverflow.com/q/25313423
favorite count: 0
has answer: http://stackoverflow.com/a/25313529
type: Question
tagged with: android-fragments
has title: How to make a clickable object inside a ListFragment which also Overrides onListItemClick
tagged with: android-listfragment
tagged with: android
accepted answer: http://stackoverflow.com/a/25313529
linked to: http://stackoverflow.com/q/6091194
has body: I have a ListFragmentA being implemented by my MainActivity(which also Overrides onListItemClick and is needed). The CustomArrayAdapter has two images and 3 textViews. Everything works fine except when I make one of my images "Clickable=onEditDelete". The method onEditDelete can not be found in ListFragmentA but IS found when I move the method to MainActivity. I would like to understand why this happens ? Once the image is made clickable does it not belong to the ListFragment anymore ? What is the best way to get index of the clicked image in the cell if the method can only be found in MainActiviy ? -Thanks You. public class MainActivity extends BaseActivity { public void goEditDelete(View ed) { Log.d("myLog", "edit ******************* Item prod clicked: "); } } public class CustomListViewAdapter extends ArrayAdapter&lt;RowItem&gt; { Context context; public CustomListViewAdapter(Context context, int resourceId, List&lt;RowItem&gt; items) { super(context, resourceId, items); this.context = context; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; TextView txtSubTitle; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; RowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.row, null); holder = new ViewHolder(); holder.txtTitle = (TextView) convertView.findViewById(R.id.row_title); holder.txtSubTitle = (TextView) convertView.findViewById(R.id.row_subTitle); holder.imageView = (ImageView) convertView.findViewById(R.id.row_icon); // make clickable **************** convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); holder.txtSubTitle.setText(rowItem.getsubTitle()); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); return convertView; } } public …
has comment: http://stackoverflow.com/comment/39456555
type: AnsweredQuestion
tagged with: java
downvote count: 0
upvote count: 1
score: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39456505

http://stackoverflow.com/comment/39596423
has text: you might first look into GORM http://grails.org/doc/latest/guide/GORM.html if mapping your data is feasable or worth the efford (gorm features vs hastle to do the mapping). serving domain (domain in grails means DAO and related methods) as JSON/XML is rather easy - but it is not very usuable for a "common" vaadin up, which usually uses only server-side-code. if you have lots of data going into selects/tables you might end up write a container in vaadin, that maps into gorm -- or you write all your DAO for yourself using groovy's sql http://groovy.codehaus.org/api/groovy/sql/Sql.html
type: QuestionComment
comment on: http://stackoverflow.com/q/25387105
score: 0
type: Comment

http://stackoverflow.com/q/25250340
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25250517
possible better answer: http://stackoverflow.com/a/25250517
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39339699
has body: I would like to pose 2 questions for the following program class WriteDemo{ public static void main(String args[]){ int b; b = 'x'; System.out.write(b); System.out.write('\n'); } } How can we use the character 'x' for the variable b which is an integer? The result of the program that appears on the screen is x. in case i remove the final line System.out.write('\n'); nothing appears on the screen. Why is this happening?
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/8549692
has answer: http://stackoverflow.com/a/25250468
accepted answer: http://stackoverflow.com/a/25250468
tagged with: system.out
has title: Using char and int being in System.out.write() statement
type: Question
answer count: 2

http://stackoverflow.com/comment/39839556
comment on: http://stackoverflow.com/q/25388915
type: Comment
type: QuestionComment
has text: @luc - unfortunately Charset.forName("UTF-8").encode(getSummary()) doesn't work... gives me a title of the Event "java.nio.HeapByteBuffer[pos=0 lim=15 cap=15]" in Google Calendar... Any other ideas please?
score: 0

http://stackoverflow.com/comment/39521921
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25349213
score: 0
has text: why `[^a-zA-Z0-9]` doesn't work?

http://stackoverflow.com/a/25377216
type: Answer
accepted answer of: http://stackoverflow.com/q/25377175
score: 0
has comment: http://stackoverflow.com/comment/39575017
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25377175
has body: A TextView can have a tag attached to it i.e. some object that is stored as extra data to the view itself. Check out the documentation here: View.setTag(Object) In your case, you can assign the "Hello" to the displayed text (using the method below), and set the tag to the full text. textView.setText(getDisplayText(helloString)); textView.setTag("TAG", helloString); When the user clicks on your view, you can get the tag from the view and do what you need with it. This way, there is more data stored than what you see. (original answer before the edit) How about a method that does what you need: private String getDisplayText(String input) { return input.substring(0, 5); } And then just use that method when you set the value of your TextView. textView.setText(getDisplayText(helloString));

http://stackoverflow.com/q/25236044
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39315329
has title: Error using another classes method
score: 0
has body: I made a simple JFrame in my Main class and in my class Move I extended JPanel and put the PaintComponent method. I implemented the KeyListener to control a rectangle I drew on the screen. In my last class, Collision I made a method that returns a boolean but when I try t use that value it get loads of errors. error in console: Exception in thread "main" java.lang.StackOverflowError at java.awt.Component.setBackground(Unknown Source) at javax.swing.JComponent.setBackground(Unknown Source) at javax.swing.LookAndFeel.installColors(Unknown Source) at javax.swing.LookAndFeel.installColorsAndFont(Unknown Source) at javax.swing.plaf.basic.BasicPanelUI.installDefaults(Unknown Source) at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source) at javax.swing.JComponent.setUI(Unknown Source) at javax.swing.JPanel.setUI(Unknown Source) at javax.swing.JPanel.updateUI(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at Move.&lt;init&gt;(Move.java:15) at Collision.&lt;init&gt;(Collision.java:4) at Move.&lt;init&gt;(Move.java:11) at Collision.&lt;init&gt;(Collision.java:4) and the "at Move.(Move.java:11)" repeats like a 1000 times. code: setting up JFrame and gameloop import javax.swing.JFrame; public class Main { public static void main(String[] args) { final Move m = new Move(); JFrame jf = new JFrame(); jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(300,200); jf.setLocationRelativeTo(null); jf.add(m); jf.requestFocusInWindow(); Thread t = new Thread(){ public void run(){ while(true){ m.repaint(); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } }; t.start(); } } The Move class using paint component and keylistener. I think it has something to do with c.Left() == true import java.awt.Color; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; i…
tagged with: java
has comment: http://stackoverflow.com/comment/39315437
has answer: http://stackoverflow.com/a/25237475
has comment: http://stackoverflow.com/comment/39312975
type: Question
has comment: http://stackoverflow.com/comment/39313057
has comment: http://stackoverflow.com/comment/39312998
answer count: 1
has comment: http://stackoverflow.com/comment/39312935
accepted answer: http://stackoverflow.com/a/25237475
has comment: http://stackoverflow.com/comment/39313028

http://stackoverflow.com/a/25342457
accepted answer of: http://stackoverflow.com/q/25342167
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25342167
upvote count: 1
downvote count: 1
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39515545
has body: You could use a generic method like this one: public &lt;E&gt; ArrayList&lt;E&gt; getArrayListOf(Class&lt;E&gt; clazz) { return new ArrayList&lt;E&gt;(); } The type of the generated List will be List&lt;? extends YourClass&gt; or List&lt;YourClass&gt; if YourClass is final.

http://stackoverflow.com/q/25265474
has comment: http://stackoverflow.com/comment/39367694
upvote count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/25265553
tagged with: java
has title: Null pointer Exception in currency converter android app
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39367727
type: Question
accepted answer: http://stackoverflow.com/a/25265553
has comment: http://stackoverflow.com/comment/39367781
tagged with: nullpointerexception
has body: I am building currency converter for android and am getting null pointer exception in this code.I am converting all the values as the number is entered in the edit text,All the values in the text views are changed.Please help !!! public class MainActivity extends Activity { EditText currency; String value; float us,pk,om,ks,e; TextView usa,pak,uk,oman,ksa,eu; float val; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); value=currency.getText().toString(); usa=(TextView)findViewById(R.id.textView1); pak=(TextView)findViewById(R.id.textView2); uk=(TextView)findViewById(R.id.textView3); oman=(TextView)findViewById(R.id.textView4); ksa=(TextView)findViewById(R.id.textView5); eu=(TextView)findViewById(R.id.textView6); currency=(EditText)findViewById(R.id.editText1); currency.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { value=currency.getText().toString(); // Toast.makeText(getApplicationContext(),value, Toast.LENGTH_SHORT).show(); try { val = Float.parseFloat(value); us=val*3.67f; usa.setText(Float.toString(us)); pk=val=26.95f*val; pak.setText(Float.toString(pk)); om=val*0.10f; oman.setText(Float.toString(om)); ks=val*1.02f; ksa.setText(Float.toString(ks)); e=val*0.20f; eu.setText(Float.toString(e)); } catch(NumberFormatException ex) { val = 0.0f; usa.setText("0"); pak.setText("0"); uk.setText("0"); oman.setText("0"); ksa.setText("0"); eu.setText("0"); } Toast.makeText(getApplicationContext(),Float.toString(val), Toast.LENGTH_SHORT).show(); //us=val*3.67; } public void beforeTextChanged(CharSequence s, int start, int count, int aft er) { } public void afterTextChanged(Editable s) { } }); //val=Double.parseDouble(value); // us=val*3.67; // usa.setText(String.valueOf(us)); } Trace: 08-12 17:35:03.846: E/AndroidRuntime(2944): FATAL EXCEPTION: main 08-12 17:35:03.846: E/AndroidRuntime(2944): java.lang.RuntimeExce…
score: -2
tagged with: android
has comment: http://stackoverflow.com/comment/39367564
has comment: http://stackoverflow.com/comment/39367858
type: AnsweredQuestion

recursion
type: Tag
tags question: http://stackoverflow.com/q/25333069
tags question: http://stackoverflow.com/q/25375408
tags question: http://stackoverflow.com/q/25274881
tags question: http://stackoverflow.com/q/25298724
tags question: http://stackoverflow.com/q/25333690
tags question: http://stackoverflow.com/q/25268370
tags question: http://stackoverflow.com/q/25365589
tags question: http://stackoverflow.com/q/25312084
tag name: recursion
tags question: http://stackoverflow.com/q/25303277
tags question: http://stackoverflow.com/q/25230941
tags question: http://stackoverflow.com/q/25253829

http://stackoverflow.com/a/25352168
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25348215
has comment: http://stackoverflow.com/comment/39596953
has body: I once did this genetically using Jackson. It has a very convenient ObjectMapper.readerForUpdating(Object) method that can read values from a JsonNode/Tree onto an existing object. The controller/service @PATCH @Transactional public DomainObject partialUpdate (Long id, JsonNode data) { DomainObject o = repository.get(id); return objectMapper.readerForUpdating(o).readValue(data); } That was it. We used Jersey to expose the services as REST Web services, hence the @PATCH annotation. As to whether this is a controller or a service: it handles raw transfer data (the JsonNode), but to work efficiently it needs to be transactional (Changes made by the reader are flushed to the database when the transaction commits. Reading the object in the same transaction allows hibernate to dynamically update only the changed fields).
type: Answer

http://stackoverflow.com/comment/39351403
score: 2
has text: The problem is that there's no physical file in `"c:/" + name + ".uploaded"`, so `file1.getParentFile()` doesn't exist.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25256490

http://stackoverflow.com/comment/39307500
type: AnswerComment
comment on: http://stackoverflow.com/a/25232832
has text: Thanks. This half fixes another problem (when I press a key once, it often repeats at least twice), **however** I'm afraid it doesn't solve the issue and creates another problem: The repeat still occurs, and - in addition - now I cannot move two ways with arrow keys and use another key (without mask). Here is ALL of my code (sorry, I didn't add you as author here because I already pasted it to pastebin): [http://pastebin.com/LxXXshXu](http://pastebin.com/LxXXshXu). If you want to, you can just paste this into Netbeans/Eclipse/text editor and run it and try to make the key binding repeat.
score: 0
type: Comment

http://stackoverflow.com/a/31210234
downvote count: 0
answers question: http://stackoverflow.com/q/25260469
has comment: http://stackoverflow.com/comment/56929472
score: 5
has body: you need to configure your servlet-context with couple of beans, make tiles.xml to use layout template and rest of the definitions in views.xml to derive the base definition in tiles.xml: &lt;beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"&gt; &lt;beans:property name="definitions"&gt; &lt;beans:list&gt; &lt;beans:value&gt;/WEB-INF/tiles.xml&lt;/beans:value&gt; &lt;beans:value&gt;/WEB-INF/views/**/views.xml&lt;/beans:value&gt; &lt;/beans:list&gt; &lt;/beans:property&gt; &lt;/beans:bean&gt; &lt;beans:bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;beans:property name="viewClass"&gt; &lt;beans:value&gt; org.springframework.web.servlet.view.tiles3.TilesView &lt;/beans:value&gt; &lt;/beans:property&gt; &lt;beans:property name="order" value="0"/&gt; &lt;/beans:bean&gt;
upvote count: 5
type: Answer

http://stackoverflow.com/comment/39425085
has text: @jameslarge As for your first statement, I would interpret people would synchronize the String in order to call its method safely. As for your second, I would assume you wouldn't be so technical as to distinguish different levels of "correctness". And finally for your third, that is implementation specific and not entirely guaranteed, so I left it out.
score: 0
comment on: http://stackoverflow.com/a/25296023
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25377657
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25377521
type: AcceptedAnswer
type: Answer
has body: Try to use RegExp approach with Pattern class. String str = "from abc.xyz.com (abc.xyz.com. [112.35.4.152]) by xx.yy.com with ESMTPS id ..."; Pattern pattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); Matcher matcher = pattern.matcher(str); if (matcher.find()) { System.out.println(matcher.group(0)); } else { System.out.println("No match."); } Prints: 112.35.4.152
answers question: http://stackoverflow.com/q/25377521
score: 2

http://stackoverflow.com/q/25331920
downvote count: 0
tagged with: mysql
has answer: http://stackoverflow.com/a/25332071
has comment: http://stackoverflow.com/comment/39491751
has comment: http://stackoverflow.com/comment/39491700
tagged with: prepared-statement
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39492319
score: 3
tagged with: resultset
has comment: http://stackoverflow.com/comment/39491849
has body: I am trying to use the setString(index, parameter) method for Prepared Statements in order to create a ResultSet but it doesn't seem to be inserting properly. I know the query is correct because I use the same one (minus the need for the setString) in a later else. Here is the code I currently have: **From what I understand, the ps.setString(1, "'%" + committeeCode + "%'"); is supposed to replace the ? in the query but my output says otherwise. Any help is appreciated. public String getUpcomingEvents(String committeeCode) throws SQLException{ Context ctx = null; DataSource ds = null; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; StringBuilder htmlBuilder = new StringBuilder(); String html = ""; try { ctx = new InitialContext(); ds = (DataSource) ctx.lookup("java:ConnectDaily"); conn = ds.getConnection(); if(committeeCode != null){ //get all events String queryStatement = "SELECT " + ....... "WHERE c.calendar_id = ci.calendar_id AND c.short_name LIKE ? " + "AND ci.style_id = 0 " + "AND ci.starting_date > to_char(sysdate-1, 'J') " + "AND ci.item_type_id = cit.item_type_id " + "ORDER BY to_date(to_char(ci.starting_date), 'J')"; ps = conn.prepareStatement(queryStatement); ps.setString(1, "'%" + committeeCode + "%'"); System.out.println(queryStatement); rs = ps.executeQuery(); if (rs != null){ while(rs.next()){ String com = rs.getString("name"); String comID = rs.getString("short_name"); String startTime = rs.getString("starting_time"); String endTime = rs.getString("ending_time"); String name = rs.getString("contact_name"); String desc = rs.getString("description"); String info = rs.getString("contact_info"); String date = rs.getString("directory"); htmlBuilder.append(" "+com+" - "+ date +" - "+startTime+" - "+endTime+" "); htmlBuilder.append("Location: "+comID+" "); htmlBuilder.append("Dial-In:"+com+" "); htmlBuilder.append("Part. Code:"+info+" "); htmlBuilder.append("Take me to WebEx"); htmlBuilder.append(" "); } } html = htmlBuilder.toStri…
tagged with: java
accepted answer: http://stackoverflow.com/a/25332010
has comment: http://stackoverflow.com/comment/39492091
has answer: http://stackoverflow.com/a/25332551
has answer: http://stackoverflow.com/a/25332010
type: AnsweredQuestion
has title: setString for prepared statement not working
answer count: 3
tagged with: sql
possible better answer: http://stackoverflow.com/a/25332071
upvote count: 3

http://stackoverflow.com/comment/39307464
has text: Can you confirm what you mean by "missing"? You mean a field of type `Optional<>` that is null?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25233131

http://stackoverflow.com/q/25370393
has answer: http://stackoverflow.com/a/25370558
has comment: http://stackoverflow.com/comment/39561579
type: Question
has comment: http://stackoverflow.com/comment/39579881
tagged with: android
has body: Guys I am getting an error and I am not sure how to solve it please help me. Here is my code: package com.appschool.www.projectphase1516; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.Switch; import android.widget.TextView; import com.appschool.www.projectphase1516.R; import org.w3c.dom.Text; public class AccountlistActivity extends Activity implements View.OnClickListener { LinearLayout horiz; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_accountlist); horiz = (LinearLayout) findViewById(R.id.linearlayouthere); Accountlistcreator(); setContentView(horiz); } public void Accountlistcreator(){ SharedPreferences sp = getSharedPreferences("details",1); int numofaccounts = sp.getInt("numofaccouns",0); horiz.removeAllViews(); for(int i=0;i&lt;=numofaccounts;i++) { TextView titleaccount = new TextView(this); titleaccount.setText(sp.getString("accountTitle" + i, "")); titleaccount.setTextSize(20); horiz.addView(titleaccount); Button seeaccount = new Button(this); seeaccount.setText("See Details"); seeaccount.setId(i); seeaccount.setLayoutParams(new FrameLayout.LayoutParams(200,100)); seeaccount.setOnClickListener(this); horiz.addView(seeaccount); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.accountlist, 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 AndroidManif…
score: 0
tagged with: view
answer count: 3
has answer: http://stackoverflow.com/a/25370500
type: UnansweredQuestion
tagged with: parent
tagged with: java
has title: Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first
has answer: http://stackoverflow.com/a/25380519

http://stackoverflow.com/comment/39554992
type: Comment
comment on: http://stackoverflow.com/q/25365930
score: 0
has text: Please, show us the errors and the JSON.
type: QuestionComment

http://stackoverflow.com/a/34236364
has body: You can use clean compile ~run If it doesn't work properly, you can use @EntityConcurrencyMode(ConcurrencyMode.NONE) within your model class.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25368133

http://stackoverflow.com/a/25272833
accepted answer of: http://stackoverflow.com/q/25272705
upvote count: 2
has comment: http://stackoverflow.com/comment/39383057
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25272705
has comment: http://stackoverflow.com/comment/39382236
score: 2
has body: You're not wrong, if a variable is used by two or more threads, writes should be made visible by using the appropriate memory barriers (synchronized/volatile/java.util.concurrent). In this case though, the question is: is process() not also called from the EDT? If it is, there are no multiple threads to talk about and hence the code works, albeit dangerously unsafe. Update: You're saying process() isn't called from the EDT. Your code will still happen to work because although you don't put a memory barrier on your write, the implementation of the EDT does. In theory, relying on this is a dangerous idea because there's no guarantee this will stay this way. In practice, there are so many brittle AWT applications out there that it's unlikely to change. (As pointed out by @jtahlborn, this barrier still only applies to calls from within the EDT)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39408954

http://stackoverflow.com/comment/39480653
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25326343
has text: I have to use it like this, because after the Login(InternalFrame) the main Frame disposes the desktopPane and loads other elements like Jlists etc. So if I use the component listener where do I place it? Inside this method or somewhere else?

http://stackoverflow.com/comment/39598882
type: AnswerComment
comment on: http://stackoverflow.com/a/25381827
has text: After saying that I would tend to define data structures in Java - and I would only "script them" in JavaScript. ;)
score: 0
type: Comment

http://stackoverflow.com/comment/39494492
score: 0
comment on: http://stackoverflow.com/q/25333228
type: Comment
type: QuestionComment
has text: textView.setVisibility(View.VISIBLE)

hibernate
tags question: http://stackoverflow.com/q/25257920
tags question: http://stackoverflow.com/q/25279423
tags question: http://stackoverflow.com/q/25315354
tags question: http://stackoverflow.com/q/25312562
tags question: http://stackoverflow.com/q/25286745
tags question: http://stackoverflow.com/q/25360336
tags question: http://stackoverflow.com/q/25354976
tags question: http://stackoverflow.com/q/25339608
tags question: http://stackoverflow.com/q/25366724
tags question: http://stackoverflow.com/q/25383790
tags question: http://stackoverflow.com/q/25237357
tags question: http://stackoverflow.com/q/25246858
tags question: http://stackoverflow.com/q/25232267
tags question: http://stackoverflow.com/q/25355268
tags question: http://stackoverflow.com/q/25322550
tags question: http://stackoverflow.com/q/25351817
tags question: http://stackoverflow.com/q/25262338
tags question: http://stackoverflow.com/q/25232117
tags question: http://stackoverflow.com/q/25335954
tags question: http://stackoverflow.com/q/25270361
tags question: http://stackoverflow.com/q/25375856
tags question: http://stackoverflow.com/q/25348546
tags question: http://stackoverflow.com/q/25337884
tags question: http://stackoverflow.com/q/25312296
tags question: http://stackoverflow.com/q/25233313
tags question: http://stackoverflow.com/q/25388619
tags question: http://stackoverflow.com/q/25257046
tags question: http://stackoverflow.com/q/25278583
tags question: http://stackoverflow.com/q/25248600
tags question: http://stackoverflow.com/q/25328867
tags question: http://stackoverflow.com/q/25381299
tags question: http://stackoverflow.com/q/25274356
tags question: http://stackoverflow.com/q/25236798
type: Tag
tags question: http://stackoverflow.com/q/25239938
tags question: http://stackoverflow.com/q/25242396
tags question: http://stackoverflow.com/q/25322658
tags question: http://stackoverflow.com/q/25315528
tags question: http://stackoverflow.com/q/25338923
tags question: http://stackoverflow.com/q/25371481
tags question: http://stackoverflow.com/q/25251014
tags question: http://stackoverflow.com/q/25236449
tags question: http://stackoverflow.com/q/25339817
tags question: http://stackoverflow.com/q/25265468
tags question: http://stackoverflow.com/q/25327639
tags question: http://stackoverflow.com/q/25233029
tags question: http://stackoverflow.com/q/25245838
tags question: http://stackoverflow.com/q/25376101
tags question: http://stackoverflow.com/q/25333545
tags question: http://stackoverflow.com/q/25246274
tags question: http://stackoverflow.com/q/25332014
tags question: http://stackoverflow.com/q/25360927
tags question: http://stackoverflow.com/q/25333711
tags question: http://stackoverflow.com/q/25267981
tags question: http://stackoverflow.com/q/25362262
tags question: http://stackoverflow.com/q/25380716
tags question: http://stackoverflow.com/q/25369123
tags question: http://stackoverflow.com/q/25252662
tags question: http://stackoverflow.com/q/25284617
tags question: http://stackoverflow.com/q/25233089
tags question: http://stackoverflow.com/q/25369211
tags question: http://stackoverflow.com/q/25295695
tags question: http://stackoverflow.com/q/25310030
tags question: http://stackoverflow.com/q/25247001
tags question: http://stackoverflow.com/q/25237147
tags question: http://stackoverflow.com/q/25365279
tags question: http://stackoverflow.com/q/25262933
tags question: http://stackoverflow.com/q/25363716
tags question: http://stackoverflow.com/q/25340606
tags question: http://stackoverflow.com/q/25307316
tags question: http://stackoverflow.com/q/25278849
tags question: http://stackoverflow.com/q/25236742
tags question: http://stackoverflow.com/q/25356600
tags question: http://stackoverflow.com/q/25381307
tags question: http://stackoverflow.com/q/25241384
tags question: http://stackoverflow.com/q/25356260
tags question: http://stackoverflow.com/q/25337069
tags question: http://stackoverflow.com/q/25379046
tags question: http://stackoverflow.com/q/25284234
tags question: http://stackoverflow.com/q/25258495

http://stackoverflow.com/a/25275638
score: 0
type: AcceptedAnswer
has body: Both, of these design patterns should fulfill the task: Template method pattern or the Extensibility pattern aka. Framework
answers question: http://stackoverflow.com/q/25273914
type: Answer
accepted answer of: http://stackoverflow.com/q/25273914

http://stackoverflow.com/q/25296748
favorite count: 0
type: Question
has body: first time posting; long time reader. I apologize a head of time if this was already asked here (I'm new to lucene as well!). I've done a lot of research and wasn't able to find a good explanation/example for my question. First of all, I've used IKVM.NET to convert lucene 4.9 java to include in my .net application. I chose to do this so I was able to use the most recent version of lucene. No issues. I am trying to create a basic example to start to learn lucene and to apply it to my app. I've done countless google searches and read lots of articles, apache's website, etc. My code follows mostly the example here: http://www.lucenetutorial.com/lucene-in-5-minutes.html My question is, I don't believe I want to use RAMDirectory.. right? Since I will be indexing a database and allowing users to search it via the website. I opted for using FSDirectory because I didn't think it should be all stored in memory. When the IndexWriter is created it is creating new files each time(.cfe, .cfs, .si, segments.gen, write.lock, etc.) It seems to me you would create these files once and then use them until the index needs to be rebuilt? So how do I create an IndexWriter with out recreating the index files? Code: StandardAnalyzer analyzer; Directory directory; protected void Page_Load(object sender, EventArgs e) { var version = org.apache.lucene.util.Version.LUCENE_CURRENT; analyzer = new StandardAnalyzer(version); if(directory == null){ directory= FSDirectory.open(new java.io.File(HttpContext.Current.Request.PhysicalApplicationPath + "/indexes")); } IndexWriterConfig config = new IndexWriterConfig(version, analyzer); //i found setting the open mode will overwrite the files but still creates new each time config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); IndexWriter w = new IndexWriter(directory, config); addDoc(w, "test", "1234"); addDoc(w, "test1", "1234"); addDoc(w, "test2", "1234"); addDoc(w, "test3", "1234"); w.close(); } private static void addDoc(IndexWriter w, String _keyw…
accepted answer: http://stackoverflow.com/a/25297149
has title: Lucene - Creating an Index using FSDirectory
has answer: http://stackoverflow.com/a/25297149
tagged with: lucene
upvote count: 6
possible better answer: http://stackoverflow.com/a/38314527
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38314527
answer count: 2
tagged with: java
downvote count: 0
score: 6
tagged with: asp.net

http://stackoverflow.com/comment/39448660
score: 0
comment on: http://stackoverflow.com/a/25308391
type: Comment
type: AnswerComment
has text: Thank you, it looks promising.

http://stackoverflow.com/comment/39384726
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25253706
has text: If I restart jboss instance in profiling mode, the process taking long time will be killed, and I wont be getting the details. Since this process is happening intermittently, so is there any other way we can know the process just by PID, without stopping the instance.
type: Comment

http://stackoverflow.com/q/25240664
tagged with: jboss
has answer: http://stackoverflow.com/a/25242524
tagged with: deployment
type: Question
type: UnansweredQuestion
has title: Jboss Quickstart using Maven (jboss-as:deploy)
has body: I am new to Maven, I am trying to go through the EAP(JBoss) clusterhasingleton quick start guide. http://www.jboss.org//quickstarts/eap/cluster-ha-singleton/index.html I can deploy the jar and everything works fine by running mvn clean install jboss-as:deploy I need someone to please explain what does "Deploy" mean in Maven/EAP as i have used JBoss 5 and deployment in that version meant copying the jar in deployments folder(i was using ant) where as i can't find the jar file in the deployments folder in EAP although everything is working. I can see the jars in the local repository in .m2 folder and target folder in the workspace. How does Jboss know that is deployed? and does it look at the local repository and how? Kind Regards,
tagged with: maven
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39402010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25277106
has text: Is it possible to create this file with notepad?
score: 1

http://stackoverflow.com/q/25245371
has body: We need to lock a method responsible for loading database date into a HashMap based cache. A possible situation is that a second thread tries to access the method while the first method is still loading cache. We consider the second thread's effort in this case to be superfluous. We would therefore like to have that second thread wait until the first thread is finished, and then return (without loading the cache again). What I have works, but it seems quite inelegant. Are there better solutions? private static final ReentrantLock cacheLock = new ReentrantLock(); private void loadCachemap() { if (cacheLock.tryLock()) { try { this.cachemap = retrieveParamCacheMap(); } finally { cacheLock.unlock(); } } else { try { cacheLock.lock(); // wait until thread doing the load is finished } finally { try { cacheLock.unlock(); } catch (IllegalMonitorStateException e) { logger.error("loadCachemap() finally {}",e); } } } }
favorite count: 0
type: Question
has title: Lock or wait cache load
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25245808
has comment: http://stackoverflow.com/comment/39330546
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/25259084
upvote count: 2
score: 2
has answer: http://stackoverflow.com/a/25246206
answer count: 3
tagged with: locking
downvote count: 0
has comment: http://stackoverflow.com/comment/39330866
has comment: http://stackoverflow.com/comment/39330699
tagged with: multithreading

http://stackoverflow.com/comment/50882430
comment on: http://stackoverflow.com/a/25277944
type: AnswerComment
score: 1
type: Comment
has text: I don't think rpmbuild exists anymore in homebrew, but installing rpm installed everything that was needed.

http://stackoverflow.com/comment/39343647
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25252127
type: Comment
has text: First, take a look at this [rotating components example](http://stackoverflow.com/questions/14324460/rotating-a-jtextfield-vertically/14328881#14328881)

http://stackoverflow.com/q/25242239
favorite count: 0
type: Question
has body: I have some problems with my maven project. I have created some JUnit test in my maven folder src/test/java. If I created my maven project with "mvn clean install" on command line or in Eclipse IDE with the runs configurations like "clean" and "install" all test will be runs fine and don´t occurs some error. But if I runs the JUnit test manually, one of these Junit test fails. But what is the reason, why maven doesn´t recognized this fact? Here is a code snippet of my maven pom.xml file: org.apache.maven.plugins maven-compiler-plugin 2.0.2 true true ${source.jdk} ${target.jdk} org.apache.maven.plugins maven-surefire-plugin 2.16 false org.apache.maven.plugins maven-assembly-plugin jar-with-dependencies false ${source.jdk} ${target.jdk} <Project-Build-SourceEncoding>${project.build.sourceEncoding}</Project-Build-SourceEncoding> ${maven.build.timestamp} <addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> true lib/ ${project.groupId}.${project.artifactId}.MainClass false jar-with-dependencies assembly-jar-Id package single Here is the Junit code which fails: public void testProperties(){ String build_time = Parameters.BUILD_TIME.getParameter(); Map<String, String> allProperties = MetaInformation.Properties(); for(Map.Entry<String, String> currentEntry : allProperties.entrySet()){ if(currentEntry.getKey().equals(build_time)){ String project_build_value = currentEntry.getValue(); Assert.assertEquals(true, build_time_value != null && build_time_value.equals("")); } } } The Property File includes the following values: buildTime=${timestamp} encoding=${project.build.sourceEncoding} The Junit test, which is reading out the value "buildTime" is failed. "timestamp" is a value, which based on the pom.xml of my maven project. It gives me the the following properties: ${maven.build.timestamp} <maven.build.timestamp.format>dd.MM.yyyy HH:mm</maven.build.timestamp.format> ${maven.build.timestamp…
upvote count: 2
type: UnansweredQuestion
downvote count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/39352227
has answer: http://stackoverflow.com/a/25242606
has comment: http://stackoverflow.com/comment/39324145
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39324101
answer count: 1
has title: During Maven Build Junit Tests runs fine, but why they fails, if I runs JUnit test manually?

http://stackoverflow.com/a/25298055
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39430399
answers question: http://stackoverflow.com/q/25294401
has body: You could try implementing a ContainerRequestFilter and abort the request if the payload is null. requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST) .entity("Payload is null") .build()); https://jersey.java.net/documentation/latest/filters-and-interceptors.html
accepted answer of: http://stackoverflow.com/q/25294401
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/39518311
comment on: http://stackoverflow.com/q/25346512
has text: These are 3 different JSON objects. If you are saying a JSON file, then all these objects must be wrapped within a single JSON Object, else it is invalid.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25232034
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39311610
has body: Suppose you have a prototype bean class as below: @Component @Scope("prototype") public class Foobar { private String foo; public Foobar( String foo ) { this.foo = foo; } } So, is it possible to use @Autowired to wire such a bean in another class, which should use the non-default constructor Foobar(String foo) to instantiate the bean? update In the example above, the constructor parameter, String foo, is not available from application context but rather dynamic. So, having the constructor annotated with @Autowired and then specifying foo somewhere in the context doesn't seem an ideal solution here.
upvote count: 17
linked to: http://stackoverflow.com/q/7358825
tagged with: spring
favorite count: 0
has answer: http://stackoverflow.com/a/27074867
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39306448
score: 17
has answer: http://stackoverflow.com/a/25232079
has title: spring: how to use non-default constructor when auto-wiring a prototype bean using @Autowired and context:component-scan?
has answer: http://stackoverflow.com/a/25232238
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/39584279
comment on: http://stackoverflow.com/a/25374472
has text: @Davor That's what I thought. And so I agree—there's nothing erroneous about this. There is something *very* troubling about the combination of facts (1) `Object` supertypes everything and (2) `Object` has any methods at all, such as `toString`. The problem is that this means you implicitly sacrifice *parametricity* which is instrumental to much of the safety and comprehension properties of Haskell's types.
score: 4
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39576223
has text: Ok, so I assumed it was just a simple Form<Users> userForm = Form.form(Users.class); that I passed to my template. And I still cannot get the auto-binding working... The generated form is fine, everything is OK when I manually check the values.
comment on: http://stackoverflow.com/a/25366197
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39532854
comment on: http://stackoverflow.com/q/25355299
score: 0
has text: @Squonk i have alot of them, which one should i?
type: Comment
type: QuestionComment

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

http://stackoverflow.com/q/25234860
accepted answer: http://stackoverflow.com/a/25234871
score: 0
answer count: 1
tagged with: jsp
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/35614753
has answer: http://stackoverflow.com/a/25234871
tagged with: java
tagged with: mysql
has title: How do I pass a JSP (HTML) table's row to a servlet?
tagged with: servlets
type: Question
duplicate of: http://stackoverflow.com/q/35614753
has body: This is the code I have: CourseID SectionNo Add Info <% while(rs.next()){ %> <%=rs.getString("CourseID") %> <%=rs.getInt("SectionNo") %> <% } %> I'm pulling information from a database and putting them into their respective columns in a table. So it looks like: |Course --- Section --- (Button)| When I have a user click the submit button I want to be able to pass along the data from the entire row. I've tried hidden input in this way: <%=rs.getString("CourseID") %> <input type="hidden" name="Course" value="<%rs.getString("CourseID") %>"> It just results in some strange table formatting and didn't work.

http://stackoverflow.com/comment/39503036
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25337893
type: Comment
has text: Take it easy guys! I appreciate either one of you for your help. I just tried to vote the answer which was the most comprehensive. :)

http://stackoverflow.com/a/25386394
score: 12
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25383286
type: Answer
answers question: http://stackoverflow.com/q/25383286
has body: Ok. My problem was hidden in the code i didnt post. I thought this detailsService is only to get additional details but it is used for the login itself. I had "jdbcAuthentication" configured additionally and spring seemed to use this always. Now that i only got the detailsService configured everything works fine. edit.: so i only had to delete this code: auth.jdbcAuthentication() .dataSource(dataSource) * .passwordEncoder(passwordEncoder) .usersByUsernameQuery( // .... And now it also works with my code in the question above.
upvote count: 12

http://stackoverflow.com/a/25314079
has body: Use this regex replacement: line = line.replaceAll("\\s+(?!\w)", ""); It replaces all whitespaces, which aren't followed by a word character (digit or alphabet or underscore) to nothing. Also, remove line = line.trim();, it's unnecessary to have it since the regex will handle. Here is a regex demo!
answers question: http://stackoverflow.com/q/25314004
score: 0
type: Answer

http://stackoverflow.com/comment/39562747
comment on: http://stackoverflow.com/q/25370837
has text: if you are calling this function "writeToFileEEGPower(String data)" in a loop, it sets isHeader variable to true everytime you call it.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25339537
has comment: http://stackoverflow.com/comment/39506488
has answer: http://stackoverflow.com/a/59719443
has comment: http://stackoverflow.com/comment/95852183
favorite count: 0
upvote count: 4
has answer: http://stackoverflow.com/a/50550674
type: Question
score: 2
downvote count: 2
has answer: http://stackoverflow.com/a/74191328
type: UnansweredQuestion
has body: I cam across this codility test, the problem was to spot a bug in the function and adjust it so that it worked properly. The array passed to the function is {1,3,3} and K =2. The function is supposed to return false if K is not found in the array, but it is returning true. You were only allowed to alter 2 lines of code. public static bool solution(int[] A, int K) { int n = A.Length; for (int i = 0; i &lt; A.Length - 1; i++) { if (A[i] + 1 &lt; A[i + 1]) return false; } if (A[0] == 1 &amp;&amp; A[n - 1] != K) return false; else return true; } In normal circumstances I would just rewrite the function given that I know what it is supposed to do: public static bool solution(int[] A, int K) { int n = A.Length; int count = 0; for (int i = 0; i &lt; A.Length - 1; i++) { if (A[i] == K) { count++; } } if (count == 0) return false; else return true; }
has answer: http://stackoverflow.com/a/54528299
has comment: http://stackoverflow.com/comment/41744619
has answer: http://stackoverflow.com/a/35875429
has title: Codility - function alteration
tagged with: java
has comment: http://stackoverflow.com/comment/41744643
answer count: 5

http://stackoverflow.com/comment/39462809
type: QuestionComment
has text: @WillMarcouiller - I agree with you. I would return the value directly because it's less confusing.
score: 1
comment on: http://stackoverflow.com/q/25316590
type: Comment

http://stackoverflow.com/comment/39467322
comment on: http://stackoverflow.com/q/25319116
has text: gotcha. haven't thought abt it this way, yet. but if we look at it once more from the author's perspective: wouldnt it be eventually a matter of precedence given that no matter what access modifiers we add the situation stays the same! - at least inside Person
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/70163286
answers question: http://stackoverflow.com/q/25238110
downvote count: 0
upvote count: 1
has body: If you are using java1.8 and cannot directly use sun.nio.ch.DirectBuffer and Cleaner, you can try: public void clean(final ByteBuffer buffer) { AccessController.doPrivileged((PrivilegedAction<Object>) () -> { try { Field field = buffer.getClass().getDeclaredField("cleaner"); field.setAccessible(true); Object cleaner = field.get(buffer); Method cleanMethod = cleaner.getClass().getMethod("clean"); cleanMethod.invoke(cleaner); } catch (Exception e) { e.printStackTrace(); } return null; }); }
score: 1
type: Answer

http://stackoverflow.com/comment/39367999
comment on: http://stackoverflow.com/q/25265734
score: 0
has text: What is the value of `customers[0].getClass().getName()`?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39493621
has text: Azar it makes it easier to read and since this kid is a beginner it will make it easier to read for him
comment on: http://stackoverflow.com/a/25332867
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39575530
type: QuestionComment
comment on: http://stackoverflow.com/q/25377618
has text: Simple, do not ovveride service :)
score: 0
type: Comment

http://stackoverflow.com/comment/39569940
has text: Thousand of thanks to you @Elliot. This method is much easy and efficient.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25374639

http://stackoverflow.com/q/25305731
has title: Java scriptlet to remove duplicate in string separated by | (delimiter)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39442257
score: 0
has comment: http://stackoverflow.com/comment/39443442
has body: I have a String that looks like "(doc1| doc1| provid| geestt| stable)". It represents an array and I want to remove any duplicates from it so that doc1 appears only once. How can I do this?
upvote count: 1
has comment: http://stackoverflow.com/comment/39442520
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25306639
linked to: http://stackoverflow.com/q/13486479
has comment: http://stackoverflow.com/comment/39442323
type: Question
has answer: http://stackoverflow.com/a/25306639
tagged with: java
has comment: http://stackoverflow.com/comment/39442116
tagged with: scriptlet
has comment: http://stackoverflow.com/comment/39442159

http://stackoverflow.com/comment/39352450
type: Comment
has text: check my edit, it has nothing to do with "some computation". Also read the JLS part about compile time constants.
type: AnswerComment
comment on: http://stackoverflow.com/a/25253372
score: 0

http://stackoverflow.com/comment/39442891
comment on: http://stackoverflow.com/a/25301981
type: Comment
type: AnswerComment
has text: code you have posted has no code for any thing like downloading data etc. you said you want to get data from server? do you have API of server you need to call to get required data? do you have any sample output json of that api?
score: 0

http://stackoverflow.com/a/25383696
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25383286
has comment: http://stackoverflow.com/comment/39589081
has comment: http://stackoverflow.com/comment/39590199
has body: Create Extention class: public class CustomUserDetails extends org.springframework.security.core.userdetails.User{ private User user; public CustomUserDetails(User user, Collection&lt;? extends GrantedAuthority&gt; authorities) { super(user.getName(), user.getPassword(), authorities); this.user = user; } public CustomUserDetails(User user, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection&lt;? extends GrantedAuthority&gt; authorities) { super(user.getName(), user.getPassword(), enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); this.user = user; } public User getUser() { return user; } } Than add it to UserDetailsService: @Service("userDetailsService") public class UserDetailsServiceImpl implements UserDetailsService { public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException { UserDetails userDetails = null; User user = userService.getByLogin(login); userDetails = new CustomUserDetails(user, true, true, true, true, getAuthorities(user.getRole())); return userDetails; } Get it! (CustomUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()
type: Answer
has comment: http://stackoverflow.com/comment/39589563
upvote count: 2

http://stackoverflow.com/q/25259602
tagged with: java
has body: I'm learning java after having programmed in C++ for a while, and I'm wondering if you can dynamically allocate an array in java as you do in C++. Say in C++ we do: int* array = new int[arraySize]; //allocate an array delete[] array; //delete it Can you do the same in java or is there a java equivalent that basically does the same thing? Thanks!
type: Question
has comment: http://stackoverflow.com/comment/39356885
has title: java equivalent of dynamically allocated arrays in C++
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39356774
tagged with: arrays
has comment: http://stackoverflow.com/comment/39356795
has comment: http://stackoverflow.com/comment/39357129
tagged with: c++
has answer: http://stackoverflow.com/a/25259731
has answer: http://stackoverflow.com/a/25259627
score: 0
has comment: http://stackoverflow.com/comment/39356827
answer count: 2

http://stackoverflow.com/a/25275053
has body: InetAddress address = server.getAddress().getAddress(); System.out.println("Client ip is: " + address.getHostAddress()); This code above should give you the address. If you still get 0s for the IP, then there could be some permission issues.
score: -2
upvote count: 0
downvote count: 2
answers question: http://stackoverflow.com/q/25274828
type: Answer

http://stackoverflow.com/comment/39373996
type: QuestionComment
comment on: http://stackoverflow.com/q/25268510
has text: Yours **is not** a case of heap pollution. Also, there's nothing wrong in what you're currently doing and adding `@SupressWarnings`. I would really focus on this problem if it raises an exception at runtime and it is demonstrated by stacktrace or usage of a profiler.
score: 0
type: Comment

http://stackoverflow.com/comment/39527110
type: AnswerComment
has text: Thanks for the tip, servlet impl version is 3.0 and I'll give it a try!
comment on: http://stackoverflow.com/a/25350893
type: Comment
score: 0

http://stackoverflow.com/comment/39556341
comment on: http://stackoverflow.com/q/25367321
type: Comment
has text: That's the question I was referring to seeing-- all of the answers appeared to be either update java or update ant. Since I have a 1.9 version of Ant, is the protocol to add my issue in the comments to that one, or open a new question?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39322148
score: 0
has text: Are you sure you want an *applet*, and not, say, a Swing GUI?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25241133

http://stackoverflow.com/a/25346399
answers question: http://stackoverflow.com/q/25345885
downvote count: 3
score: 1
has body: You probably need a two-way GridView like this: https://github.com/jess-anders/two-way-gridview both horizontal and vertical options are supported.
upvote count: 4
type: Answer
has comment: http://stackoverflow.com/comment/108300532

http://stackoverflow.com/a/25271913
accepted answer of: http://stackoverflow.com/q/25271894
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25271894
downvote count: 0
has comment: http://stackoverflow.com/comment/63894230
has body: Solution This is no runtime reflection cost solution because it does all the reflection at compile/build/package time. import com.google.appengine.api.ThreadManager; import com.googlecode.objectify.ObjectifyFactory; import com.googlecode.objectify.ObjectifyService; import com.googlecode.objectify.annotation.Entity; import org.reflections.Reflections; import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * This class processes the classpath for classes with the @Entity or @Subclass annotations from Objectify * and registers them with the ObjectifyFactory, it is multi-threaded and works very fast! */ public class ObjectifyLoaderContextListener implements ServletContextListener { private static final Logger L = LoggerFactory.getLogger(ObjectifyLoaderContextListener.class); private final Set<Class<?>> entities; public ObjectifyLoaderContextListener() { this.entities = new HashSet<>(); } @Override public void contextInitialized(@Nonnull final ServletContextEvent sce) { final ExecutorService es = Executors.newCachedThreadPool(ThreadManager.currentRequestThreadFactory()); cb.setExecutorService(es); final Reflections r = Reflections.collect(); this.entities.addAll(r.getTypesAnnotatedWith(Entity.class)); es.shutdown(); final ObjectifyFactory of = ObjectifyService.factory(); for (final Class<?> cls : this.entities) { of.register(cls); L.debug("Registered {} with Objectify", cls.getName()); } } @Override public void contextDestroyed(@Nonnull final ServletContextEvent sce) { /* this is intentionally empty */ } } Updates to this class will be available in this gist.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/103336315
score: 2

http://stackoverflow.com/a/25299530
has comment: http://stackoverflow.com/comment/39431016
type: Answer
accepted answer of: http://stackoverflow.com/q/25299489
has comment: http://stackoverflow.com/comment/39431063
score: 2
answers question: http://stackoverflow.com/q/25299489
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: // Get system time Date date = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); You are creating 1 Date variable and you use it: Here: JStartTimeTextField.setText(dateFormat.format(date)); and here JEndTimeTextField.setText(dateFormat.format(date)); When you initialize the date, it does not change as time progresses. For this code to work as expected, you need to get the new date and time at the end of the program instead of using the once you initialized in the beginning. //The processes end Date newDate = new Date(); JEndTimeTextField.setText(dateFormat.format(newDate));

http://stackoverflow.com/a/27534354
has body: This Link Helped me a lot. As what is said in the link above, you should increase the size of memory used by eclipse. Just open the eclipse.ini file, located in the same folder as eclipse.exe is located by a text editor. The original eclipse.ini file looks like this: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140116-2212 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m Now change the last 2 lines to: -Xms512m -Xmx1024m You can also increase the value of MaxPermSize, as the following: -XX:MaxPermSize=1024m This solution helped me and solve my problem. Good luck
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25329879

http://stackoverflow.com/comment/39578248
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25369755
has text: Exactly what I was after. Thank you
type: Comment

http://stackoverflow.com/comment/39589563
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25383696
type: Comment
has text: can you debug your app and say what class will return `SecurityContextHolder.getContext().getAuthentication().getPrincipal()` ?

http://stackoverflow.com/a/25275612
answers question: http://stackoverflow.com/q/25275386
accepted answer of: http://stackoverflow.com/q/25275386
score: 1
type: Answer
has body: There shouldn't be - however you could also just do items.findAll {Math.ceil(it.price) &gt; 0}
downvote count: 0
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25278700
downvote count: 0
has comment: http://stackoverflow.com/comment/39391764
has comment: http://stackoverflow.com/comment/39391706
type: Answer
accepted answer of: http://stackoverflow.com/q/25278634
has body: Let's assume for a moment, you have the source code and you're trying to introduce this into your own program, then I would recommend using some kind of FIFO queue. Each time one of these buttons is pressed, you pop it onto the queue. When you need to determine the order, you simply pop off the items and they will come out in order. Have a look at Queue Implementations and Introduction to Collections for more details Now, having said that, you could simply use a List, this will maintain an order of items (from first to last), but will allow duplicates, so you could up with [B1, B1, B1, B2, B1] for example. If you want uniqueness (no duplicates) then some kind of Set would be more useful
answers question: http://stackoverflow.com/q/25278634
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/25338941
downvote count: 0
tagged with: swing
has body: I'm sure someone has asked this question before, but my google-fu is not strong today. I have a JFrame that uses a CardLayout as its manager. How do I run a "Start" method when I switch to each JPanel without using a switch? The code I use to add the frames to the layout is: /** * Adds JPanels to the Card Layout. * @param panel is the JPanel to add to the layout. * @param windowName is the identifier used to recognise the Panel. */ public final void addToCards(final JPanel panel, final WindowNames windowName) { view.getBasePanel().add(panel, windowName.getValue()); } The code I use to switch the layout is: /** * Method to change the JPanel currently visible on the BasePanel. * @param windowName is the name of the JPanel to change to. */ public final void changePanel(final WindowNames windowName) { view.getCardLayout().show(view.getBasePanel(), windowName.getValue()); } Currently I have an ActionListener set that will call the switch code, but I can't work out how to call the "Start" method within the screen that it will be switching to. I have an interface setup for each of the JPanels so that the method name will be identical in each.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39504603
has answer: http://stackoverflow.com/a/25341104
possible better answer: http://stackoverflow.com/a/25341104
accepted answer: http://stackoverflow.com/a/25339133
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39504498
tagged with: java
favorite count: 0
type: Question
tagged with: cardlayout
answer count: 2
has answer: http://stackoverflow.com/a/25339133
has comment: http://stackoverflow.com/comment/39504697
has title: Running a method after switching cards in cardlayout
tagged with: user-interface

http://stackoverflow.com/q/25364807
answer count: 1
has body: I have spent a few days trying to get a VBO working on Android using OpenGL ES 2.0, but I just can't seem to get it to work. Here is the code I am using: /* The Android shader code */ private static final String[] androidVertexShaderCode = new String[] { "attribute vec4 vertexPosition;", "void main() {", " gl_Position = vertexPosition;", "}" }; private static final String[] androidFragmentShaderCode = new String[] { "precision mediump float;", "uniform vec4 colour;", "void main() {", " gl_FragColor = colour;", "}" }; /* The Android shader */ public Shader androidShader; /* The constructor with the render mode and the * number of vertex values given */ public AndroidRenderer(int renderMode, int vertexValuesCount) { super(renderMode, vertexValuesCount); //Add this renderer to the list allRenderers.add(this); usage = GLES20.GL_STATIC_DRAW; //Setup the Android shader this.androidShader = new AndroidShader(); this.androidShader.vertexShader = ShaderUtils.createShader(ArrayUtils.toStringList(androidVertexShaderCode), Shader.VERTEX_SHADER); this.androidShader.fragmentShader = ShaderUtils.createShader(ArrayUtils.toStringList(androidFragmentShaderCode), Shader.FRAGMENT_SHADER); this.androidShader.create(); } /* The method used to setup the buffers, * assumes the vertices have already been set */ public void setupBuffers() { //Create the vertices buffer this.verticesBuffer = BufferUtils.createFlippedBuffer(this.verticesData); int[] vh = new int[1]; GLES20.glGenBuffers(1, vh, 0); //Setup the vertices handle this.verticesHandle = vh[0]; //Bind the vertices buffer and give OpenGL the data GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, this.verticesHandle); GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, Float.BYTES * verticesData.length, this.verticesBuffer, this.usage); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); //Check to see whether the normals have been set if (this.normalsData != null) { //Create the normals buffer this.normalsBuffer = BufferUtils.createFlippedBuffer(this.nor…
favorite count: 0
type: Question
tagged with: vbo
has comment: http://stackoverflow.com/comment/39551916
type: UnansweredQuestion
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25366080
tagged with: glsles
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/39550829
has title: Android OpenGL ES 2.0 VBO
downvote count: 0
linked to: http://stackoverflow.com/q/4850025
upvote count: 1

http://stackoverflow.com/a/25562333
answers question: http://stackoverflow.com/q/25370221
type: Answer
downvote count: 0
upvote count: 1
has body: You can try using gvNIX framework (based on Spring-roo) that implements functionalities to works easily with jasper reports and other interesting functionalities. Visit the following links to learn more about gvNIX framework: http://github.com/disid/gvnix http://code.google.com/p/gvnix/ And here you have an example about how to implement an application with jasper reports using gvNIX: http://github.com/DISID/gvnix-samples/tree/master/quickstart-app#reports Best Regards,
score: 1

http://stackoverflow.com/comment/39326325
comment on: http://stackoverflow.com/a/25241511
has text: set the created value in attribute and then retrieve the attribute value in that jsp page.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25338717
has body: I guess the MongoConverter in specific version of your spring-data-mongodb.jar works incorrectly. Spring must convert your ClassC instance into DBObject format, then call DBCollection.save to save data into database. You can check the content of DBObject parameter in method "com.mongodb.DBCollection.save" whether it contains correct data as you expect. I copy your ClassC with complete structure and test, it's fine and cannot reproduce what you described above. I use spring-data-mongdb-1.2.3-RELEASE.jar. What's the version you adopt?
accepted answer of: http://stackoverflow.com/q/25237986
has comment: http://stackoverflow.com/comment/39511174
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39537714
answers question: http://stackoverflow.com/q/25237986
score: 3
upvote count: 3
type: Answer

http://stackoverflow.com/comment/39446336
type: Comment
comment on: http://stackoverflow.com/a/25307975
score: 0
type: AnswerComment
has text: Even I use it in resource file, still I have to change it when upload to linux. Because linux path starts from /usr/ But in windows there nothing like that. It use the relative path from D drive.

http://stackoverflow.com/a/25316652
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39462470
answers question: http://stackoverflow.com/q/25316411
downvote count: 0
score: 4
has body: While using a setter in the constructor reduces code duplication, calling overrideable methods (ie non final / non private methods) in a constructor is discouraged - it can lead to weird bugs when extending a class. Consider the following case (based off of your example): public class Object { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } //Changed this.name = name to setName(name) public Object(String name){ setName(name); } } With the following subclass: public class SubObject extends Object { private String Id; @Override public void setName(String name) { super.setName(name + Id); } public SubObject(String name){ super(name); this.id = "1"; } } Creating an instance of SubObject will cause a null pointer, as setName() is called in the constructor, but the implementation of setName() relies on the Id field having been initialized. Someone extending a class should not have to go check the source code of the super class to ensure the constructor isn't calling overrideable methods.

http://stackoverflow.com/a/25343935
answers question: http://stackoverflow.com/q/25343823
score: 0
has body: Try the example available on Android website: Creating a Navigation Drawer. Download the example and walk through it. Its pretty easy. This is how I built my first app with a navigation drawer.
type: Answer

http://stackoverflow.com/q/25319163
has title: Android Pixel Perfect Alignment
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39467311
upvote count: 1
score: 1
favorite count: 0
type: Question
has body: I'm creating a bar at the top of my app much like the one above. The graphics are embedded into the background and the numbers that represent the level etc is using TextViews. As you can see the TextView has to be pixel(dp) perfect to fit in the center of the white bar thingy. With some margins or padding i can achieve that. But how do games like that keep the same pixel perfect across all devices? I know about resource qualifiers and such but some devices within the same bucket have different sizes. Is there a good way or trick to achieve the perfect centering across most devices?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39467645
has comment: http://stackoverflow.com/comment/39467955
has answer: http://stackoverflow.com/a/25330518
tagged with: android
has comment: http://stackoverflow.com/comment/39467327
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/25348008
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39521460
has title: Java xpath parsing unable to parse correctly
type: Question
tagged with: xpath
has body: I wrote a small code for parsing html pages using xpath. My problem is that this code works for some pages and does not work for other one. Would you please guide me what possibly caused such problem? I did some debug and my first guess is that I did not properly use Html cleaner. public static void main(String args[]) throws Exception { javax.xml.xpath.XPath xpath = XPathFactory.newInstance().newXPath(); try { NodeList nodes = (NodeList) xpath.evaluate("html/body/div[3]/div/div[2]/div[1]/div[1]/div/h1", readDocument(), XPathConstants.NODESET); for (int i = 0; i &lt; nodes.getLength(); i++) { System.out.println(nodes.item(i).getTextContent()); } } catch (XPathExpressionException e) { e.printStackTrace(); } System.out.println(""); } private static Document readDocument() throws IOException { java.net.URL url = new java.net.URL( "http://en-maktoob.news.yahoo.com/medical-team-asks-obese-saudi-wait-death-home-072857829.html"); java.net.URLConnection conn = url.openConnection(); conn.addRequestProperty("User-Agent", "Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1"); BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream(), "UTF-8")); CleanerProperties props = new CleanerProperties(); props.setTranslateSpecialEntities(true); props.setTransResCharsToNCR(true); props.setOmitComments(true); TagNode tagNode = new HtmlCleaner(props).clean(reader); Document doc = null; try { doc = new DomSerializer(new CleanerProperties()).createDOM(tagNode); return doc; } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } This code should extract the text inside xpath pattern and simply print that. But in the required example does not work. Solution: I found out that the problem caused by the fact that I used absolute xpath and probably this time of xpath can be changed after compiling html page in browser. The main problem solved by using relative xpath but I c…
has comment: http://stackoverflow.com/comment/39524035
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25354201
tagged with: htmlcleaner
has comment: http://stackoverflow.com/comment/39519956
has comment: http://stackoverflow.com/comment/39519837
tagged with: html-parsing
has comment: http://stackoverflow.com/comment/39519803
has comment: http://stackoverflow.com/comment/39520019

http://stackoverflow.com/a/25349635
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25349576
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25349576
has body: You should use MultiAutoCompleteTextView for multiple words Here is a good example of that Comma is the default separator for MultiAutoComplete, you can set it to space delimiter, please have a look at this post to achieve that. Have a look at this post to for space delimiter.
type: AcceptedAnswer

http://stackoverflow.com/a/25241687
has body: You might try the following unregistration process for a single device (uninsalling the app and later reinstalling). (Note, this is from Google Cloud Messaging advanced documentation here) How unregistration works An application can be automatically unregistered after it is uninstalled from the device. However, this process does not happens right away, as Android does not provide an uninstall callback. What happens in this scenario is as follows: The end user uninstalls the application. The 3rd-party server sends a message to GCM server. The GCM server sends the message to the device. The GCM client receives the message and queries Package Manager about whether there are broadcast receivers configured to receive it, which returns false. The GCM client informs the GCM server that the > application was uninstalled. The GCM server marks the registration ID for deletion. The 3rd-party server sends a message to GCM. The GCM returns a NotRegistered error message to the 3rd-party server. The 3rd-party deletes the registration ID. Note: The GCM client is the Google Cloud Messaging framework present on the device. Note that it might take a while for the registration ID be completely removed from GCM. Thus it is possible that messages sent during step 7 above gets a valid message ID as response, even though the message will not be delivered to the device. Eventually, the registration ID will be removed and the server will get a NotRegistered error, without any further action being required from the 3rd-party server (this scenario happens frequently while an application is being developed and tested).
score: 2
answers question: http://stackoverflow.com/q/25240974
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/39312935
has text: What are the "loads of errors"? Provide some of them here.
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25236044
type: Comment

http://stackoverflow.com/comment/39319037
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25239461
has text: are you sure you are using the same buffer size for receiving as the socket uses for sending? and maybe loop?

http://stackoverflow.com/q/25243871
favorite count: 0
type: Question
score: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39327394
has answer: http://stackoverflow.com/a/25243916
has title: How to use Log in Android
type: AnsweredQuestion
upvote count: 3
downvote count: 0
answer count: 1
has body: I am learning android and i would like check data by function Log. Now i have code: http://cecs.wright.edu/~pmateti/Courses/436/Lectures/20110920/SimpleNetworking/src/com/androidbook/simplenetworking/FlickrActivity2.java.txt This working ok, Log.i also, but i would like add own Log: XmlPullParserFactory parserCreator = XmlPullParserFactory.newInstance(); XmlPullParser parser = parserCreator.newPullParser(); parser.setInput(text.openStream(), null); status.setText("Parsing..."); int parserEvent = parser.getEventType(); while (parserEvent != XmlPullParser.END_DOCUMENT) { //START MY CODE!!! XmlPullParser.START_TAG Log.i("Test1", parserEvent); Log.i("Test2", XmlPullParser.START_TAG); //END MY CODE!!! switch(parserEvent) { case XmlPullParser.START_TAG: String tag = parser.getName(); if (tag.compareTo("link") == 0) { String relType = parser.getAttributeValue(null, "rel"); if (relType.compareTo("enclosure") == 0 ) { String encType = parser.getAttributeValue(null, "type"); if (encType.startsWith("image/")) { String imageSrc = parser.getAttributeValue(null, "href"); Log.i("Net", "image source = " + imageSrc); } } } break; } parserEvent = parser.next(); } status.setText("Done..."); but i have error: The method i(String, String) in the type Log is not applicable for the arguments (String, int) Why the second parameter is int? How can i check value with Log same as in JavaScript console.log?
accepted answer: http://stackoverflow.com/a/25243916

http://stackoverflow.com/q/25370502
answer count: 3
score: 0
tagged with: arrays
type: Question
has answer: http://stackoverflow.com/a/25370544
has comment: http://stackoverflow.com/comment/39561789
accepted answer: http://stackoverflow.com/a/25370604
has body: I am making a card game and I have the following section of code (a small excerpt): Hand[] hands; hands = new Hand[t]; for (i = 1; i &gt; t; i++) { hands[i] = new Hand(); } public class Hand { Hand() { Card[] hand; hand = new Card[52]; } } How would I access the array in the Hand object? For example, let's say I had a instance of the Hand class called hand1, how would I access the array hand in the hand1 object? Doing hand1.hand[x] did not work.
has answer: http://stackoverflow.com/a/25370547
tagged with: java
has answer: http://stackoverflow.com/a/25370604
possible better answer: http://stackoverflow.com/a/25370544
has title: How to access a array in a instance
type: AnsweredQuestion

http://stackoverflow.com/comment/39518911
type: AnswerComment
comment on: http://stackoverflow.com/a/25345877
has text: even when i use "file://" or when i use "File file = new File( context.getFilesDir(), filename );", it does not work and the file actually exist on my android devices (i used intent to select a file and get the path)
type: Comment
score: 0

http://stackoverflow.com/comment/39388033
score: 1
type: Comment
type: QuestionComment
has text: What is it actually matching? Are all of the games in a single file? If so, you probably just need to change your `.*`s to `.*?`s. By default `*` is greedy and will match as much as it possibly can. You could also use `(?:1-0|0-1)` to make that a non-capture group.
comment on: http://stackoverflow.com/q/25276477

http://stackoverflow.com/comment/39583928
comment on: http://stackoverflow.com/q/25382192
type: QuestionComment
has text: @stealthjong the brace placement to *Allman Style* is my fault, sorry about that (i just put it in the autoformatter and that's how i have it set because I prefer it despite the conventions) - it was still a better alternative than the original version :p
type: Comment
score: 0

http://stackoverflow.com/comment/39447575
comment on: http://stackoverflow.com/a/25295944
has text: Hi Alcanzar- tried that, but not working. Indexing with GMT time only
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25260684
has body: I would like to programmatically expand a particular JMenuItem in a JPopup. For example in the code below import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; public class AutoExpandSubMenusDemo extends JFrame { private final JPopupMenu popup = new JPopupMenu("Popup"); public AutoExpandSubMenusDemo() { setDefaultCloseOperation(EXIT_ON_CLOSE); JMenu menuB = new JMenu("B"); menuB.add(new JMenuItem("X")); JMenuItem menuY = menuB.add(new JMenuItem("Y")); menuB.add(new JMenuItem("Z")); popup.add(new JMenuItem("A")); popup.add(menuB); popup.add(new JMenuItem("C")); final JButton button = new JButton("Show Popup Menu"); button.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { popup.show(button, 0, button.getHeight()); // Show menuY } }); JPanel buttonPanel = new JPanel(); buttonPanel.add(button); getContentPane().add(buttonPanel); } public static void main(String[] args) { AutoExpandSubMenusDemo f = new AutoExpandSubMenusDemo(); f.setSize(500, 300); f.setVisible(true); } } I would like to expand the popup menu so that the items B(menuB)/Y(menuY) are expanded and selected when the button is pressed. Sorry if this is something that's easy to do but I've searched around and can't figure it out. I did find the MenuSelectionManager.defaultManager().setSelectedPath(...) however this didn't work when I tried it and the javadoc specifies that it is called from the LaF and should not be called by clients. Any help is much appreciated.
has answer: http://stackoverflow.com/a/25263238
score: 6
upvote count: 6
tagged with: jmenuitem
tagged with: jpopupmenu
has comment: http://stackoverflow.com/comment/39361044
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39360059
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39359828
tagged with: swing
accepted answer: http://stackoverflow.com/a/25262528
tagged with: jmenu
favorite count: 0
has answer: http://stackoverflow.com/a/25262528
has title: Programmatically expand sub JMenuItems
type: Question
possible better answer: http://stackoverflow.com/a/25263238
tagged with: java

http://stackoverflow.com/comment/39346234
type: Comment
type: QuestionComment
has text: Your code does not compile; it looks like you are missing backslashes from your string literal - can you please correct the code, so we can see exactly what your input string is.
comment on: http://stackoverflow.com/q/25253451
score: 0

http://stackoverflow.com/q/25294167
has comment: http://stackoverflow.com/comment/39423594
possible better answer: http://stackoverflow.com/a/31028250
has body: I am trying to upgrade my Jenkins on a Solaris SPARC machine. I have been using Jenkins version 1.528 and the java version is "1.6.0_65". I tried to install 1.565.1 on this server, I was able to start it using "java -jar jenkins.war --httpPort=8086" Aug 13, 2014 2:52:16 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started SelectChannelConnector@0.0.0.0:8086 Aug 13, 2014 2:52:16 PM winstone.Logger logInternal INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled Aug 13, 2014 2:52:18 PM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Aug 13, 2014 2:52:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Aug 13, 2014 2:52:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Aug 13, 2014 2:52:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Aug 13, 2014 2:52:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Aug 13, 2014 2:52:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Aug 13, 2014 2:52:37 PM org.jenkinsci.main.modules.sshd.SSHD start INFO: Started SSHD at port 54927 Aug 13, 2014 2:52:37 PM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Aug 13, 2014 2:52:37 PM hudson.TcpSlaveAgentListener &lt;init&gt; INFO: JNLP slave agent listener started on TCP port 54928 Aug 13, 2014 2:52:37 PM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running but the homepage never loads on browser. I see there is something listening on the port but the connnetion is in CLOSE_WAIT status. bash-3.2$ lsof -i |grep 8086 java 26329 acs 7u IPv4 0x3018556b840 0t0 TCP *:8086 (LISTEN) java 26329 acs 105u IPv4 0x30278e93900 0t0 TCP server:8086-&gt;user-machine:54670 (ESTABLISHED) java 26329 acs 750u IPv4 0x300b9af9900 0t0 TCP server:8086-&gt;user-machine:54671 (CLOSE_WAIT) java 26329 acs 751u IPv4 0x301ab4f0080 0t0 TCP server:8086-&gt;user-machine:54672 (CLOSE_WAIT) I tried other version 1.532 and it worked but it did not work for…
type: Question
answer count: 2
tagged with: jenkins
has comment: http://stackoverflow.com/comment/39423541
has title: Jenkins on Solaris 10 64 bit
has answer: http://stackoverflow.com/a/31028250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39420746
score: 0
has answer: http://stackoverflow.com/a/33831209
accepted answer: http://stackoverflow.com/a/33831209
tagged with: installation
tagged with: java
tagged with: solaris-10
has comment: http://stackoverflow.com/comment/39589629

http://stackoverflow.com/comment/39450557
has text: How would you suggest changing it? `getBean` is a method provided to me by [Spring](http://spring.io/). I'm not sure I follow how to modify the test code to allow the bean to be created in a more flexible manner. Did you possibly mean to say "My opinion is to change the code that is under test to allow for more flexible bean creation"? If that's the case then I think I am with you and I need to start entering "refactor land" since what I am trying to do doesn't seem possible with spring at runtime.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25309179

http://stackoverflow.com/comment/39462082
type: QuestionComment
score: 0
has text: Good point, I'll update the answer.
comment on: http://stackoverflow.com/q/25315729
type: Comment

http://stackoverflow.com/a/25332521
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39492843
accepted answer of: http://stackoverflow.com/q/25332249
has comment: http://stackoverflow.com/comment/39492799
has comment: http://stackoverflow.com/comment/39493018
score: 0
answers question: http://stackoverflow.com/q/25332249
type: Answer
has body: If you are not using any IDE, Use -cp option while compiling Salary to specify where to find the Employee class file.

http://stackoverflow.com/comment/39618161
type: AnswerComment
comment on: http://stackoverflow.com/a/25390332
type: Comment
has text: Do you declare the relationship inside the @Embeddable class?
score: 0

http://stackoverflow.com/q/25352995
type: Question
has comment: http://stackoverflow.com/comment/39528668
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39528658
linked to: http://stackoverflow.com/q/5958186
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26197220
tagged with: for-loop
has answer: http://stackoverflow.com/a/25353034
tagged with: arrays
upvote count: 1
has body: I am in the process of learning Java and am very confused on multidimensional arrays. When I say this I don't mean the array syntax but more so the logic of using arrays with for statements. What I am wondering is how do I incorporate arrays into for statements correctly and what does all of the code in play do, and why is it there. Here is some code I have been working on (based off a tutorial) and was wondering if someone could fully explain everything that is going on. package tutorial; public class apples { public static void taco(String[] args) { int firstarray[][]={{8,9,10,11},{12,13,14,15}}; int secondarray[][]={{30,31,32,33},{43},{4,5,6}}; System.out.println("This is the first array"); display(firstarray); System.out.println("This is the second array"); display(secondarray); } public static void display(int x[][]) { for (int row=0;row&lt;x.length;row++) { for (int column=0;column&lt;x[row].length;column++) { System.out.println(x[row][column]+"\t"); } System.out.println(); } } So what I don't understand is the entire public static void display(int x[][]) { for (int row=0;row&lt;x.length;row++) { for (int column=0;column&lt;x[row].length;column++) { System.out.println(x[row][column]+"\t"); If someone could explain that in more depth that would be great. I get for statements and arrays in general, im just confused with how this works.
has answer: http://stackoverflow.com/a/32731941
has title: Java Multidimensional Arrays
downvote count: 1
has comment: http://stackoverflow.com/comment/39528677
favorite count: 0

http://stackoverflow.com/comment/39556868
type: Comment
comment on: http://stackoverflow.com/q/25283931
score: 0
type: QuestionComment
has text: Assuming some suitable definition of _matching_, either write a custom chooser or highlight the problem once a matching color is chosen.

http://stackoverflow.com/a/25315915
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25313419
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25313419
has body: Figured it out. My save function should have assigned the employee I was creating to each job: public void saveEmployee(String firstname, String lastname, List&lt;Job&gt; jobs) { Employee employee1 = new Employee(); employee1.setFirstName(firstname); employee1.setLastName(lastname); for (Job job : jobs) { job.setEmployee(employee1); } employee1.setJobList(jobs); entityManager.persist(employee1); } I also needed to add a foreign key constraint to my employeeID column in my jobs table: &lt;changeSet id="0003" author="mparker"&gt; &lt;addForeignKeyConstraint baseTableName="jobs" baseColumnNames="employeeID" constraintName="FK_jobs_employeeID_employees_employeeID" referencedTableName="employees" referencedColumnNames="employeeID"/&gt; &lt;/changeSet&gt; Thanks for the suggestions, everyone.
score: 1

http://stackoverflow.com/q/25371805
has comment: http://stackoverflow.com/comment/39564668
has answer: http://stackoverflow.com/a/25371863
has comment: http://stackoverflow.com/comment/39564482
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39564486
score: 3
has answer: http://stackoverflow.com/a/25372020
upvote count: 5
has comment: http://stackoverflow.com/comment/39564819
has comment: http://stackoverflow.com/comment/39564796
has body: I was just messing around the Integer.toBinaryString(int) method. When I pass a positive number say 7, it outputs 111 but when I pass negative 7, it outputs 11111111111111111111111111111001. I understand that Java uses 2's complement to represent negative numbers, but why 32 bits (I also know that an int is 32 bits long but doesn't fit in the answer)?
tagged with: integer
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25372020
has title: Why Integer.toBinaryString returns 32 bits if the argument is negative?
possible better answer: http://stackoverflow.com/a/25371854
answer count: 3
has comment: http://stackoverflow.com/comment/39564616
tagged with: java
has answer: http://stackoverflow.com/a/25371854
tagged with: bit-manipulation
downvote count: 2

http://stackoverflow.com/q/25301392
answer count: 3
has comment: http://stackoverflow.com/comment/39434277
has answer: http://stackoverflow.com/a/25301731
has comment: http://stackoverflow.com/comment/39434251
upvote count: 1
tagged with: java
tagged with: indexoutofboundsexception
downvote count: 1
accepted answer: http://stackoverflow.com/a/25301603
tagged with: substring
favorite count: 0
type: Question
has body: My Program seems to Produce an String Index out of Range Error only for this Particular Input. The same code is working for other inputs. Will add the Output Screenshot and Code Below. I searched around - The fact that this error turns up only for a Single Input makes it tough to solve. int ind,len,vallen,amount,credits = 0; String credit; String value,item; float oneamount; // System.out.println("Credit Assignment"); ind=input.indexOf("is"); credit = input.substring(0, ind-1); // System.out.println(credit); //Seperate the Quantity and Item Name from the String len = credit.length(); vallen= credit.lastIndexOf(" "); value= credit.substring(0,vallen); //**Line 59** item = credit.substring(vallen,len).trim(); System.out.println(value);
tagged with: indexoutofrangeexception
has answer: http://stackoverflow.com/a/25301471
has comment: http://stackoverflow.com/comment/39434365
has comment: http://stackoverflow.com/comment/39434252
has comment: http://stackoverflow.com/comment/39434166
has comment: http://stackoverflow.com/comment/39434375
has comment: http://stackoverflow.com/comment/39434185
has answer: http://stackoverflow.com/a/25301603
has comment: http://stackoverflow.com/comment/39434324
has comment: http://stackoverflow.com/comment/39434244
possible better answer: http://stackoverflow.com/a/25301471
has title: Specific String Produces StringOutOfBoundsException
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25357373
answers question: http://stackoverflow.com/q/25356776
type: Answer
score: 0
has body: Before constructing the url you have to segregate individual QueryString values and Encode those following way... import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class UrlencodeTest { public static void main(String[] args) throws UnsupportedEncodingException { String baseUrl="http://example.com"; String finalUrl=baseUrl + "?a=" + encode("this is") + "&amp;b=" + encode(":url encoding:"); System.out.println(finalUrl); } public static String encode(String str) throws UnsupportedEncodingException{ return URLEncoder.encode(str,"UTF-8"); } }

http://stackoverflow.com/q/25306077
score: 2
tagged with: performance
has comment: http://stackoverflow.com/comment/39443852
tagged with: filter
has title: Java's Lambda Stream Filter Count is Slower than For and Foreach Loop
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/41195052
has comment: http://stackoverflow.com/comment/39445760
linked to: http://stackoverflow.com/q/22658322
has body: I am very interested in Java's new feature, Lambda. Besides giving concise and clear code, it also improve performance by using Stream and not creating objects. I created a simple test to create a bunch of random numbers and then count how many of it is bigger than 49. I am surprised that the regular for and foreach loop gives better performance. This is the code that I used: long numberOfData = 20000000; Random random = new Random(); IntStream intStream = random.ints(0, 100); List&lt;Integer&gt; rand = intStream.limit(numberOfData) .boxed() .collect(Collectors.toList()); // Iterate using "Lambda" OffsetTime startL = OffsetTime.now(); long countL = rand.stream() .filter(x -&gt; x &gt; 49) .count(); OffsetTime endL = OffsetTime.now(); Duration durationL = Duration.between(startL, endL); System.out.println("[Lambda ] " + countL + " / " + numberOfData + " in " + durationL.toMillis() + "ms"); // Iterate using "Foreach" int countFE = 0; OffsetTime startFE = OffsetTime.now(); for (int aNumber : rand) { if (aNumber &gt; 49) { countFE++; } } OffsetTime endFE = OffsetTime.now(); Duration durationFE = Duration.between(startFE, endFE); System.out.println("[Foreach] " + countFE + " / " + numberOfData + " in " + durationFE.toMillis() + "ms"); // Iterate using "For" int countF = 0; int maxLoop = rand.size(); OffsetTime startF = OffsetTime.now(); for (int i = 0; i &lt; maxLoop; i++) { if (rand.get(i) &gt; 49) { countF++; } } OffsetTime endF = OffsetTime.now(); Duration durationF = Duration.between(startF, endF); System.out.println("[For ] " + countF + " / " + numberOfData + " in " + durationF.toMillis() + "ms"); First run result: [Lambda ] 10002783 / 20000000 in 325ms [Foreach] 10002783 / 20000000 in 296ms [For ] 10002783 / 20000000 in 195ms Second run result (and so on is similar): [Lambda ] 10000408 / 20000000 in 330ms [Foreach] 10000408 / 20000000 in 304ms [For ] 10000408 / 20000000 in 202ms Note: I am using JDK 1.8.0_11 running on Eclipse Luna 4.4.0 for Windows. All are 32-bit…
type: Question
has answer: http://stackoverflow.com/a/27701998
upvote count: 3
has comment: http://stackoverflow.com/comment/39445524
type: UnansweredQuestion
answer count: 1
tagged with: lambda
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/81001530

http://stackoverflow.com/comment/39581711
score: 0
type: Comment
type: QuestionComment
has text: You can send and recieve data from JSP to java through AJAX..
comment on: http://stackoverflow.com/q/25380845

http://stackoverflow.com/q/25313085
tagged with: optimization
has comment: http://stackoverflow.com/comment/39456202
type: AnsweredQuestion
score: 0
tagged with: performance
tagged with: java
tagged with: profiling
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25313176
tagged with: algorithm
has title: Performance improvement of a RandomAccessBuffer
has body: I use a pdf library to convert PDF to images. This process needs a lot of time and I took a profiler to find the cause of the problem and it all came down (>60% CPU time) one method. Now my question is: Can this method be further improved? public int read(byte[] b) throws IOException { if (buf==null) throw new IOException("Data buffer not initialized."); if (pointer&lt;0 || pointer&gt;=length) return -1; int length=this.length-(int)pointer; if(length&gt;b.length) length=b.length; for (int i=0; i&lt;length; i++) { buf.seek(pointer++); b[i] = buf.readByte(); } return length; }
has comment: http://stackoverflow.com/comment/39622144
has answer: http://stackoverflow.com/a/25313176

http://stackoverflow.com/a/25373727
accepted answer of: http://stackoverflow.com/q/25373578
answers question: http://stackoverflow.com/q/25373578
score: 1
type: Answer
has body: Doesn't matter. Just get it in your Java program. You don't have a problem. Preferences node = Preferences.userRoot().node("config"); //node.put("logo", "\\IguanaSistemas\\IguanaFight\\imagens\\logo.png"); String s = node.get("logo", "blah"); System.out.println(s); Prints the correct string.
downvote count: 0
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39576039
type: QuestionComment
has text: @Nadeem did you set an id when you created it dynamically? If you didn't then there is no id to get.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25377224

http://stackoverflow.com/a/25303429
type: Answer
has comment: http://stackoverflow.com/comment/39439984
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/39438225
has body: You can get the name of the class and method it was thrown from like this: StackTraceElement ste = exception.getStackTrace()[0]; String className = ste.getClassName(); String methodName = ste.getMethodName(); But you can't get the Method object because the StackTraceElement does not record which of the methods with the same name. You can get the possible Method objects (possible as with matching name) like this: StackTraceElement ste = exception.getStackTrace()[0]; Class&lt;?&gt; c = Class.forName(ste.getClassName()); String mname = ste.getMethodName(); // NOTE: // Exceptions thrown in constructors have a method name of "&lt;init&gt;" // Exceptions thrown in static initialization blocks have a method name of // "&lt;cinit&gt;" if ("&lt;init&gt;".equals(mname)) { // Constructors are the possible "methods", all of these: c.getConstructors(); } else if ("&lt;cinit&gt;".equals(mname)) { System.out.println("Thrown in a static initialization block!"); } else { // Thrown from a method: for (Method m : c.getMethods()) { if (m.getName().equals(mname)) { System.out.println("Possible method: " + m); } } }
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25303232
has comment: http://stackoverflow.com/comment/39440575
accepted answer of: http://stackoverflow.com/q/25303232
has comment: http://stackoverflow.com/comment/39438431
has comment: http://stackoverflow.com/comment/39442506

http://stackoverflow.com/comment/39315419
type: QuestionComment
comment on: http://stackoverflow.com/q/25237366
has text: Where does `word` come from? It is not in scope, I guess. + what icza sais.
score: 0
type: Comment

http://stackoverflow.com/q/25258927
tagged with: java
downvote count: 0
tagged with: maven-2
favorite count: 0
has body: My Maven Project Structure is The project runs well If I try to run it through eclipse as JUnitTest (CucumberRunnerTest.java). But if I try executing it through maven then I get the below error: The pom is as below: 4.0.0 com.ericsson MavenCuke 1.0-SNAPSHOT jar MavenCuke http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <cucumber-jvm.version>1.1.8</cucumber-jvm.version> <selenium.version>2.42.2</selenium.version> <junit.version>4.11</junit.version> <cucumber.options>--format pretty --tags @Search</cucumber.options> org.codehaus.mojo exec-maven-plugin 1.3.2 integration-test java test cucumber.api.cli.Main --format junit:output/cucumber-junit-report/allcukes.xml --format pretty --format html:output/cucumber-html-report --format json:output/cucumber_report.json --glue src\ src\main\resource\com\ericsson\ info.cukes cucumber-picocontainer ${cucumber-jvm.version} info.cukes cucumber-junit ${cucumber-jvm.version} test org.seleniumhq.selenium selenium-java ${selenium.version} com.google.guava guava 18.0-rc1 junit junit ${junit.version} test info.cukes cucumber-jvm-deps 1.0.3 info.cukes cucumber-html 0.2.2 test info.cukes gherkin 2.12.2 info.cukes gherkin-jvm-deps 1.0.2 info.cukes cucumber-java ${cucumber-jvm.version} test net.masterthought cucumber-reporting 0.0.23 test info.cukes cucumber-core ${cucumber-jvm.version} test org.seleniumhq.selenium selenium-server ${selenium.version} org.testng testng 6.1.1 When run from command prompT******* mvn integration-test [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MavenCuke --- [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MavenCuke --- [INFO] Building jar: C:\Users\esusadh\MavenCucumber\MavenCuke\target\MavenCuke-1.0-SNAPSHOT.jar [INFO] [INFO] --- exec-maven-plugin:1.3.2:java (default) @ MavenCuke --- [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please commenon MEXEC-6. Feature: Navigating into ericsson.com and verify text In order to…
type: Question
has title: Unable to run Cucumber tests from maven
score: 3
possible better answer: http://stackoverflow.com/a/35358826
tagged with: eclipse
has answer: http://stackoverflow.com/a/35358826
accepted answer: http://stackoverflow.com/a/25258998
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25258998
answer count: 2
tagged with: cucumber-junit
upvote count: 3

http://stackoverflow.com/a/25240143
has body: You cannot guarantee that the holder.getPosition() will get the same position values you set using holder.setPosition(i) as the getHolder call is part of a different thread and is called by multiple threads. This is because you are sharing the same PlaceHolder across all threads. If you want to get the output you desire, I would suggest using a different instance of PlaceHolder for each thread. import java.util.ArrayList; import java.util.List; public class TaskExample { public static void main(String[] args) throws InterruptedException { final List&lt;Integer&gt; data = new ArrayList&lt;Integer&gt;(); List&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;(); for (int i = 0; i &lt; 20; i++) { // Create new instance final PositionHolder holder = new PositionHolder(i); Thread t = new Thread() { @Override public void run() { data.add(holder.getPosition()); } }; t.start(); threads.add(t); for (Thread thread : threads) { thread.join(); } for(int i : data){ System.out.println(i); } } class PositionHolder { private int position = 0; public PositionHolder(int position) { this.position = position; } public int getPosition() { return this.position; } }`
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25240016

http://stackoverflow.com/comment/39452932
comment on: http://stackoverflow.com/a/25311322
has text: Thanks for answering. I just realized my problem is my cookies get lost every time I close the application so when I make a new request to the API is like I never logged in. I guess I could just save the cookieStore instance in onPause() and restore it in onResume(), right?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25316605
favorite count: 0
downvote count: 0
score: 1
upvote count: 1
answer count: 1
tagged with: integer-division
type: Question
has comment: http://stackoverflow.com/comment/39462510
has comment: http://stackoverflow.com/comment/39462534
has comment: http://stackoverflow.com/comment/39462429
tagged with: java
has title: Math result is off by powers of ten
type: UnansweredQuestion
has body: I just learned how to use static methods. I am trying to calculate the gravity of each planet with this code: /** * Calculates the acceleration due to gravity on each planet, and then displays the info in a nice table and in a text file * * @author Ely Eastman * @version 14.8.2014 */ public class GravityV1 { //method for calulating gravity public static double [] gravCalc(double [] d, double [] m){ double[] gravFinal = new double [d.length]; for(int i = 0; i &lt; d.length; i++){ gravFinal[i] = ((6.67 * 10E-11) * m[i]) / Math.pow(((d[i] * 1000) / 2) , 2); } return gravFinal; } //method for printing to console public static void printer(String [] s, double [] d, double [] m, double [] g){ System.out.println(" Planetary Data"); System.out.println(" Planet Diameter (km) Mass (kg) g (m/s^2) "); System.out.println("------------------------------------------------------------"); for(int i = 0; i &lt; s.length; i++){ System.out.printf(" %-7s%15.0f%17.2E%15.2f\n", s[i], d[i], m[i], g[i]); } } //method to print to text file public static void textCreator(){ //havent gotten to this method yet because it is essentially the same as the one above. } //main method public static void main(String[] args){ //variables double [] planetDiameter = {4880, 12104, 12756, 6794, 142984, 120536, 51118, 49352}; double [] planetMass = {3.30E23, 4.87E24, 5.97E24, 6.24E23, 1.9E24, 5.68E26, 8.68E25, 1.02E26}; double [] planetGrav = gravCalc(planetDiameter, planetMass); String [] planetNames= {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}; printer(planetNames, planetDiameter, planetMass, planetGrav); } } Everything works fine, except for the gravity column in the table, where everything prints one power of ten higher, except jupiter, which prints three powers of ten lower. image of my output below, since it won't format without putting a lot of spaces in. output of program http://postimg.org/image/3oou8o8qt/3ab32a54/ I know its probably a simple error, but at this s…
has answer: http://stackoverflow.com/a/25316698

http://stackoverflow.com/a/61210022
downvote count: 0
answers question: http://stackoverflow.com/q/25295089
type: Answer
has body: Depending on your case it might actually be "doable". In particular, if you only have one instance of "Parameters", for example because you are passing the environment (development, beta...), then you could do: private String suiteBrand; @Parameters({"Brand"}) @BeforeSuite public void setUp (final String Brand) { suiteBrand = Brand; } @Test(dataProvider="dpCGA", groups={"CGA"}) public void createAccount(String email) { brand = suiteBrand; setBrand(brand); createAccount(email); } BeforeSuite will be executed with the parameters and you can access them in the test that is parameterized by the data provider. It might work with more than one parameter, or with @BeforeEach, but I haven't tried that.
has comment: http://stackoverflow.com/comment/129515615
upvote count: 2
score: 2

http://stackoverflow.com/comment/39517367
comment on: http://stackoverflow.com/q/25340222
score: 0
type: Comment
type: QuestionComment
has text: Yes I found it.Thanks.

mediametadataretriever
tags question: http://stackoverflow.com/q/25367292
type: Tag
tag name: mediametadataretriever

http://stackoverflow.com/a/59719443
downvote count: 1
answers question: http://stackoverflow.com/q/25339537
type: Answer
score: -1
has body: this is possible with java 8 you need to do below changes 1 - change the if condition in the for loop - create a list of type Integer - and then check contains note - list of int will not work - the contains will not work on it 2 - the second return statement to return true and that is how can you get it done by changing just 2 lines public static boolean sol (int[] a , int k){ int n = a.length; for(int i=0;i&lt;n-1;i++){ if(! Arrays.stream( a ).boxed().collect( Collectors.toList() ).contains(k)){ return false; } } if(a[0]!=1 &amp;&amp; a[n-1]!=k){ return true; } else{ return true; } }
upvote count: 0

http://stackoverflow.com/a/25277899
score: 0
has body: This kind of java.lang.ClassNotFoundException can manifest sometimes when a dependent class is not available. Make sure that you application has access to the dependent jars as well, such as: commons-beanutils commons-digester commons-logging etc
has comment: http://stackoverflow.com/comment/39390544
type: Answer
answers question: http://stackoverflow.com/q/25244221

servlets
tags question: http://stackoverflow.com/q/25312277
tags question: http://stackoverflow.com/q/25263946
tags question: http://stackoverflow.com/q/25268716
tags question: http://stackoverflow.com/q/25347360
tags question: http://stackoverflow.com/q/25362984
tags question: http://stackoverflow.com/q/25230964
tags question: http://stackoverflow.com/q/25251476
tags question: http://stackoverflow.com/q/25377618
tags question: http://stackoverflow.com/q/25287593
tags question: http://stackoverflow.com/q/25282442
tags question: http://stackoverflow.com/q/25345371
tags question: http://stackoverflow.com/q/25279302
tags question: http://stackoverflow.com/q/25380264
tags question: http://stackoverflow.com/q/25343955
tags question: http://stackoverflow.com/q/25284707
tags question: http://stackoverflow.com/q/25358141
tags question: http://stackoverflow.com/q/25236036
tags question: http://stackoverflow.com/q/25251779
tags question: http://stackoverflow.com/q/25269531
tags question: http://stackoverflow.com/q/25356703
tags question: http://stackoverflow.com/q/25253501
tags question: http://stackoverflow.com/q/25274288
tags question: http://stackoverflow.com/q/25234860
tags question: http://stackoverflow.com/q/25267369
tags question: http://stackoverflow.com/q/25297316
tags question: http://stackoverflow.com/q/25281571
tags question: http://stackoverflow.com/q/25351168
tags question: http://stackoverflow.com/q/25250025
tags question: http://stackoverflow.com/q/25299753
tags question: http://stackoverflow.com/q/25365542
tags question: http://stackoverflow.com/q/25360131
tags question: http://stackoverflow.com/q/25247218
tags question: http://stackoverflow.com/q/25242750
tags question: http://stackoverflow.com/q/25377467
tags question: http://stackoverflow.com/q/25252052
tags question: http://stackoverflow.com/q/25292927
tags question: http://stackoverflow.com/q/25371379
tags question: http://stackoverflow.com/q/25366924
tags question: http://stackoverflow.com/q/25256768
tags question: http://stackoverflow.com/q/25376067
tags question: http://stackoverflow.com/q/25293886
tags question: http://stackoverflow.com/q/25332064
tags question: http://stackoverflow.com/q/25306170
tag name: servlets
tags question: http://stackoverflow.com/q/25368590
tags question: http://stackoverflow.com/q/25320097
tags question: http://stackoverflow.com/q/25281962
tags question: http://stackoverflow.com/q/25305380
type: Tag
tags question: http://stackoverflow.com/q/25364377
tags question: http://stackoverflow.com/q/25280300
tags question: http://stackoverflow.com/q/25385802
tags question: http://stackoverflow.com/q/25341483
tags question: http://stackoverflow.com/q/25376630
tags question: http://stackoverflow.com/q/25264088
tags question: http://stackoverflow.com/q/25300103
tags question: http://stackoverflow.com/q/25248681
tags question: http://stackoverflow.com/q/25239348
tags question: http://stackoverflow.com/q/25327797
tags question: http://stackoverflow.com/q/25250352
tags question: http://stackoverflow.com/q/25330713
tags question: http://stackoverflow.com/q/25335269
tags question: http://stackoverflow.com/q/25359147
tags question: http://stackoverflow.com/q/25389354
tags question: http://stackoverflow.com/q/25370221
tags question: http://stackoverflow.com/q/25356188
tags question: http://stackoverflow.com/q/25378001
tags question: http://stackoverflow.com/q/25354038
tags question: http://stackoverflow.com/q/25317682

http://stackoverflow.com/a/25360821
upvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25360664
downvote count: 0
has body: You need to know the package name before initializing the object. Without it you wouldn't be able to distinct two classes with the same name from two separate packages. If you had two classes test1.MyClass and test2.MyClass which one should be chosen in your code: String desiredClass = "MyClass"; Class.forName(desiredClass); So You need to know the package name in advance and do something like: String desiredClass = "test1.myClass";

http://stackoverflow.com/q/25286763
has title: can the database definition be updated with simple changes in the Class in Java Hibernate
type: Question
score: 0
has body: Using Java and hibernate, I was wondering that if I can change the Database definition after creation, just by making changes to my existing Entity Class. Will the Changes be reflected in the Database??? Is it Possible??? I tried and Failed. I have tried update But getting error, if it is still possible, here is my code. /** * Description of bankbranchcontactdetailsBean * * @author Vishal Jain @ TurtleTec Inc. */ package com.beans; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Id; import javax.persistence.Column; import javax.persistence.Temporal; import javax.persistence.UniqueConstraint; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import java.io.Serializable; import java.util.Date; @Entity(name = "bankbranchcontactdetails") @Table(name = "bankbranchcontactdetails", schema = "stserptest", uniqueConstraints = { @UniqueConstraint(columnNames = "BankBranchContactId") }) @TableGenerator(name = "bankbranchcontactdetailsgen", table = "bankbranchcontactdetails", pkColumnName = "BankBranchContactId") public class bankbranchcontactdetailsBean extends SuperBeanClass implements SuperBeanInterface, Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(columnDefinition = "INT(10) UNSIGNED", name = "BankBranchContactId", precision = 10, scale = 0, nullable = false, unique = true) private Integer Id; @Column(columnDefinition = "INT(10) UNSIGNED", name = "BankBranchId", precision = 10, scale = 0, nullable = false) private Integer _BankBranchId; @Column(columnDefinition = "ENUM('PHONE','MOBILE','FAX','TELEX')", name = "ContactTypeModified", length = 6, nullable = false) private String _ContactTypeModified; @Column(columnDefinition = "VARCHAR(20)", name = "Contact", length = 20, nullable = false) private String _Contact; @Column(columnDefinition = "INT(10) UNSIGNED", name = "NewField", precision = 10, scale = 0, nullable = true) private Inte…
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/15868270
has answer: http://stackoverflow.com/a/25286947
duplicate of: http://stackoverflow.com/q/15868270
type: UnansweredQuestion
answer count: 1

xml-parsing
tags question: http://stackoverflow.com/q/25321368
type: Tag
tags question: http://stackoverflow.com/q/25324218
tags question: http://stackoverflow.com/q/25237674
tag name: xml-parsing
tags question: http://stackoverflow.com/q/25287509

http://stackoverflow.com/q/25284294
has title: how to show on TextView 3 axes of accelerometer
type: Question
has body: I want to print the three values of each axes(scaledX , scaledY, scaledZ) of accelerometer in three TextView. Can somebody help me? thanks. CODE: MainActivity.java. public class MainActivity extends Activity implements BluetoothAdapter.LeScanCallback { private TextView mAccelerometerx, mAccelerometery, mAccelerometerz; mAccelerometerx =(TextView) findViewById(R.id.ejex); mAccelerometery =(TextView) findViewById(R.id.ejey); mAccelerometerz =(TextView) findViewById(R.id.ejez); private void updateAccelerometerValue(BluetoothGattCharacteristic characteristic ){ double accelerometerx = SensorTagData.extractAccelerometer(characteristic, mAccelerometerx); double accelerometery = SensorTagData.extractAccelerometer(characteristic, mAccelerometery); double accelerometerz = SensorTagData.extractAccelerometer(characteristic, mAccelerometerz); mAccelerometerx.setText(String.format("%.4f", accelerometerx)); mAccelerometery.setText(String.format("%.4f", accelerometery)); mAccelerometerz.setText(String.format("%.4f", accelerometerz)); } } SensorData.java public class SensorData { public static double [] extractAccelerometer(BluetoothGattCharacteristic c) { Integer x = c.getIntValue(FORMAT_SINT8, 0); Integer y = c.getIntValue(FORMAT_SINT8, 1); Integer z = c.getIntValue(FORMAT_SINT8, 2) * -1; double scaledX = x / 64.0; double scaledY = y / 64.0; double scaledZ = z / 64.0; return new double[] {scaledX, scaledY, scaledZ}; } }
type: UnansweredQuestion
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/25284698
has comment: http://stackoverflow.com/comment/39402400
tagged with: java
answer count: 1

http://stackoverflow.com/q/25240048
has title: https api response is getting cached with apache httpclient
has body: I am using Apache HTTPClient to make remote API call. This process runs via a cron. API responses are getting cached due to some reason. When i make same API call from rest client, it shows latest data. But, when process (woken up by cron) makes this call, it is getting cached response (not the latest data). What could be happening here?
tagged with: cron
tagged with: java
tagged with: caching
type: Question
score: 0
has answer: http://stackoverflow.com/a/25268871
type: UnansweredQuestion
answer count: 1
tagged with: httpclient

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25351323
tags question: http://stackoverflow.com/q/25353857
tags question: http://stackoverflow.com/q/25291568
tags question: http://stackoverflow.com/q/25253378
tags question: http://stackoverflow.com/q/25242212
tags question: http://stackoverflow.com/q/25244652
type: Tag
tags question: http://stackoverflow.com/q/25293928
tags question: http://stackoverflow.com/q/25360544

http://stackoverflow.com/a/25241207
has comment: http://stackoverflow.com/comment/39322317
answers question: http://stackoverflow.com/q/25240484
score: -3
type: Answer
has comment: http://stackoverflow.com/comment/39322618
upvote count: 0
has body: You can add this to your command line : mvn install -Dmaven.test.failure.ignore=true or use the below plugin in your pom.xml : org.apache.maven.plugins maven-surefire-plugin ${surefire.plugin.version} true So even if any of your test fails it will ignore and continue your build process without failures.
downvote count: 3
has comment: http://stackoverflow.com/comment/39322178

http://stackoverflow.com/q/25247006
favorite count: 0
has comment: http://stackoverflow.com/comment/39333337
tagged with: class
type: AnsweredQuestion
downvote count: 2
has title: Android Eclipse How Close Class
has comment: http://stackoverflow.com/comment/39333364
tagged with: android
tagged with: java
type: Question
upvote count: 0
has body: How can I close a Activity Class when the other is already loading? II can on the subject, unfortunately no data found either on google or here. Start Class if second Class = load = ture then close Start Class Thank you
has comment: http://stackoverflow.com/comment/39333406
score: -2
tagged with: kill
answer count: 1
has answer: http://stackoverflow.com/a/25247170
accepted answer: http://stackoverflow.com/a/25247170

http://stackoverflow.com/q/25377813
has comment: http://stackoverflow.com/comment/39577350
has comment: http://stackoverflow.com/comment/39577414
type: Question
has answer: http://stackoverflow.com/a/25378308
type: UnansweredQuestion
has title: Adding different JComboBoxes for different cells in a JTable
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/39576738
has comment: http://stackoverflow.com/comment/39576650
has comment: http://stackoverflow.com/comment/39575673
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/39577311
tagged with: jtable
has comment: http://stackoverflow.com/comment/39577443
has comment: http://stackoverflow.com/comment/39576009
score: 0
has body: Say I have an object representing a Person. Each person has a name, and a list of hobbies. Now, I want to create a table with 2 columns for the list of persons that I have. The first column will show the name of the person, and the second will show the list of hobbies in a combo box. The thing is, I iterate over my list of persons in order to populate the table. So I don't have a way to know at the beginning "row 1 will have combo box X, row 2 will have combo box Y and so on". I will only know these things at runtime. Got any ideas?
tagged with: java
has comment: http://stackoverflow.com/comment/39575727
answer count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39575562

http://stackoverflow.com/comment/39569077
comment on: http://stackoverflow.com/a/25374186
type: Comment
has text: @MadProgrammer Edited. I got distracted. Thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39426249
has text: I got the build.xml document generated, but now when I run the build again it gets further, but it fails saying that it is using an invalid resource directory name: {google services location}\bin\res/crunch. any ideas?
comment on: http://stackoverflow.com/a/25294251
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25291303
has comment: http://stackoverflow.com/comment/39415340
type: Answer
upvote count: 4
score: 4
has body: The first thing is: do you really need mixed="true"? This means that between all the child elements of a FooType you may also have content. This means that you need something to store a mixture of String (for the content before, between and after child elements), one Bar, one Baz and whatever comes for xs:any. Truly a wild mixture. Without mixed, xjc generates: public class FooType { @XmlElement(name = "Bar") protected BigInteger bar; @XmlElement(name = "Baz") protected byte[] baz; @XmlAnyElement(lax = true) protected List&lt;Object&gt; any; @XmlAttribute(name = "Moo", required = true) @XmlSchemaType(name = "anyURI") protected String moo; (Do you really need BigInteger??) If mixed="true" is required, you'll have to test the QName values. You might have had a small chance to avoid this if the classes of the List elements would be distinct, but String will occur vor the text children, the Baz element and later on ("any") everything is possible. Not sure what has motivated exactly this XML Schema design, but better alternatives aren't inconceivable.
accepted answer of: http://stackoverflow.com/q/25289910
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39415512
answers question: http://stackoverflow.com/q/25289910

http://stackoverflow.com/comment/39572531
has text: If you remember to keep sessions alive and not start new ones for every new call, it should work to emulate human behaviour. However, I would start with something simpler than an online banking site ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25375649
type: QuestionComment

http://stackoverflow.com/q/25262026
tagged with: swing
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39360934
tagged with: processbuilder
accepted answer: http://stackoverflow.com/a/25262100
has answer: http://stackoverflow.com/a/25262100
score: -1
possible better answer: http://stackoverflow.com/a/25262221
has body: There are many command lines like Using the command line(Avast), Using the Terminal to install or remove Sophos Anti-Virus for Mac OS X etc. for antivirus running but my requirement is to embed them in an GUI Application and then run from there. Basically it will be best to embed these command in Java Swing Application. But I have no idea how to do it, if any one has references to sources regarding this please let me know.
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25262221
upvote count: 0
tagged with: java
has title: How to integrate Antivirus Commands in Java Swing

http://stackoverflow.com/q/25377894
tagged with: task-queue
has body: According to the available documentation the app engine test helper class LocalServiceTestHelper can simulate the result from ApiProxy.getCurrentEnvironment().getRemainingMillis(). This all works fine as long as the code runs in the same thread as the helper is created but is seems that when the the test is multithreaded (such as when testing a Deferred task) the second thread will not use the simulated response. How do a get the helper class to set the return value of ApiProxy.getCurrentEnvironment().getRemainingMillis() in a task queue task?
has title: Unit testing request timeout in a task queue task
tagged with: unit-testing
favorite count: 0
type: Question
downvote count: 0
type: UnansweredQuestion
tagged with: google-app-engine
answer count: 1
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25389504

http://stackoverflow.com/q/25338362
tagged with: jar
tagged with: build
has title: Ant not able to locate external jar files. Showing java.lang.NoClassDefFound Error exception
tagged with: java
has body: I am creating a jar file using following target - <attribute name="Main-Class" value="${main.class}"/> and I'm trying to execute the jar file using following target - <java jar="${jar.dir}/TargetClass.jar" fork="true"/> I've used apache poi jar in my TragetClass which is located under D:/Jar directory. While executing it's not able to locate the poi jars and showing java.lang.NoClassDefFoundError exception.
has answer: http://stackoverflow.com/a/25339410
answer count: 1
type: Question
score: 0
type: UnansweredQuestion
tagged with: ant

http://stackoverflow.com/comment/39490510
type: QuestionComment
comment on: http://stackoverflow.com/q/25331328
type: Comment
score: 0
has text: @Jashaszun http://ideone.com/

http://stackoverflow.com/comment/57727506
type: AnswerComment
comment on: http://stackoverflow.com/a/30185258
score: 0
has text: `project>build>plugins>plugin(maven-compiler-plugin)>configuration>compilerArgument`
type: Comment

http://stackoverflow.com/comment/39351553
score: 0
type: Comment
type: QuestionComment
has text: Use String.Replace('\','"');
comment on: http://stackoverflow.com/q/25256539

http://stackoverflow.com/q/25356004
tagged with: sockets
has answer: http://stackoverflow.com/a/25356133
accepted answer: http://stackoverflow.com/a/25356133
has title: Piping output from an output stream to an input stream
possible better answer: http://stackoverflow.com/a/25356239
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25356239
tagged with: java
tagged with: piping
type: Question
has body: My problem is piping input from one socket to another. Currently, I am using this code: for(;;) { try { output2.write(input1.read()); } catch(Exception err) { err.printStackTrace(); } } Even though this technically works, is there a faster way to do this?

http://stackoverflow.com/a/25367281
score: 1
has comment: http://stackoverflow.com/comment/39555424
type: Answer
has body: You could use a Multimap it stores a Collection of entries for each key.
downvote count: 0
has comment: http://stackoverflow.com/comment/39555328
upvote count: 1
answers question: http://stackoverflow.com/q/25367229

http://stackoverflow.com/comment/39446496
score: 0
type: AnswerComment
has text: You don't seem to understand your own quotation, and I didn't say anything about Boolean variables, but you said that there is no way to ensure there is only one instance, and the specification provides you wrong. You're not making much sense here.
comment on: http://stackoverflow.com/a/25282770
type: Comment

http://stackoverflow.com/q/25317681
answer count: 2
has title: Only last added button is shown
tagged with: layoutparams
tagged with: java
has body: I am trying to add 9 buttons programmatically to a FrameLayout but only the last one is shown. The code below is for the first button and I am doing like that for all the other buttons, but with different coordinates. I want to add each button with these exact coordinates. Sorry for bad English ;) FrameLayout.LayoutParams rel_btn = new FrameLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Button button1 = new Button(this); button1.setBackgroundResource(R.drawable.empty); rel_btn.width = screenWidth/4; rel_btn.height = screenWidth/4; rel_btn.leftMargin = screenWidth/8; rel_btn.topMargin = screenHeight-1100; button1.setLayoutParams(rel_btn); rl.addView(button1);
has comment: http://stackoverflow.com/comment/39464936
tagged with: button
type: Question
has comment: http://stackoverflow.com/comment/39465006
tagged with: android-framelayout
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25317779
has answer: http://stackoverflow.com/a/25317739
has comment: http://stackoverflow.com/comment/39465062
linked to: http://stackoverflow.com/q/5401952
score: 0

http://stackoverflow.com/q/25379095
type: Question
score: 0
has title: How to handle Multitouch event in codenameone?
answer count: 1
type: AnsweredQuestion
tagged with: java
tagged with: codenameone
accepted answer: http://stackoverflow.com/a/25386732
has answer: http://stackoverflow.com/a/25386732
has body: I need to have a Multitouch event and I want to handle that in codenameone. How is it possible to implement this ?

http://stackoverflow.com/comment/39461786
score: 0
has text: This is because of visual editor. See `View.isInEditMode()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25315717

http://stackoverflow.com/comment/39318007
comment on: http://stackoverflow.com/q/25238548
score: 1
type: Comment
type: QuestionComment
has text: @TheLostMind is right. GC could be configured differently on devices.

http://stackoverflow.com/comment/39329452
type: Comment
type: QuestionComment
score: 0
has text: post a lot of code and people are going to skim. We assume the comments were copied from your code not put as part of the question.
comment on: http://stackoverflow.com/q/25244719

http://stackoverflow.com/comment/39517706
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25346666
score: 0
has text: I don't know the specifics of the API you are using, but would calling `message.addRecipient` twice (once for each email address) work? I ask this since the name `addRecipient` seems to imply you can call it more than once to "add" a recipient.

http://stackoverflow.com/q/25301724
has body: I use selendroid in order to test an hybrid application. I have my own logger which logs and also use WebDriverWait to wait for specific behavior. My question is how can I use my logger before WebDriverWait is failed and throws timeoutException?
tagged with: webdriver
tagged with: selendroid
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25303108
has title: How to add logs before WebDriverWait gets time-out
tagged with: selenium-webdriver
answer count: 2
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/30553024
downvote count: 0

http://stackoverflow.com/q/25267352
type: Question
has comment: http://stackoverflow.com/comment/39372919
has comment: http://stackoverflow.com/comment/39398834
has comment: http://stackoverflow.com/comment/39414011
type: UnansweredQuestion
has title: Listener doesn't work when changing Panel
score: 0
tagged with: java
tagged with: multithreading
answer count: 0
has body: i've got a problem with my program. I'm finishing to develop Pacman for my exam but I've a trouble when I change Panel from "menu" to "game" Panel. Precisely in the main frame I've added two Panel : the "menu" panel and the "game " one. If I don't add the menu panel , the game (and above all, the listener) works; but if I also add the menu panel, when I press the "start game" button in it , the "setVisible" property of menu will sets up to false and the new thread will starts. In this case the problem is that the listener doesn't work . public static void main(String[] args) { boolean gameOver = false; MainFrame mf = new MainFrame(FRAME_WIDTH, FRAME_HEIGHT, TITLE); // board is a logic map; gb is the graphic map of the game Board board = new Board(); GraphicBoard gb = new GraphicBoard(mf, board); gb.setLocation(150, 0); Background background = new Background(mf.getWidth(), mf.getHeight(), BACKGROUND_COLOR); background.add(gb); PacmanThread thread = new PacmanThread(gb, gameOver); Menu menu = new Menu(mf.getWidth(), mf.getHeight(), thread); mf.add(menu); mf.add(background); mf.setResizable(false); mf.setVisible(true); } In menu.java is present a subclass, so public class Menu extends JPanel{ public Menu(int pWidth, int pHeight, PacmanThread pThread) { this.setLayout(null); this.setSize(pWidth, pHeight); this.thread = pThread; initComponent(); } private class StartGame implements ActionListener { private Menu menu; public StartGame(Menu pMenu) { this.menu = pMenu; } @Override public void actionPerformed(ActionEvent e) { //&lt;--- is the problem here? what I should add? menu.setVisible(false); thread.start(); } } } Finally tha actionListener is present in a class called Pacman.java
tagged with: actionlistener

http://stackoverflow.com/a/25380379
score: 1
has comment: http://stackoverflow.com/comment/39607665
type: Answer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39609141
answers question: http://stackoverflow.com/q/25380050
has body: The recommended way of loading the Look-And-Feel is: SynthLookAndFeel laf = new SynthLookAndFeel(); laf.load(Truss.class.getResourceAsStream("laf.xml"), Truss.class); UIManager.setLookAndFeel(laf); source Your problem seems to be the way of loading your xml-resource. Therefore read about the difference of getting the streams here Additionally take a closer look at the tutorial

http://stackoverflow.com/comment/39603032
type: AnswerComment
comment on: http://stackoverflow.com/a/25389149
score: 0
type: Comment
has text: Thanks. I'll test it tomorrow and accept your answer.

http://stackoverflow.com/q/25286515
score: 0
has comment: http://stackoverflow.com/comment/39406352
answer count: 3
tagged with: java
tagged with: webdriver
has answer: http://stackoverflow.com/a/31802414
has answer: http://stackoverflow.com/a/25288186
has body: What is the code for selecting the date from date picker in selenium web driver ? We tried a lot on java selenium web driver codings ![Selenium Codings for Web driver] [https://i.sstatic.net/15gdR.png] Find the below attached screen shots
type: Question
tagged with: testing
has title: How to select date from date picker ion selenium web driver?
tagged with: automation
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/25290497

http://stackoverflow.com/comment/39565677
has text: This `loadedTiles != 8100` suggests you should be creating an array of 90x90. Fill the array with tiles in a separate function - do not draw them immediately, as you are doing now. Only draw the tiles in your screen update loop. There must be examples of this for the library you are using.
type: Comment
comment on: http://stackoverflow.com/a/25372347
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39434195
type: QuestionComment
has text: Is your Appengine pre 1.9.0? If so, you likely don't have a default bucket. You can create one by clicking Create within the Cloud Integration section in the Application Settings page of the App Engine Admin Console.
comment on: http://stackoverflow.com/q/25299288
type: Comment
score: 1

http://stackoverflow.com/comment/39587040
type: AnswerComment
comment on: http://stackoverflow.com/a/25367231
score: 0
type: Comment
has text: This is closer and I see where you were going with this 2nd update. I will try as well with a custom class, which was what I attempted first before reverting back to strictly the library. However the data must match exactly the following in terms of the expected output: { "stat": "ok", "page": 1, "total": 1, "rows": [ { "id":"1", "cell":[ "content of column 1", "content of column 2" ] } ] }

http://stackoverflow.com/q/25306503
downvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/25306784
upvote count: 0
has answer: http://stackoverflow.com/a/25306784
accepted answer: http://stackoverflow.com/a/25306581
score: -4
has comment: http://stackoverflow.com/comment/39443591
has answer: http://stackoverflow.com/a/25306581
favorite count: 0
has body: I have an android app which keeps updating logs every 5 minutes. I used Alarm Manager to achieve this. But the app kept opening and closing automatically. Is there any way to do this in background??
type: Question
has comment: http://stackoverflow.com/comment/39443609
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39443632
has title: Run Android app in background without user interaction
type: AnsweredQuestion

http://stackoverflow.com/q/25232458
has comment: http://stackoverflow.com/comment/39305834
has comment: http://stackoverflow.com/comment/39306341
has comment: http://stackoverflow.com/comment/39307746
has comment: http://stackoverflow.com/comment/39306728
has comment: http://stackoverflow.com/comment/39307613
has comment: http://stackoverflow.com/comment/39305884
has comment: http://stackoverflow.com/comment/39305935
has comment: http://stackoverflow.com/comment/39307034
has body: I am wondering why my SaxParser seems not to be able to resolve certain entities defined in an external dtd file. I am processing a huge xml file which has the following header. So the input is (heavily reduced :-)): // myxml.xml &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;!DOCTYPE authors SYSTEM "mydtd.dtd"&gt; &lt;authors&gt; &lt;author&gt; Bal&amp;aacute;zs &lt;/author&gt; &lt;/authors&gt; And this is the incorrect output: Bal ?zs Obviousely &amp;aacute; was not resolved! This is how I have set up the parser: // MySaxParser.java public class MySaxParser extends DefaultHandler { @Override public void characters(char[] ch, int start, int length) throws SAXException { if ("author".equals(currentTag)) { System.out.println(String.valueOf(Arrays.copyOfRange(ch, start, start + length))); } } static public void main(String[] args) throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false); spf.setNamespaceAware(true); spf.setValidating(true); // From what I understood from the API this combined // with '&lt;!DOCTYPE mydtd SYSTEM "mydtd.dtd"&gt;' from // the file myxml.xml should do the trick. What do I miss? SAXParser saxParser = spf.newSAXParser(); XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setContentHandler(new SAXLocalNameCount()); xmlReader.setErrorHandler(new MyErrorHandler(System.err)); xmlReader.parse("file:/path/to/myxml.xml"); } } What do I miss? Do I somehow have to do more than spf.setValidating(true) to make the parser aware of the dtd defined in the xml file header? I should mention that the dtd and xml are syntactically and semantically correct. The dtd contains &lt;!ENTITY aacute "&amp;#225;" &gt;&lt;!-- small a, acute accent --&gt; as a mapping for resolving. I donwloaded the files from a trusted source, so the error has to be in my Code. Update: As @eckes suggested, I printed the int values of the characters as they are passed into the method characters …
has comment: http://stackoverflow.com/comment/39307645
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/25233585
has comment: http://stackoverflow.com/comment/39305716
tagged with: dtd
has comment: http://stackoverflow.com/comment/39307388
has comment: http://stackoverflow.com/comment/39306853
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39307704
has comment: http://stackoverflow.com/comment/39305745
answer count: 1
tagged with: sax
has comment: http://stackoverflow.com/comment/39307292
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/3482494
has answer: http://stackoverflow.com/a/25233585
has title: How to resolve "questionmarks" when parsing a dtd validated XML document via Java SAXParser?
type: AnsweredQuestion

http://stackoverflow.com/q/25253378
has title: Android draw app
tagged with: opengl-es
type: Question
has comment: http://stackoverflow.com/comment/39383560
tagged with: graphics
has body: I am making simple game in Android. Main functionality is to draw path with brush so that path will stay after next graphics update. Im trying to use LibGDX currently. If I used ShapeRenderer I would have to remember all point and overlaying would be a problem. So I draw on Pixmap and then Pixmap on Texture. The graphics result is ok but I get laggs and low fps on slower devices. Can you help me with this problem or suggest some Android framework which simple "drawing on canvas" will not be a problem.
has comment: http://stackoverflow.com/comment/39351161
has comment: http://stackoverflow.com/comment/39357578
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
favorite count: 0
tagged with: libgdx
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39456787
type: Comment
type: QuestionComment
has text: You misunderstood me, I asked how COLUMNS look like. Which datatypes they accept. I'm not asking whether some records are inserted or not. I'm not familiar with luquidbase. Does first snippet of xml code show how columns look like?
comment on: http://stackoverflow.com/q/25313419
score: 1

http://stackoverflow.com/a/25323426
has comment: http://stackoverflow.com/comment/139653338
answers question: http://stackoverflow.com/q/25323202
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25323202
has body: The C++ standard states: With respect to an indeterminately-sequenced function call, the operation of a compound assignment is a single evaluation. [ Note: Therefore, a function call shall not intervene between the lvalue-to-rvalue conversion and the side effect associated with any single compound assignment operator. —end note ] §5.17 [expr.ass] Hence, as in the same evaluation you use X and a function with a side effect on X, the result is undefined, because: If a side effect on a scalar object is unsequenced relative to either another side effect on the same scalar object or a value computation using the value of the same scalar object, the behavior is undefined. §1.9 [intro.execution] It happens to be 11 on many compilers, but there is no guarantee that a C++ compiler won't give you 1 as for the other languages. If you're still skeptical, another analysis of the standard leads to the same conclusion: THe standard also says in the same section as above: The behavior of an expression of the form E1 op = E2 is equivalent to E1 = E1 op E2 except that E1 is evaluated only once. In you case X = X + f() except that X is evaluated only once. As there is no guarantee on the order of evaluation, in X + f(), you cannot take for granted that first f is evaluated and then X. Addendum I'm not a Java expert, but the Java rules clearly specify the order of evaluation in an expression, which is guaranteed to be from left to right in section 15.7 of Java Language Specifications. In section 15.26.2. Compound Assignment Operators the Java specs also say that E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)). In your Java program this means again that your expression is equivalent to X = X + f() and first X is evaluated, then f(). So the side effect of f() is not taken into account in the result. So your Java compiler doesn't have a bug. It just complies with the specifications.
has comment: http://stackoverflow.com/comment/39475032
has comment: http://stackoverflow.com/comment/39490859
score: 48
type: Answer
upvote count: 48
has comment: http://stackoverflow.com/comment/39475774
has comment: http://stackoverflow.com/comment/39480011

http://stackoverflow.com/comment/39321704
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25240856
has text: inside filehandler have it static and make sure to call the LastFile() before you pull the the fileHandler.lastFilePath
type: Comment

http://stackoverflow.com/comment/39539048
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25358675
score: 0
has text: As already mentioned you should not be using any `sun.*` packages as they are internal. It looks like this one has been moved in Java 8

http://stackoverflow.com/comment/39362075
has text: @JonSkeet I kind of agree with you here, but while DCL is a common idiom for lazy initialization (which just needs to be adjusted in Java), the static holder is a much more Java-specific thing. It also requires introducing additional abstraction (a new class) only for technical reasons.
score: 0
comment on: http://stackoverflow.com/q/25262353
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25362674
has comment: http://stackoverflow.com/comment/39546516
score: 2
upvote count: 2
answer count: 0
tagged with: java
downvote count: 0
tagged with: jersey-2.0
tagged with: tomcat7
has title: connection reset by peer in java
favorite count: 0
type: Question
tagged with: xampp
has comment: http://stackoverflow.com/comment/39546351
has comment: http://stackoverflow.com/comment/39547263
type: UnansweredQuestion
has body: Scenario:- Client application - JavaScript based Front-end processing - PHP hosted on Apache using XAMPP(php 5.3.8, xampp 1.7.7, Apache 2.2.21) Back-end processing - Java REST APIs hosted on Tomcat Description Browser send post data to php server , php validate and the modifies the post data according to it's need and then open a connection to back-end server(tomcat server hosting Jersey REST APIs) using curl , tomcat server then return the response to php which in-return is sent to the browser. Problem i am facing :- Tomcat server takes about 3 to 10 min to process the request(depending on the payload and type of request, higher the payload more is more is the execution time). When a higher payload request or time-taking request (7-10 mins) API is called a socket exception occurs stating "connection reset by peer" at the tomcat hosted REST APIs (Backend). Nothing happens at the front-end processing php logic. As connection is reset so Java REST API cannot send the response and as there is nothing happening on php so cannot course-correct anything happening. Now, if same time-consuming or payload wise API call is made through a REST Client (Chrome Extension) then APIs processes normally and return the response to REST Client. So it zeroes down to any issue on php or Apache front. Already Tried: in httpd-default.conf - KeepAlive on Timeout 2100 KeepAliveTimeout to 2100 in php curl call - curl_setopt($ch, CURLOPT_TIMEOUT,0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,20); or curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,20); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json ', 'Content-length: '.$len,//length of content 'Connection: keep-alive', 'Keep-Alive: 2100')); set_time_limit(0); xdebug turned off default_socket_timeout = 2100 and have played with a lots of combination, but no successful result. Note - There is nothing in Apache and Php log file or any exception occurring in Php script so I even cannot drill down where the issue is coming. EDIT…
tagged with: php

http://stackoverflow.com/q/25257400
has comment: http://stackoverflow.com/comment/39383739
favorite count: 0
type: Question
score: 12
answer count: 2
has answer: http://stackoverflow.com/a/25257911
has comment: http://stackoverflow.com/comment/39557290
type: UnansweredQuestion
tagged with: unsafe
upvote count: 13
has comment: http://stackoverflow.com/comment/39353007
has comment: http://stackoverflow.com/comment/39353378
has answer: http://stackoverflow.com/a/38290226
has title: moving objects off heap
has comment: http://stackoverflow.com/comment/39352994
has body: Did anyone try to move java objects off heap? I tried using serializing, deserializing and storing byte arrays by using Unsafe libraries. But complex objects with multiple objects in it making this a tedious process. Any better solutions?
tagged with: java
downvote count: 1

http://stackoverflow.com/q/25324920
has comment: http://stackoverflow.com/comment/39480665
has comment: http://stackoverflow.com/comment/39483252
has comment: http://stackoverflow.com/comment/39482151
linked to: http://stackoverflow.com/q/34785417
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39478325
has comment: http://stackoverflow.com/comment/39477857
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39480608
tagged with: mysql
has answer: http://stackoverflow.com/a/51035766
has comment: http://stackoverflow.com/comment/39477762
has title: JavaFX with MySql login form - NullPointerException
has comment: http://stackoverflow.com/comment/39477818
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38558708
linked to: http://stackoverflow.com/q/218384
has body: I am trying to make login form with java and mysql. I have user database with one table, and userName and password field. I have my base UserBase class and my LoginFXMLController class. When I run it I get NullPointerException. When I debug it it shows null value on ps=conn.prepareStatment. Here is my LoginFXMLController class: public class LoginFXMLController implements Initializable { @FXML private Button okBtn; @FXML private Button exitBtn; @FXML private Label infoPassword; @FXML private TextField nameFld; @FXML private PasswordField passwordFld; private Connection conn = null; private PreparedStatement ps = null; private ResultSet rs = null; /** * Initializes the controller class. */ public void initialize(URL url, ResourceBundle rb) { conn= UserBase.get(); } // Akcija za ok dugme u login formi public void okBtnAction(ActionEvent event) throws SQLException, IOException { String userName = nameFld.getText().trim(); String password = passwordFld.getText().trim(); String sql = "SELECT * user WHERE userName = ? AND password = ?"; try { ps = conn.prepareStatement(sql); ps.setString(1, userName); ps.setString(2, password); rs = ps.executeQuery(); if (rs.next()) { Parent root = FXMLLoader.load(getClass().getResource("CoreAppFXML.fxml")); Stage stage = new Stage(); stage.setScene(new Scene(root)); stage.setTitle("Main"); stage.show(); Stage login = (Stage) exitBtn.getScene().getWindow(); login.close(); } else { wrongInputFXML(); } } catch (Exception e) { e.printStackTrace(); } } public void wrongInputFXML() throws IOException { Parent root = FXMLLoader.load(getClass().getResource( "WrongUsernameFXML.fxml")); Stage errorStage = new Stage(); errorStage.setScene(new Scene(root)); errorStage.setTitle("Error"); errorStage.centerOnScreen(); errorStage.show(); } // Akcija za exit dugme u login formi public void exitBtnAction(ActionEvent event) { Stage stage = (Stage) exitBtn.getScene().getWindow(); stage.close(); } } And my UserBase class: public class UserBase { private stati…
score: 0

http://stackoverflow.com/a/25276167
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39388083
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25275821
accepted answer of: http://stackoverflow.com/q/25275821
has body: You'll want to use a listener, you can find an example of that here
has comment: http://stackoverflow.com/comment/39392463
has comment: http://stackoverflow.com/comment/39387720

http://stackoverflow.com/comment/39658545
has text: What does this have to do with Java?
comment on: http://stackoverflow.com/q/25257077
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25235457
tagged with: java
has title: google chart data formatting error(javascript)
type: Question
accepted answer: http://stackoverflow.com/a/25235635
tagged with: google-visualization
answer count: 1
tagged with: javascript
has answer: http://stackoverflow.com/a/25235635
has body: I'm calling a scatter plot with google.visualization.arrayToDataTable(loadGraphData); where loadGraphData is being generated from a backing bean in the form of an ArrayList&lt;ArrayList&lt;String&gt;&gt; and looks like this: "[['Date','Variable'], [0, 9.66], [1, 9.24], [2, 8.73], [3, 8.50]...]" The data isn't loading the graph using the var, but if I paste the output in its place (without the quotes)the code works and correctly displays the data. is there a convenient way to remove the quotes, or am I taking the wrong approach? BTW, I've replaced the dates with 0,1... as that was causing a different error I'm yet to fix. the data comes from a JSF backing bean, extract below: public ArrayList graphData(int variable, int nodeNumber) { Collection dataValues = dataValuesFacade.findVariable(currentNodes.getCurrentNodes().get(nodeNumber), variable); ArrayList &lt;DataValues&gt; dataValuesArray = new ArrayList(); dataValuesArray.addAll(dataValues); dataValues = dataValuesFacade.findVariable(currentNodes.getCurrentNodes().get(nodeNumber), 0); ArrayList&lt;DataValues&gt; timeValuesArray = new ArrayList(); timeValuesArray.addAll(dataValues); ArrayList &lt;DataPairs&gt; dataPairs = new ArrayList(); dataPairs.add(new DataPairs()); ArrayList&lt;ArrayList&lt;String&gt;&gt; returnData = new ArrayList&lt;&gt;(); ArrayList&lt;String&gt; newAL = new ArrayList(); newAL.add("Date"); newAL.add("Variable"); returnData.add(newAL); //Gson gson = new Gson(); for (int i=0;i&lt;dataValuesArray.size();i++) { String varTimestamp = dataValuesArray.get(i).getdTimeStamp().toString(); String dateTimestamp = timeValuesArray.get(i).getdTimeStamp().toString(); String tempVariable = dataValuesArray.get(i).getdVariable().toString(); String tempDate = timeValuesArray.get(i).getdVariable().toString(); if ((varTimestamp.equals(dateTimestamp))&amp; (dataPairs.get(i).getXdateStamp()==null)&amp; (dataPairs.get(i).getYvariable()==null)&amp; (dataPairs.get(i).getTimeStamp()==null)) { dataPairs.get(i).setTimeSta…
type: AnsweredQuestion
score: 0
tagged with: jsf

http://stackoverflow.com/comment/39437592
comment on: http://stackoverflow.com/q/25301913
has text: It is important the object be added to the queue. Therefore, if queue is full, it should block till there is available space for the object to be added.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25308826
tagged with: channel
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25312769
upvote count: 2
has answer: http://stackoverflow.com/a/25312769
has body: I'm newbie in Netty. I want send several messages through one channel in this way channel.writeAndFlush(Unpooled.copiedBuffer("TBD", CharsetUtil.UTF_8)).sync() channel.writeAndFlush(Unpooled.copiedBuffer("TBD1", CharsetUtil.UTF_8)).sync() But this code produce java.nio.channels.ClosedChannelException. How to do it correctly?
has title: Netty write several messages through one channel
answer count: 1
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: netty
tagged with: java

http://stackoverflow.com/comment/39566306
type: AnswerComment
type: Comment
has text: wow this is harder than I tought, I cant use double, not even with the part you wrote down, if input number is double, it just mess up the whole thing, so what do you think? also for some weird reason whenever I type double, I get Inputmismatchexception, so my program doesnt run, ,but if I type in a int number with the exact same code, and use nextDouble(); etc the whole program just mess up
comment on: http://stackoverflow.com/a/25372559
score: 0

http://stackoverflow.com/q/25366102
tagged with: generics
has answer: http://stackoverflow.com/a/25366367
possible better answer: http://stackoverflow.com/a/25366337
has answer: http://stackoverflow.com/a/25366335
favorite count: 0
type: Question
answer count: 5
has body: I am looking at the following Gson library provided by google. In a tutorial I am following I have found the following code snippet; public class JsonToJava { public static void main(String[] args) throws IOException { try(Reader reader = new InputStreamReader(JsonToJava.class.getResourceAsStream("/Server1.json"), "UTF-8")){ Gson gson = new GsonBuilder().create(); Person p = gson.fromJson(reader, Person.class); System.out.println(p); } } } Is it possible to make this generic, for example, if you have the following parameters public Object getObjectFromJSONString(String jsonString, Class classType){ Then we know the class type, is it possible to return any object type or would I have to have individual methods, convertJSONToClassA, convertJSONToClassB, convertJSONToClassC and so on?
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39552918
has answer: http://stackoverflow.com/a/25366485
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25366337
has title: How to make object return generic
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25366176
has comment: http://stackoverflow.com/comment/39552895
accepted answer: http://stackoverflow.com/a/25366335

http://stackoverflow.com/comment/39581684
has text: Your second code is perfect - why do you need any keyword along with it
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25381293
type: Comment

http://stackoverflow.com/a/25385870
has comment: http://stackoverflow.com/comment/39625655
type: Answer
has comment: http://stackoverflow.com/comment/39811718
has comment: http://stackoverflow.com/comment/65340657
accepted answer of: http://stackoverflow.com/q/25383591
downvote count: 0
has comment: http://stackoverflow.com/comment/39721478
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25383591
has comment: http://stackoverflow.com/comment/39591396
has body: This is a basic example showing how to create a user using the Directory API of the Admin SDK (https://developers.google.com/admin-sdk/directory/v1/reference/users/insert). I’ve not included the OAuth 2 initialization code as this is fairly standard and similar to other Google APIs. You need to initialize a Directory instance using your OAuth credential and this will depend on the type of application you are using (standalone or App Engine), have a look here (https://code.google.com/p/google-api-java-client/source/browse/?repo=samples) there are many examples for other APIs covering both App Engine and standalone apps. The OAuth credentials initialization should be very similar in this case. You need to download the latest Admin SDK jar from here (https://developers.google.com/api-client-library/java/apis/admin/directory_v1) or include the following maven dependency com.google.apis google-api-services-admin directory_v1-rev32-1.16.0-rc Here is the Java example import java.io.IOException; import java.security.GeneralSecurityException; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.admin.directory.Directory; import com.google.api.services.admin.directory.model.User; import com.google.api.services.admin.directory.model.UserName; public class DirectoryUtils { /** Global instance of the JSON factory. */ private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); /** Global instance of the HTTP transport. */ private static HttpTransport httpTransport; public static Directory initDirectory() throws GeneralSecurityException, IOException { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); Credential credential = null; // TODO initialize credentials Directory directory = new Direc…
has comment: http://stackoverflow.com/comment/39610627
has comment: http://stackoverflow.com/comment/39601359
has comment: http://stackoverflow.com/comment/39631969
score: 5
upvote count: 5

http://stackoverflow.com/a/25313516
answers question: http://stackoverflow.com/q/25312797
type: Answer
has body: This is the classic deadlock scenario: You have N objects, where each object has its own lock and you're aquiring multiple of these locks in random order. The problem occurs when two treads are trying to "bow" to each other. Each thread aquires the lock for its own person (alphonse and gaston), then tries to aquire the lock of the friend while still holding the lock to its own person. This can be resolved in different ways. The simplest would be to generally use a global lock (e.g. a static locking object defined inside the Friend class). That generally allows only one thread to perform the bow/bowback sequence at a time. Sometimes thats just fine, sometimes it can be a performance bottleneck. The more complicated solution is to ensure locks are aquired in a deterministic order, e.g. ensure that the lock for alphonse is always aquired before the lock to gaston. For that you can introduce an ordering criterion to the objects to be locked, for simplicity lets assume we could rely on the names of the friends to be unique. That makes implementation a tad bit more complicated, but allows for more concurrency than a global lock while still avoiding deadlocks. Insted of blindly synchronizing on "self" the method now decides a priority order in which to synchronize on whom: public void bow(Friend bower) { // determine locking order Friend first, second; if (getName().compareTo(bower.getName()) &gt; 0) { first = this; second = bower; } else { first = bower; second = this; } synchronized (first) { synchronized (second) { // perform bow normally } } } This works because no matter if alphonse bows to gaston or vice versa, they each would aquire the locks in the same order.
score: 0

http://stackoverflow.com/comment/39557697
type: AnswerComment
score: 0
has text: The same as provided except all hostels properties are listed. The query itsef is ok but the result is zero which is strange as data is in database
type: Comment
comment on: http://stackoverflow.com/a/25365507

http://stackoverflow.com/comment/39318433
type: QuestionComment
comment on: http://stackoverflow.com/q/25238110
type: Comment
has text: Doesn't help. I can choose any arbitrary file (guaranteed to be new), e.g. D:/temp/file2441, and still face the same issue.
score: 0

http://stackoverflow.com/q/25372459
tagged with: swing
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25372585
linked to: http://stackoverflow.com/q/513832
tagged with: java
has body: Can anyone tell me how to retrieve radiogroup data from database? Values are inserting through radiobutton but isn't retrieving from database. coding is as follows: while(rs.next()) { String db_name = rs.getString("name"); String db_add = rs.getString("address"); String db_gender = rs.getString("gender"); Text_name.setText(db_name); Text_address.setText(db_add); if(db_gender=="Male") { RadioMale.isSelected(); } else if(db_gender=="Female") { RadioFemale.isSelected(); // GenderGroup.equals(RadioFemale); } } NOTE: RadioMale &amp; RadioFemale are Variable names of RadioButton.. db_name &amp; db_add are working perfectly just getting issue on gender.. Help me out please!!
tagged with: sqlite
tagged with: user-interface
has title: How to retrieve radiogroup data from database in JAVA? M Using Java Swing & SQLite
downvote count: 1
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25372831
upvote count: 0
has answer: http://stackoverflow.com/a/25372585
has answer: http://stackoverflow.com/a/25372831
tagged with: jdbc

http://stackoverflow.com/comment/39597226
score: 0
type: Comment
type: AnswerComment
has text: Thank you very much, but I'm looking for the instructions (source code) to set my java app (generic) that when windows starts, it is executed well. Only java code @prashant thakre
comment on: http://stackoverflow.com/a/25389268

http://stackoverflow.com/a/25298765
downvote count: 0
has body: Assuming that both strings have the same length, this is as good as it gets: public static int numberMatchingChars(String s1, String s2) { int count = 0; for (int i = 0; i &lt; s1.length(); i++) if (s1.charAt(i) == s2.charAt(i) &amp;&amp; s1.charAt(i) != '-') count++; return count; } Clearly, you'll have to iterate over each char on both strings.
answers question: http://stackoverflow.com/q/25298715
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/39331011
score: 0
comment on: http://stackoverflow.com/q/25237020
has text: Can you precise the version of the java plugin you are using ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25277275
possible better answer: http://stackoverflow.com/a/25277377
type: AnsweredQuestion
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39389325
accepted answer: http://stackoverflow.com/a/25279537
has comment: http://stackoverflow.com/comment/39389447
has answer: http://stackoverflow.com/a/25279537
has answer: http://stackoverflow.com/a/25277458
type: Question
has answer: http://stackoverflow.com/a/25277377
has comment: http://stackoverflow.com/comment/39389306
tagged with: android
tagged with: java
has title: OO Design - Public API method implementation
tagged with: public
has body: Is it ever good practice to implement a public method to call another public method (in something like an API)? I fear duplication issues when the user of the API overrides these methods. I would recommend using a private method (that can be called by both of the original public methods) to do the actual implementation. Imagine a data structure like a List. If I have an addAll(lotsoItems) call add(simgleItem) for every item, this will cause problems when being overriden by the user. He could be doing some logic in his overriden "add" and in "addAll." This logic would then be duplicated because he didn't know I was going to call "add" when I did. Looks like Java (8, at least) implements ArrayList the way I described. Same with Android's ArrayAdapter, thankfully. My question is: when is it ever okay to call a public method from another public method when designing an API or a class that may be extended? Edit: For a clear example: Let's say I am extending ArrayList because I want to "bark" at the user (System.out.println("Bark!");) every time something is added to the list. Easy enough, right? So, I go and override .add(Object o) to do .bark() and then call .super(o). I then go and override .addAll(Object...os) to .bark() as many times as the os array is long and then call .super(os). Uh, oh, here is the problem: the implementer of ArrayList just called .add in .addAll, and .bark will be called twice as many times as I intended! Here's my conclusion https://gist.github.com/NightlyNexus/1256e4e36428b44ebf57 tl;dr I'm not happy with OO design right now.

http://stackoverflow.com/a/25381379
answers question: http://stackoverflow.com/q/25380984
downvote count: 0
has body: Yes it's should be possible: Try this: findByProgrammeAndDirectorAndProgDateBetweenOrderByProgDateStartTimeAsc(String programme, String director, Date progStart, Date progEnd); I have not tested the code, but according to things I've already done, it should work.
has comment: http://stackoverflow.com/comment/39581852
upvote count: 8
score: 8
type: Answer
has comment: http://stackoverflow.com/comment/39588670

http://stackoverflow.com/comment/39587526
type: QuestionComment
comment on: http://stackoverflow.com/q/25370066
has text: @utrecht the `windows_path` [type](https://github.com/basti1302/puppet-windows-path/blob/master/lib/puppet/type/windows_path.rb) has none.
score: 0
type: Comment

http://stackoverflow.com/a/25373062
score: 0
has body: No. You remove reference, not actual class.
has comment: http://stackoverflow.com/comment/39566643
has comment: http://stackoverflow.com/comment/39566675
has comment: http://stackoverflow.com/comment/39566655
answers question: http://stackoverflow.com/q/25373034
type: Answer
has comment: http://stackoverflow.com/comment/39566694

http://stackoverflow.com/comment/39387542
has text: and the reason for downvote is..?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25276233

http://stackoverflow.com/comment/39449210
comment on: http://stackoverflow.com/q/25309583
has text: I am afraid you'll have to code some polling, checking your mailbox from time to time to do that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25261190
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39359843
favorite count: 0
type: Question
tagged with: gridview
has comment: http://stackoverflow.com/comment/39359572
tagged with: android
has comment: http://stackoverflow.com/comment/39360219
accepted answer: http://stackoverflow.com/a/25261925
has title: How to retrieve GridView object after notifyDataSetChanged?
has comment: http://stackoverflow.com/comment/39360373
has answer: http://stackoverflow.com/a/25261925
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I have search on StackOverflow and other websites but no one can answer to my question. I have a gridView with items. I have a button to add item to this gridView.Each element on the GridView is a relativeLayout with an Imageview and an EditText. When i add item to the gridView using the button, I want to get my relativeLayout and request Focus on the editText to set a name on it. Imagine i have 3 elements in my gridView. I add element to my ArrayList and call adapter.notifiyDataSetChanged(). The new element is displayed on the grid but when i use getChildCount(), the gridView still has 3 children. It cause problem because i want to request focus on the last added EditText. How can i update my gridView object ? Fragment : //Get gridView final GridView gridCat = (GridView) v.findViewById(R.id.gridCategory); adapter = new GridCategoryAdapter(getActivity(), subcatList); gridCat.setAdapter(adapter); gridCat.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { SubCategory subcat = subcatList.get(position); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fragment_middle, SubCategoryFragment.newInstance(subcat.getProducts(), subcat.getName())); transaction.addToBackStack(null); transaction.commit(); } }); Button catAddButton = (Button) v.findViewById(R.id.catAddButton); catAddButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "old size gridview : " + gridCat.getChildCount()); subcatList.add(new SubCategory()); Log.d(TAG, "new size list : " + subcatList.size()); adapter.notifyDataSetChanged(); Log.d(TAG, "new size gridview : " + gridCat.getChildCount()); //HERE : childCount is the same ! RelativeLayout rl = (RelativeLayout) gridCat.getChildAt(gridCat.getChildCount()-1); rl.findViewById(R.id.subcatName).setFocusable(true); rl.fi…
tagged with: java
tagged with: notifydatasetchanged
linked to: http://stackoverflow.com/q/10242800
answer count: 1

http://stackoverflow.com/comment/39486343
score: 0
has text: This where I am partially confused. Shouldn't both of the constraints be used? Like first one if he is at least minmum age, and second if he is at most maximum age to determine the list of users who falls between that age group.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25321210

http://stackoverflow.com/q/25270329
has title: Profiling complex ant build scripts: How to find bottlenecks?
has body: My goal is to decrease the build times of our system. We are using Ant, and the build system built on top of it is quite complex. To find bottlenecks, it would be great to display the elapsed times of the most expensive tasks. Do you know of a wrapper for Ant that is capable of doing that? Something like a profiler for Ant tasks. For those, who a familiar with Grunt: I'm looking for a tool like time-grunt. (At the moment, my strategy is to look at time-stamped console outputs to get an idea of the bottlenecks.)
answer count: 0
type: UnansweredQuestion
tagged with: ant
tagged with: build-process
has comment: http://stackoverflow.com/comment/39376694
has comment: http://stackoverflow.com/comment/39377045
score: 0
has comment: http://stackoverflow.com/comment/39376684
tagged with: java
tagged with: profiling
linked to: http://stackoverflow.com/q/2250204
type: Question

http://stackoverflow.com/comment/39336920
type: QuestionComment
has text: Its pretty difficult to figure out what is wrong without a LogCat in this situation. Can you at least tell us the error you are getting?
type: Comment
comment on: http://stackoverflow.com/q/25248677
score: 0

http://stackoverflow.com/comment/39424681
type: AnswerComment
score: 0
has text: @JB You beat me to it ;)
type: Comment
comment on: http://stackoverflow.com/a/25296128

http://stackoverflow.com/comment/39576476
score: 0
comment on: http://stackoverflow.com/q/25378281
has text: what's pers 2d array content?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39577995
type: Comment
has text: @AndreiStefan, I have project configured only with XML and I want to store this config in one place. It's a matter of preference.
type: QuestionComment
comment on: http://stackoverflow.com/q/25378910
score: 0

http://stackoverflow.com/comment/39401288
type: Comment
has text: Thank you for your response. I tried with all the possibilities but none worked. With every option I get a different error message: "Older version on server does not support this method", or "Cannot create a session from an agent". I will try updating the server to 9.0.1...
type: AnswerComment
comment on: http://stackoverflow.com/a/25282623
score: 0

http://stackoverflow.com/q/25267344
type: Question
has body: I am able to print the output of an external program in Eclipse via the code below (found online, not mine). I would like to be able to pass a command to the program and THEN print the output of the program but I don't know how to pass commands to the program. Any suggestions would be appreciated, thanks! Code: String line; Process p = Runtime.getRuntime().exec("Z:/LPCXpresso/test10/Debug/arm-none-eabi-readelf.exe"); BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); p.waitFor();
tagged with: runtime.exec
tagged with: java
has title: Running External Program in Eclipse
tagged with: eclipse
score: 2
has comment: http://stackoverflow.com/comment/39372065
upvote count: 2
type: UnansweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39373218
has answer: http://stackoverflow.com/a/25274468
favorite count: 0

http://stackoverflow.com/q/25239024
has body: I use selenium to login to website https://launch.stellar.org/#/login. but I can't get any element in new page. here the code: public class SeleniumProcessor { public WebDriver driver; public SeleniumProcessor() { this.driver = new FirefoxDriver(); } public void openUrl(String url) { driver.get(url); } public void login(String userName, String password) { WebElement userNameTxt = driver.findElement(By.id("username")); WebElement passwordTxt = driver.findElement(By.id("password")); userNameTxt.sendKeys(userName); passwordTxt.sendKeys(password); passwordTxt.sendKeys(Keys.RETURN); } public static void main(String[] args) throws InterruptedException { SeleniumProcessor login = new SeleniumProcessor(); login.openUrl("https://launch.stellar.org/#/login"); login.login("myusername", "mypassword"); // login success but after that when I execute findElement function is always throw Exception like this Exception in thread "main" org.openqa.selenium.InvalidSelectorException: The given selector btn btn-default stellar-button ng-binding is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Compound class names not permitted .... I also try using Explicit and Implicit Waits,... but didn't work, even print getCurrentURL() always is "https://launch.stellar.org/#/login". Does any one know the potential reason or solution for this problem?
has title: Java Selenium: cannot get any element after successful login
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/25240245
accepted answer: http://stackoverflow.com/a/25240245
type: Question
has answer: http://stackoverflow.com/a/25239929
possible better answer: http://stackoverflow.com/a/25239929

http://stackoverflow.com/a/25406332
answers question: http://stackoverflow.com/q/25370711
has comment: http://stackoverflow.com/comment/39629134
type: Answer
has body: If you want a new record to be inserted into all 5 tables when you insert something into one of them, then you can create a trigger for this. It may also be helpful to create foreign keys on the id columns in the other tables (to keep the tables in sync).
score: 0

http://stackoverflow.com/comment/39363738
type: AnswerComment
comment on: http://stackoverflow.com/a/25263211
type: Comment
has text: @kviiri cannot find symbol `args`. BTW, in the main i call `cache();` In the `public int cache(){ i put the try-catch block here }`
score: 0

http://stackoverflow.com/q/25301729
answer count: 1
downvote count: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25301981
linked to: http://stackoverflow.com/q/21375449
has title: android search suggestions from server
favorite count: 0
type: Question
score: 2
upvote count: 2
type: UnansweredQuestion
has body: I need to build a search functionality in my android app which relies on json response from the server. The users will enter the search query in a searchview located in the actionbar. Based on what the user types a query will be made to the server and the server returned response should appear as drop down suggestion. How should I go about it . Based on the docs i have read I need to implement a content provider. What would be neatest way of implementing app search ? this is my SearchActivity.java package com.accure.health; import android.os.Bundle; import android.app.Activity; import android.app.SearchManager; import android.content.Context; import android.view.Menu; import android.view.MenuInflater; import android.widget.SearchView; import android.widget.TextView; public class SearchActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); TextView tv = (TextView) findViewById(R.id.user_label); tv.setText(" Welcome, " + getIntent().getExtras().getString("name")); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.search, menu); //return true; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.search, menu); // Associate searchable configuration with the SearchView SearchManager searchManager =(SearchManager)getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.patient_search) .getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return super.onCreateOptionsMenu(menu); } } this is my SearchResultActivity.java package com.accure.health; import android.os.Bundle; import android.app.ActionBar; import android.app.Activity; import android.app.SearchManager; import android.content.Intent; import android.view.Menu; import android.widget.TextVi…

http://stackoverflow.com/comment/39408056
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25287509
has text: Mention which library you are using? Refer - [HowToAsk](http://stackoverflow.com/help/how-to-ask).
score: 0

http://stackoverflow.com/a/25359140
has body: We have implemented our own Recorder which will be used only for recording in Internet Explorer. It is a javascript file. The concept is to add listeners to each object in the source code of the GUI of web page. Below code helps you to do that. As soon as the page is loaded these listeners will be added. When you perform click action, all its properties will be captured. Here i have given an example of adding listener and getting properties of the object of type "SELECT", you can do the same thing for other types of objects. var added_MClistener = false; var tagn = dObj.tagName; if(tagn == "SELECT") { dObj.attachEvent("onchange",so_showObjInfo); dObj.added_OClistener = true; dObj.so_prevBGColor = alll[i].style.backgroundColor; } if(tagn != "OPTION" &amp;&amp; tagn != "SELECT" ) { dObj.added_MClistener = true; dObj.attachEvent("onclick",so_showObjInfo); dObj.so_prevBGColor = alll[i].style.backgroundColor; } function so_showObjInfo(e) { if(pause)return; if(isActive)return; var preE = e; var e =e? e:window.event; var ele=e.target?e.target:e.srcElement; activeObj = ele; var eltagn= activeObj.tagName; var currentNode=activeObj; var path=[]; while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="//"+path.reverse().join('/'); var fff=0; var xpath; while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1){fff=1; break;}if(pe.indexOf('@name')!=-1){fff=1; break;}}currentNode=currentNode.parentNode;}if(fff==1){xpath="//"+path.reverse().join('/');} var acurrentNode=activeObj; var apath=[]; while(acurrentNode){var ape=agetNode(acurrentNode);if(ape){apath.push(ape);}acurrentNode=acurrentNode.parentNode;} var axpath="//"+apath.reverse().join('/'); var el=activeObj; var cssPath = cssselect(el); if (cssPath!=null) { cssPath="css="+cssPath; } var objval=activeObj.value; var objname=activeObj.name; var objidd=activeObj.id; } In this way we can add listeners t…
downvote count: 0
score: 7
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/78733116
answers question: http://stackoverflow.com/q/25355022

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

http://stackoverflow.com/a/25324012
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25322651
score: 2
has body: init() isn't really used in regular code. It can be used in platform test code - calling it first makes the class loader initialize the static members on the current thread. It's useful to making sure the Handler is created on the main UI thread while tests run on a background thread for example. Because of @hide, it's not usable in code written with SDK's stub version of android.jar. This is there to fix a bug to make sure onCancelled() is called if cancel() is called early.
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25322651

http://stackoverflow.com/q/25254220
tagged with: lucene
has title: How do you find a phrase with Lucene?
tagged with: morelikethis
score: 0
linked to: http://stackoverflow.com/q/8880396
tagged with: java
answer count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39350367
has comment: http://stackoverflow.com/comment/39376435
has body: I hope the way I worded my question is correct, though I could be mistaken. Basically, I have an index with term vectors, positions, and offsets, and I want to be able to do the following: when I see the word "do", check to see if the next word is "you". If so, treat those two words as one phrase for the purposes of scoring. I'm doing this to avoid splitting up words that are commonly used together anyway. Instead of my list of words sorted by score looking like this, do want you come to I'd like to see something more like this do you want come to
has answer: http://stackoverflow.com/a/25270178
type: UnansweredQuestion

http://stackoverflow.com/comment/39509324
type: AnswerComment
comment on: http://stackoverflow.com/a/25341564
score: 0
has text: Are you certain you have `=` and not `:`? And are you certain that you have `name=abc` and not `name="abc"`? (because that's not valid JSON which means that you would have to write a parser from scratch)
type: Comment

http://stackoverflow.com/a/25366103
has comment: http://stackoverflow.com/comment/39594082
has body: Your get methods are functions and require (), so this if (x.getDealer.equals(crm.getDealer) &amp;&amp; (crm.getDealer.equals(crm.getDealer) &amp;&amp; (x.getName.equals(crm.getName) &amp;&amp; (x.getTypeOfContact.equals("Offer"){ And you have dangling parenthesis, and crm.getDealer.equals(crm.getDealer) makes no sense - so I removed that. I think you wanted something like, if (x.getDealer().equals(crm.getDealer()) &amp;&amp; (x.getName().equals(crm.getName()) &amp;&amp; x.getTypeOfContact().equals("Offer"))){
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39554115
score: 0
accepted answer of: http://stackoverflow.com/q/25366015
type: Answer
answers question: http://stackoverflow.com/q/25366015

http://stackoverflow.com/comment/39427295
type: QuestionComment
comment on: http://stackoverflow.com/q/25297414
has text: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
score: 0
type: Comment

http://stackoverflow.com/q/25275415
answer count: 0
has comment: http://stackoverflow.com/comment/39428672
type: UnansweredQuestion
downvote count: 0
tagged with: jmx
upvote count: 1
favorite count: 0
has body: I submitted a version of this question back in Dec '13, but never got any comments so wanted to try again in case somebody else might see it. JConsole allows a user to connect to a Java process via either a local connection (using the JVM's process ID) or via a remote URL (whether or not the process is on the local machine is irrelevant). I'd like to have a connection listener for the JMX ConnectorServer that will be notified when a connection is opened or closed. I can find the ConnectorServer object for a remote connection URL, and see the relevant connectionOpened() and connectionClosed() calls. Does anybody know how to do that for local (PID-based) connections? I've been unable to get hold of the ConnectionServer for local connections, in order to add a listener to it. Any suggestions? Dave
has title: Detecting JMX connections via local server - how to do it?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39386500
tagged with: connection
type: Question

http://stackoverflow.com/comment/39375643
has text: The last recursive call is not in tail position, you would need to add an accumulator parameter or something. Also what's `pow1`?
comment on: http://stackoverflow.com/a/25268979
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25371405
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: jooq
accepted answer: http://stackoverflow.com/a/25377645
has answer: http://stackoverflow.com/a/25377645
downvote count: 0
has title: batchStore does not load generated keys
has body: I have a record like below (the first parameter is an id serial PRIMARY KEY in a postgresql DB). SymbologyRecord symbology = new SymbologyRecord(null, "a", "b"); symbology.changed(SYMBOLOGY.ID, false); When I insert the record with: create.attach(symbology); symbology.store(); assertNotNull(symbology.getId()); //passes My test passes (the id gets uploaded from the DB after the insertion). But if I use a batchStore the id remains null: create.batchStore(symbology); assertNotNull(symbology.getId()); //fails, id is null Is that by design or am I missing something obvious?
tagged with: postgresql
type: AnsweredQuestion
score: 3
tagged with: sql
upvote count: 3

http://stackoverflow.com/q/25235229
has comment: http://stackoverflow.com/comment/39311410
score: 15
has comment: http://stackoverflow.com/comment/39311441
has answer: http://stackoverflow.com/a/25243500
possible better answer: http://stackoverflow.com/a/25243500
has title: Extracting zipped file from ResourceStream throws error "Invalid stored block lengths"
tagged with: http://stackoverflow.com/tag/zip
upvote count: 15
has comment: http://stackoverflow.com/comment/39312366
answer count: 3
has answer: http://stackoverflow.com/a/37012630
tagged with: java
downvote count: 0
tagged with: embedded-resource
has comment: http://stackoverflow.com/comment/39311387
has comment: http://stackoverflow.com/comment/39311525
tagged with: maven
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39312030
has answer: http://stackoverflow.com/a/52665146
has comment: http://stackoverflow.com/comment/39311851
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39311598
accepted answer: http://stackoverflow.com/a/37012630
has body: I am trying to extract a ZIP file from my current JAR using: InputStream resource = getClass().getClassLoader().getResourceAsStream(name); This get the correct InputStream, but it gives an error when I try to unzip it using the following code (I'm storing each file into a Hashmap&lt;file, filename&gt;): public static HashMap&lt;String, String&gt; readZip(InputStream inputStream) throws IOException { byte[] buffer = new byte[1024]; HashMap&lt;String, String&gt; list = new HashMap&lt;&gt;(); ZipInputStream zipInputStream = new ZipInputStream(inputStream); ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null) { if (!entry.isDirectory()) { StringBuilder stringBuilder = new StringBuilder(); while (IOUtils.read(zipInputStream, buffer) &gt; 0) { stringBuilder.append(new String(buffer, "UTF-8")); } list.put(stringBuilder.toString(), entry.getName()); } zipInputStream.closeEntry(); entry = zipInputStream.getNextEntry(); } zipInputStream.closeEntry(); zipInputStream.close(); return list; } However when I try to do this, I get this exception (on IOUtils.read) java.util.zip.ZipException: invalid stored block lengths at java.util.zip.InflaterInputStream.read(Unknown Source) at java.util.zip.ZipInputStream.read(Unknown Source) Am I doing this wrong? I've done plenty of googling of the error, and I didn't see anything related to my issue.
has comment: http://stackoverflow.com/comment/39311496
has comment: http://stackoverflow.com/comment/39346278
has comment: http://stackoverflow.com/comment/39533749

http://stackoverflow.com/comment/39394652
score: 0
comment on: http://stackoverflow.com/a/25279422
type: Comment
has text: I've tried you advice with no result. I'm getting the same error.
type: AnswerComment

http://stackoverflow.com/q/25346968
has comment: http://stackoverflow.com/comment/39536676
has title: Avoiding special characters in the XML output using JAXB
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39518318
has comment: http://stackoverflow.com/comment/39520273
tagged with: java
has comment: http://stackoverflow.com/comment/39520633
has comment: http://stackoverflow.com/comment/39519859
has comment: http://stackoverflow.com/comment/39519224
has comment: http://stackoverflow.com/comment/39519155
tagged with: jaxb
has comment: http://stackoverflow.com/comment/39559490
has comment: http://stackoverflow.com/comment/39520485
has comment: http://stackoverflow.com/comment/39519285
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: I am reading tweets and forming an XML out of it, for which I am using JAXB Marshaller and UTF-8 encoding. JAXB Marshaller setting is: JAXBContext jaxbContext; StringWriter writer = new StringWriter(); jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller m = jaxbContext.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(obj, writer); Here, obj is my class object which contains tweet text and other information. My problem is, the generated XML contains special characters like: > x85, x93, xAQ Sample Output XML: 500923859663872000 2014-08-17T14:05:29+05:30 ** Ԁhughwizzy: 55% of all '14-'15 @PremierLeague players will wear @Nike** Boots. (@adidas 35%, @Puma 5%). http://t.co/VHit1Es7KlԠ@Yup_Yup9 en NA 0 0 false 39481349 2009-05-12T17:12:37+05:30 NA 281 4 en false false I found that these are UTF-8 encoded characters, but it makes my XML invalid. Is there a way to avoid these characters in the generated XML.
has comment: http://stackoverflow.com/comment/39581437
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39524243
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39558519
has comment: http://stackoverflow.com/comment/39523554
has comment: http://stackoverflow.com/comment/39519814
has answer: http://stackoverflow.com/a/79420828
has comment: http://stackoverflow.com/comment/39518899
has comment: http://stackoverflow.com/comment/39519875
has comment: http://stackoverflow.com/comment/39518534
has comment: http://stackoverflow.com/comment/39576169
favorite count: 0
has answer: http://stackoverflow.com/a/62789166
has comment: http://stackoverflow.com/comment/39574868

http://stackoverflow.com/q/25340315
accepted answer: http://stackoverflow.com/a/25340517
score: 0
has answer: http://stackoverflow.com/a/25340517
has body: I'm writing an app that may talk to multiple database and web services. I'd like to use Spring's @Transactional annotation so that a failure in any one can rollback them all. I'm not clear about how I should do this, and I can't find any examples of it either after searching. One thought I have is to create a bean that is a custom aspect and use that to intercept the methods, adding my own custom code to rollback problems. But I'm sure there must be a way to do this in a standardised fashion. Thank you! Alex
tagged with: spring
has title: How do I implement my own @Tranactional aware service in Spring
type: Question
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25340334
answer count: 2
has answer: http://stackoverflow.com/a/25340334

http://stackoverflow.com/q/25385278
has body: Suppose there is a ScheduledExecutorService that uses a resources such as a Scanner or PrintWriter. Would it be more efficient to have the Executor re-open the resource every time it executes, or would it be better to do something else like housing the Executor inside the try with resources block and in that way effectively having the resource remain open for the entire duration that the program is running? Would doing this weigh more heavily on the CPU than contently opening and closing the resource? Does the answer depend on the frequency of the Executor?
tagged with: resources
type: Question
has answer: http://stackoverflow.com/a/25385369
accepted answer: http://stackoverflow.com/a/25385369
has title: Java using a resource within a ScheduledExecutorService
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/25358591
has answer: http://stackoverflow.com/a/25359193
answer count: 2
has comment: http://stackoverflow.com/comment/39539464
score: 1
has comment: http://stackoverflow.com/comment/39539634
downvote count: 0
possible better answer: http://stackoverflow.com/a/25365793
upvote count: 1
tagged with: swing
has title: Swing JTextArea caret events
favorite count: 0
has comment: http://stackoverflow.com/comment/39539170
type: Question
tagged with: caret
has body: Are there any events fired when caret is "blinking"? (not when position changed or property changed etc, but just blink of caret horizontal line) How JTextField displays hint (which is disappears when user starts type): and the same functionality used in JTextArea: As you can see, while caret is blinkng, the first letter is overwritten.
tagged with: jtextarea
tagged with: java
has answer: http://stackoverflow.com/a/25365793
accepted answer: http://stackoverflow.com/a/25359193
type: AnsweredQuestion

http://stackoverflow.com/a/25385267
has comment: http://stackoverflow.com/comment/39611805
answers question: http://stackoverflow.com/q/25377474
has comment: http://stackoverflow.com/comment/39616777
type: Answer
has comment: http://stackoverflow.com/comment/39618140
score: 0
has body: You have 2 options: You can store different types of objects in different caches. You can create typed cache projections, like GridCacheProjection&lt;MyKey, MyObject&gt; prj = cache.projection(MyKey.class, MyObject.class). More information can be found here: http://doc.gridgain.org/latest/GridCacheProjection

http://stackoverflow.com/a/25240245
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25239024
has comment: http://stackoverflow.com/comment/39321624
has comment: http://stackoverflow.com/comment/39320958
score: 0
has body: This is an AngularJS based App getting around finding elements might be a bit of a hassle except if using Protractor otherwise you end up with Long Xpaths and CSS selectors. Here's a snippet of your course refactored to work for me. I noticed that you said you were using explicit wait, well it did worked for me... My Advice is study the behavior of an app Manually and carefully before putting to automation. public class AutoTest{ public static WebDriver autoDriver; public AutoTest(){ autoDriver = new FirefoxDriver(); autoDriver.get("https://launch.stellar.org/#/login"); } public void login(String username, String password) throws InterruptedException{ autoDriver.findElement(By.id("username")).sendKeys(username); autoDriver.findElement(By.id("password")).sendKeys(password); Thread.sleep(1000); autoDriver.findElement(By.xpath("//button[.='Log in']")).click(); } public void faceBookStellar() throws InterruptedException{ WebElement facebookButon = new WebDriverWait(autoDriver, 10) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[.='Receive your first stellars on us!']"))); facebookButon.click(); } public void quiteBrowser(){ autoDriver.close(); autoDriver.quit(); } public static void main(String[]args) throws InterruptedException{ AutoTest testObject = new AutoTest(); testObject.login("autoStellarTester", "password"); testObject.faceBookStellar(); } }
type: Answer
has comment: http://stackoverflow.com/comment/39321140
accepted answer of: http://stackoverflow.com/q/25239024

coding-style
type: Tag
tags question: http://stackoverflow.com/q/25382930
tags question: http://stackoverflow.com/q/25330916
tag name: coding-style
tags question: http://stackoverflow.com/q/25345238

http://stackoverflow.com/comment/39448507
score: 0
type: Comment
has text: Do you really need Batik for rendering the SVG? [Taking a screenshot of a web page](http://stackoverflow.com/questions/1504034/take-a-screenshot-of-a-web-page-in-java) could also work for you since most (headless) browsers support SVG.
type: QuestionComment
comment on: http://stackoverflow.com/q/25282873

http://stackoverflow.com/q/25284721
tagged with: weld
score: 0
tagged with: java
answer count: 1
tagged with: cdi
type: Question
has answer: http://stackoverflow.com/a/25295344
has body: I'd like to programmatically adjust my logging file locations. Thus I want to overwrite the default values in my log4j.properties file. This is not opposing any problems I am using LogManager.resetConfiguration() and PropertyConfigurator.configure(props) so that my file locations are updated (stored in props). This methodology works, logging files are from this point onward written to a new file location. My problem occurs when using Weld. This is due the fact that Weld internally is using a logger as well, stated in my logging-file: 2014-08-13 12:55:15.589 [main:0] DEBUG Weld.java:84 Method: &lt;clinit&gt; - Logging Provider: org.jboss.logging.Log4jLoggerProvider. Since I'm using org.jboss.weld.environment.se.StartMain as main class, I do not have any influence on the logging capabilities of Weld. I now end up with 3 logging files (as described in my log4j.properties) on 2 different locations. Whereas one contains some Weld debug information and the other contains all the logging information from initialization and onward. Thus logically I'd like to end up with only 1 directory with logging files, thus that Weld adjusts to the new log4j file location. Or to have log4j to copy the old logging contents, create new logging files + with old content and to delete the old logging files. I do not want to use VM arguments, since I need to programmatically assign the logging locations.
has title: Configure log4j when using Weld CDI
type: UnansweredQuestion
tagged with: jboss-weld

http://stackoverflow.com/comment/39373583
score: 0
comment on: http://stackoverflow.com/a/25263120
type: Comment
has text: *ordered* streams will take care to accumulate and combine in the right order even when working in parallel and streams created by a `List` are ordered. For unordered streams the entire calculation makes no sense, regardless of being sequential or parallel.
type: AnswerComment

http://stackoverflow.com/comment/39373317
has text: Class<?> doesn't work, JAXBElement complains about it. Also I think Java designers don't generate this warning without reason, so I want to get it to compile without warning, avoiding "SuppressWarnings".
comment on: http://stackoverflow.com/q/25268510
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39481337
type: Comment
comment on: http://stackoverflow.com/a/25326757
score: 2
type: AnswerComment
has text: Where and how are you creating the text field? Show the code.

http://stackoverflow.com/comment/39532576
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25355059
has text: I got your point. So can I say that if it has lot of new functionality, it would be good to have new class?
type: Comment

continuous-integration
tags question: http://stackoverflow.com/q/25247737
tags question: http://stackoverflow.com/q/25280901
type: Tag
tag name: continuous-integration

http://stackoverflow.com/q/25342817
answer count: 1
tagged with: ajax
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25343614
accepted answer: http://stackoverflow.com/a/25343614
tagged with: java
has title: Play Framework AJAX returns Object at badRequest()
type: Question
tagged with: return-type
score: 0
tagged with: bad-request
tagged with: playframework
has body: I know the badRequest() in play framework may result in rerendering a page like, badRequest(views.html.admin()), but I would like to return a String, in my case a SQLException. (SQLException e) If I return ok(e.toString()) instead of return badRequest(e.toString())it works, I think the return type of badRequest may be the problem. If I alert the data I get from the ajax call, I get for bad request [Object][object]. Is it even possible to return a String at badRequest() in java play framework? My Javascript code is this :) $("#deleteBuildingConfirm").click(function(q){ $('#confirmDelete').modal('hide'); $.ajax({ type : 'POST', url : '@routes.Admin.deleteBuilding()', data : { id: idOfBuild, name: nameOfBuild }, success : function(data) { alert(data); /** Wenn ein gebäude.. */ }, error : function(err) { alert(err); } }); return true; }); at alert(err) I always end up getting [Object][Object], when I trigger an SQLException. This is my Java function: public static Result deleteBuilding(){ final Map&lt;String, String[]&gt; values = request().body().asFormUrlEncoded(); final Long idToDelete = Long.parseLong(values.get("id")[0]); final String nameToDelete = values.get("name")[0]; String message="Deleted on server, row with id: "+idToDelete+"\n " +"Building with name: " +nameToDelete+" has been deleted."; try { Building.delete(idToDelete); return ok(message); } catch (SQLException e) { // TODO Auto-generated catch block final String badMessage = e.toString(); return badRequest(badMessage); } } Thanks in advance :), this is really bothering me! Appreciate your help!

http://stackoverflow.com/comment/39360276
comment on: http://stackoverflow.com/q/25260794
score: 0
has text: @Djon thanks for pointing out the errors in the code I posted. I have corrected it in my question. Unfortunately, my problem still remains. PS: I'm using avconv instead of ffmpeg because avconv seems to be the replacement of ffmpeg in the latest Ubuntu (?)
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25322859
possible better answer: http://stackoverflow.com/a/25323160
answer count: 2
tagged with: hashcode
has answer: http://stackoverflow.com/a/25323173
tagged with: java
has body: I am trying to write a custom hashCode fn, but I am not able to figure out the correct way to do that. public class Person { String name; List&lt;String&gt; attributes; @Override public boolean equals(Object o) { // Persons are equal if name is equal &amp; if &gt;= 2 of attributes are equal // This I have implemented } @Override public int hashCode() { final int PRIME = 59; int result = 1; result = (result*PRIME) + (this.name == null ? 0 : this.name.hashCode()); //Not sure what to do here to account for attributes return result; } } I want the hashCode fn to be such that: "If object1 and object2 are equal according to their equals() method, they must also have the same hash code" Not sure how to do that?
has comment: http://stackoverflow.com/comment/39474007
type: Question
tagged with: equals
has comment: http://stackoverflow.com/comment/39474120
accepted answer: http://stackoverflow.com/a/25323173
has comment: http://stackoverflow.com/comment/39474101
has title: Custom hashCode when using part of a List for comparision
has comment: http://stackoverflow.com/comment/39474378
has comment: http://stackoverflow.com/comment/39474195
has comment: http://stackoverflow.com/comment/39474314
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25323160

http://stackoverflow.com/comment/79993509
type: QuestionComment
has text: FYI, the troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html), [`java.util.Calendar`](https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html), and `java.text.SimpleDateFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [java.time](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) classes. See [Tutorial by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).
score: 0
comment on: http://stackoverflow.com/q/25336770
type: Comment

http://stackoverflow.com/q/25273221
answer count: 2
tagged with: mapping
downvote count: 0
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25273472
has answer: http://stackoverflow.com/a/25273450
has title: Map each value in a Java array (or similar) like in Ruby
type: UnansweredQuestion
tagged with: arrays
has body: It's been a while since I last used Java, so forgive me if the question is stupid. In Ruby, I use .map quite a lot. Is there something similar in Java or do I have to iterate over the Array? In Ruby, instead of output = [] input.each do |elem| output &lt;&lt; SomeClass.new(elem) end I can write output = input.map { |elem| SomeClass.new(elem) }
upvote count: 2
score: 2

http://stackoverflow.com/comment/39505948
type: AnswerComment
has text: Thanks for the help guys, I'm not sure why I missed that. But now, I'm getting a NullPointerException on the line **frame.add(row[i]);**, not really sure what to do about that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25299498

http://stackoverflow.com/q/25369738
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39561108
has answer: http://stackoverflow.com/a/25369776
has title: Why is uppercase not sorted correctly here?
has comment: http://stackoverflow.com/comment/39560160
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25369774
has answer: http://stackoverflow.com/a/25369783
has comment: http://stackoverflow.com/comment/39561844
has answer: http://stackoverflow.com/a/25369792
has comment: http://stackoverflow.com/comment/39561664
tagged with: sorting
tagged with: alphabetical
score: 2
upvote count: 3
has body: I am attempting to sort a List&lt;String&gt; of items. Here's the unsorted List, and how it's currently being sorted: Unsorted: [Pineapple, pineapple, apple, apricot, Banana, mango, Mango, melon, peach] Sorted: [apple, apricot, Banana, mango, Mango, melon, peach, Pineapple, pineapple] How come Mango is not placed before mango, and why is Pineapple before pineapple? Here is my code: import java.util.*; import java.lang.*; import java.io.*; class Test { public static void main (String[] args) throws java.lang.Exception { List&lt;String&gt; fruits = new ArrayList&lt;String&gt;(7); fruits.add("Pineapple"); fruits.add("pineapple"); fruits.add("apple"); fruits.add("apricot"); fruits.add("Banana"); fruits.add("mango"); fruits.add("Mango"); fruits.add("melon"); fruits.add("peach"); System.out.println("Unsorted: " + fruits); Collections.sort(fruits, new Comparator&lt;String&gt;() { @Override public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); System.out.println("Sorted: " + fruits); } }
has answer: http://stackoverflow.com/a/25369845
tagged with: java
downvote count: 1

http://stackoverflow.com/a/25297095
type: Answer
has body: -XX:MaxPermSize=64m Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.] no longer exist in &gt;= 8 version -Xmxn Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts.
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25297022

http://stackoverflow.com/q/25285932
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/39407896
type: Question
has comment: http://stackoverflow.com/comment/39405112
has answer: http://stackoverflow.com/a/25286953
has body: I have a simple converter method for an array from boolean to int: public static int[] convert1dToInt (boolean[] x) { int la = x.length; int[] y = new int[la]; for (int a = 0; a &lt; la; a++) { if (x[a]) { y[a] = 1; } else { y[a] = 0; } } return y; } Now I have the same method for 2-dimensional arrays: public static int[][] convert2dToInt (boolean[][] x) { int la = x.length; int lb = x[0].length; int[][] y = new int[la][lb]; for (int a = 0; a &lt; la; a++) { for (int b = 0; b &lt; lb; b++) { if (x[a][b]) { y[a][b] = 1; } else { y[a][b] = 0; } } } return y; } How can I generalize those methods for arrays of arbitrary dimension without writing all the methods by hand?
has title: Array of arbitrary dimension as method parameter
has answer: http://stackoverflow.com/a/25286200
score: 8
has answer: http://stackoverflow.com/a/25287467
has comment: http://stackoverflow.com/comment/39405042
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25287467
answer count: 3
possible better answer: http://stackoverflow.com/a/25286953
has comment: http://stackoverflow.com/comment/39406011
tagged with: java
tagged with: arrays
downvote count: 0
tagged with: methods

http://stackoverflow.com/a/25293929
has comment: http://stackoverflow.com/comment/91720694
has comment: http://stackoverflow.com/comment/117348813
downvote count: 1
score: 98
answers question: http://stackoverflow.com/q/25283198
has body: By default Spring uses org.springframework.boot.orm.jpa.SpringNamingStrategy to generate table names. This is a very thin extension of org.hibernate.cfg.ImprovedNamingStrategy. The tableName method in that class is passed a source String value but it is unaware if it comes from a @Column.name attribute or if it has been implicitly generated from the field name. The ImprovedNamingStrategy will convert CamelCase to SNAKE_CASE where as the EJB3NamingStrategy just uses the table name unchanged. If you don't want to change the naming strategy you could always just specify your column name in lowercase: @Column(name="testname")
has comment: http://stackoverflow.com/comment/70671069
upvote count: 99
type: Answer

http://stackoverflow.com/comment/39416585
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25291952
has text: @roelofs I have a combined modem/router. And yes.

http://stackoverflow.com/comment/39616777
comment on: http://stackoverflow.com/a/25385267
type: AnswerComment
has text: @WaseemAkhtar Sounds like you need Portable Objects functionality which is released in GridGain 6.2.0 enterprise edition. Portable objects allow for dynamic data structure changes and index rebuilding on the fly.
score: 0
type: Comment

http://stackoverflow.com/comment/39339466
type: Comment
has text: Let me make sure I understand: you just want nothing to happen when the methodToStub is called? And mockObject is a a mock object created with mock(YourClass.class)?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25250105

http://stackoverflow.com/comment/39479909
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25325821
has text: I have done the modifications according to your suggestion buddy but it shows some errors in the doinbackground and onpostexecute. Please help.
score: 0

http://stackoverflow.com/a/25266984
has comment: http://stackoverflow.com/comment/39370728
has comment: http://stackoverflow.com/comment/39370320
answers question: http://stackoverflow.com/q/25266893
has comment: http://stackoverflow.com/comment/39370374
has comment: http://stackoverflow.com/comment/39370996
score: 2
upvote count: 3
has body: See this CREATE TABLE command: private static final String DATABASE_CREATE = "create table " + TABLE_SCANS + "(" + COLUMN_ID + " integer primary key autoincrement," + COLUMN_IMAGEFILE + " image file, " + COLUMN_TIME + " time taken, "+COLUMN_LOCATION+" location image taken);"; It's all wrong. In SQLite, there's no such a data type: image file nor a datatype time taken nor a datatype location image taken I assume you wanted to write something like: private static final String DATABASE_CREATE = "create table " + TABLE_SCANS + "(" + COLUMN_ID + " integer primary key autoincrement," + COLUMN_IMAGEFILE + " TEXT, " + COLUMN_TIME + " INTEGER, "+COLUMN_LOCATION+" TEXT)";
has comment: http://stackoverflow.com/comment/39370359
downvote count: 1
type: Answer

http://stackoverflow.com/a/25372860
downvote count: 0
answers question: http://stackoverflow.com/q/25372761
type: Answer
has body: with nio: Path filePath = Paths.get("/etc/passwd"); List&lt;String&gt; fileLines = Files.readAllLines(filePath); Note that Files.readAllLines without 2nd parameter treats the file encoding as UTF-8, instead of system encoding (property "file.encoding")
score: 2
upvote count: 2

http://stackoverflow.com/q/25341579
has body: I downloaded the jdk-7u67-linux-x64.tar.gz file from the Oracle website, unzipped it and also created a symbolic link just like one of the tutorial said. (I'm very new to these things, so I have no idea what a symbolic link means so please explain it.) Right now, whenever I type Java, it says /usr/bin/java is a directory. I can't find any answer to this problem. Thanks in advance.
has comment: http://stackoverflow.com/comment/39509520
downvote count: 0
has comment: http://stackoverflow.com/comment/39509357
has comment: http://stackoverflow.com/comment/39509397
accepted answer: http://stackoverflow.com/a/25341901
type: AnsweredQuestion
score: 3
tagged with: linux
has answer: http://stackoverflow.com/a/25341901
upvote count: 3
tagged with: java
has title: /usr/bin/java: is a directory
answer count: 1
has comment: http://stackoverflow.com/comment/39509450
favorite count: 0
type: Question

http://stackoverflow.com/comment/39469965
comment on: http://stackoverflow.com/q/25320625
type: Comment
has text: Java Home should be the first one. Is a java entry like %JAVA_HOME%\bin (or C:\...\Java\jdk...\bin) in you PATH environment variable ?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39540049
comment on: http://stackoverflow.com/a/25249441
type: Comment
score: 0
type: AnswerComment
has text: I need to get the value "360" from ex:(peak:360) [ in some line but i also have same kind of pattern (peak:520) foobar [ , in my result i get two results , i want to filter it out the exact pattern (peak:xxx) [

http://stackoverflow.com/comment/39319910
has text: That was I typo I made only in this post, in my project i have tried $modal. I edited my post now and made an edit note.
comment on: http://stackoverflow.com/a/25239909
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25284724
has comment: http://stackoverflow.com/comment/39415492
score: 3
has answer: http://stackoverflow.com/a/53414458
possible better answer: http://stackoverflow.com/a/53414458
tagged with: sockets
tagged with: java
has answer: http://stackoverflow.com/a/25285097
accepted answer: http://stackoverflow.com/a/25285097
tagged with: clojure
type: AnsweredQuestion
upvote count: 3
answer count: 2
has body: I'm a Clojure noob, so bear with me. I'm trying to write a simple program to send a command through a socket and get a response. My code is: (def IPaddress "10.71.18.81") (def port 1500) (def socket (new Socket IPaddress port)) (print (clojure.string/join ["\nConnected to HSM: " (. socket isConnected)])) (def in (DataInputStream. (BufferedInputStream. (. socket getInputStream)))) (def out (DataOutputStream. (BufferedOutputStream. (. socket getOutputStream)))) (def command "Some string") (. out WriteUTF command) (def response (. in readUTF)) (print (clojure.string/join ["Output from HSM: " response])) The error is "Exception in thread "main" java.lang.IllegalArgumentException: No matching method: writeUTF". I'm having trouble understanding Java interop, and accessing object methods, etc. Thanks in advance. EDIT: If anyone is interested, my final working code is included here: (def IPaddress "10.71.18.81") (def port 1500) (def socket (Socket. IPaddress port)) (println "Connected:" (.isConnected socket)) (def in (DataInputStream. (BufferedInputStream. (.getInputStream socket)))) (def out (DataOutputStream. (BufferedOutputStream. (.getOutputStream socket)))) (def command "Some string") (println "Input:" command) (.writeUTF out command) (.flush out) (def response (.readUTF in)) (println "Output: " response)
downvote count: 0
has title: Socket programming in Clojure
favorite count: 0
type: Question

http://stackoverflow.com/comment/41853294
comment on: http://stackoverflow.com/q/25370785
has text: @kharyam Unfortunately, no. The problem just stopped happening at the client site, so I've let sleeping dogs lie. In a way, it's nice to hear that somebody else has seen it, though - please do post a followup if you figure anything out!
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25278802
has body: I have one question, can I make something, that would read any noumber and than use that number in calculations? String s1 = editText.getText().toString(); if (s1.contains("H--some number--")) { d += (H * --some number--); } When user types H2, i want to read that 2 and than use is in calculations, but user can also type other numbers. For example H5 and than i need H * 5. Do i need to write every possible input? s1.contains(H2) ; s1.contains(H5) Thanks for answer!
accepted answer: http://stackoverflow.com/a/25278863
has title: How to read some number and then use it in calculations
has answer: http://stackoverflow.com/a/25278863
has answer: http://stackoverflow.com/a/25278890
tagged with: eclipse
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25278884
has comment: http://stackoverflow.com/comment/39391815
upvote count: 0
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/39391790
has comment: http://stackoverflow.com/comment/39391789
has comment: http://stackoverflow.com/comment/39391987
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/25278884
has comment: http://stackoverflow.com/comment/39391866
has comment: http://stackoverflow.com/comment/39392360
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39507784
has text: That's what the filter is for: http://logback.qos.ch/manual/filters.html#levelFilter
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25339612

http://stackoverflow.com/a/25308646
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25291845
score: 2
answers question: http://stackoverflow.com/q/25291845
type: Answer
has body: Akka have some lifecycle methods that you can override. For example on preStart method you can register your actor to router and on postStop you can remove it. override def preStart() { router ! AddMe } override def postStop() { router ! RemoveMe } Akka has good documentation about actor's lifecycle.
upvote count: 2

http://stackoverflow.com/a/25259714
answers question: http://stackoverflow.com/q/25259651
has body: double d = 0; if (s1.contains("H")) { d += 1; // H is double with value of 1 } if (s1.contains("O")) { d += 16; // O is double with value of 16 }
downvote count: 0
upvote count: 1
type: Answer
score: 1

http://stackoverflow.com/comment/39461345
has text: You should favor composition over inheritance. If you really want a more convenient use of the List methods, wrap a list inside one of your custom class. Note that a UserList is really just a List<User> so I'd focus on a User class rather than a UserList class.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25316010

http://stackoverflow.com/a/25352384
has comment: http://stackoverflow.com/comment/39553948
has body: You can also select and change all alarmIds at once: rs = database. executeQuery("Select group_concat(distinct alarmId) as alarmIds from alarms group by alarmDate having alarmDate = '" + Alarm.getFormattedDateTime(DateFormat.FULL, DateFormat.SHORT) + "'"); while (rs.next()) { // there will be only one result database.executeUpdate("update alarms set alarmStatus = '"+status+"' where alarmId in ("+rs.getString("alarmIds")+")"); }
score: 0
has comment: http://stackoverflow.com/comment/39553974
has comment: http://stackoverflow.com/comment/39552843
type: Answer
answers question: http://stackoverflow.com/q/25351891
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25351891

http://stackoverflow.com/comment/39423881
has text: Double clicking would not result in an error, just an un successful execution. Since he can run successfully with the command-line, there is no easy way to find out the exact error that I know of
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25294533

http://stackoverflow.com/comment/39599432
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25376140
has text: @cdk Thank you for the feedback. I have updated my answer in attempt to make it more clear that you can create `IO` values anywhere, but their effects only occur in the `main` function. If you have more suggestions for clarity, please let me know.
type: Comment

http://stackoverflow.com/comment/39393133
has text: You have given url-pattern as "*.htm" try hitting localhost:8080/HelloWeb/helloWorld.htm instead of localhost:8080/HelloWeb/helloWorld. Note the difference of ".htm"
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25279532
type: QuestionComment

http://stackoverflow.com/q/25291771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25292246
has comment: http://stackoverflow.com/comment/39416478
tagged with: java
answer count: 1
tagged with: generics
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39416777
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/39416852
has comment: http://stackoverflow.com/comment/39416868
has comment: http://stackoverflow.com/comment/39417003
downvote count: 0
has comment: http://stackoverflow.com/comment/39416217
has body: I'm confused by a bit of Java 8's type inference. The following code: private static &lt;T&gt; Function&lt;Iterable&lt;? extends T&gt;, Iterator&lt;? extends T&gt;&gt; toIterator() { return Iterable&lt;? extends T&gt;::iterator; } breaks with the compile error error: incompatible types: invalid method reference return Iterable&lt;? extends T&gt;::iterator; ^ method iterator in interface Iterable&lt;T#2&gt; cannot be applied to given types required: no arguments found: Iterable&lt;? extends T#1&gt; reason: actual and formal argument lists differ in length where T#1,T#2 are type-variables: T#1 extends Object declared in method &lt;T#1&gt;toIterator() T#2 extends Object declared in interface Iterable whereas removing the explicit generic private static &lt;T&gt; Function&lt;Iterable&lt;? extends T&gt;, Iterator&lt;? extends T&gt;&gt; toIterator() { return Iterable::iterator; } works, as does the old-school anonymous inner class private static &lt;T&gt; Function&lt;Iterable&lt;? extends T&gt;, Iterator&lt;? extends T&gt;&gt; toIterator() { return new Function&lt;Iterable&lt;? extends T&gt;, Iterator&lt;? extends T&gt;&gt;() { @Override public Iterator&lt;? extends T&gt; apply(Iterable&lt;? extends T&gt; iterable) { return iterable.iterator(); } }; } Can anyone suggest what might be going on here?
tagged with: java-8
has title: Java 8 method reference type inference
has comment: http://stackoverflow.com/comment/39417044
accepted answer: http://stackoverflow.com/a/25292246
has comment: http://stackoverflow.com/comment/39416941
has comment: http://stackoverflow.com/comment/39416902
has comment: http://stackoverflow.com/comment/39416833
has comment: http://stackoverflow.com/comment/39416806
has comment: http://stackoverflow.com/comment/39417294

http://stackoverflow.com/comment/39519089
type: Comment
type: QuestionComment
has text: __Dynamic__ programming.
comment on: http://stackoverflow.com/q/25347582
score: 0

http://stackoverflow.com/comment/39571083
has text: @ElliottFrisch - `s1.value == s2.value : true`// this proves that the internal char array is the same for both s1 snd s2
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25375272
type: QuestionComment

http://stackoverflow.com/comment/39363718
type: Comment
has text: What is the purpose of the `switch`?
comment on: http://stackoverflow.com/a/25263505
type: AnswerComment
score: 0

http://stackoverflow.com/q/25310551
has comment: http://stackoverflow.com/comment/39451783
has comment: http://stackoverflow.com/comment/39451244
tagged with: httpclient
has comment: http://stackoverflow.com/comment/39451203
tagged with: request
has title: HttpClients.createDefault error?
score: 0
tagged with: invocationtargetexception
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/32048771
has comment: http://stackoverflow.com/comment/39451263
has comment: http://stackoverflow.com/comment/39450919
has body: i created a RestUtils library which uses org.apache.httpclient and this is what happens: i have this fragment of code inside these library: ... // Make the request this.httpClient = HttpClients.createDefault(); this.method.setHeaders(headerArray); HttpResponse httpResponse = this.httpClient.execute(this.method); HttpRestResponse response = new HttpRestResponse(); ... Well happens that first line (createDefault method) works ok when i call this method from "strap" project, but when i call it from "social" project, it fails at these line. This is not throwing any error, but debugging i found this exception: java.lang.reflect.InvocationTargetException What could be the reason for createDefault() method fails depending where i call from? Regards Edit: I found that exception because inside method "invokeMethod()" (some internal method of createDefault()) it gets into this catch: catch(InvocationTargetException ite) { testResult.setThrowable(ite.getCause()); testResult.setStatus(ITestResult.FAILURE); } As i said, this doesn't have e.printStackTrace() and i can't add it because i have it as depndency and i am not able to edit it However, i have a catch where i call createDefaults method and it doesn't print stacktrace neither try { ... // Make the request this.httpClient = HttpClients.createDefault(); ... } catch (Exception e) { e.printStackTrace(); return null; }
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39477874
type: AnswerComment
comment on: http://stackoverflow.com/a/25324929
type: Comment
has text: @RuchiraGayanRanaweera There is enough in his code to see that this is what's happening (I also ran into a problem like this before).
score: 0

http://stackoverflow.com/q/25284011
possible better answer: http://stackoverflow.com/a/25284129
answer count: 5
downvote count: 0
score: 18
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/39401475
has body: all I want to do is autowire the field backgroundGray in the NotesPanel class, but all I get is the exception below. So, question is, how to autowire it correctly ? It really drives me crazy because it's probably something very stupid I'm doing wrong... thanks for any help! Thorsten Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notepad' defined in class path resource [Beans.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [notepad.Notepad]: Constructor threw exception; nested exception is java.lang.NullPointerException Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [notepad.Notepad]: Constructor threw exception; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at notepad.NotesPanel.&lt;init&gt;(NotesPanel.java:23) at notepad.Notepad.&lt;init&gt;(Notepad.java:18) Class Notepad: package notepad; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Notepad { public Notepad() { JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); frame.add(new NotesPanel(), BorderLayout.CENTER); frame.setPreferredSize(new Dimension(1024, 768)); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLocationRelativeTo(null); } public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); context.getBean("notepad"); } } Class Notespanel: package notepad; import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JTextPane; import org.springframework.beans.factory.annotation.Autowired; public class NotesPanel extends JPanel { JTextPane…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/58381117
has answer: http://stackoverflow.com/a/25284129
has answer: http://stackoverflow.com/a/25639956
tagged with: java
has answer: http://stackoverflow.com/a/25284157
accepted answer: http://stackoverflow.com/a/25284157
upvote count: 18
has title: How to autowire an object in spring in an object created with new
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39401482
has answer: http://stackoverflow.com/a/25284246

http://stackoverflow.com/a/25234993
has body: If you use toArray(String[][]::new) instead of toArray() it will return a String[][] instead of an Object[] and you wont need to cast it at all (if you assign it to a String[][]).
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25234881
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/25234881
type: Answer

http://stackoverflow.com/comment/39375097
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25269555
has text: My comment points out this related answer.

http://stackoverflow.com/a/25269045
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25269044
upvote count: 9
has comment: http://stackoverflow.com/comment/43432885
has comment: http://stackoverflow.com/comment/43804972
has comment: http://stackoverflow.com/comment/47885709
answers question: http://stackoverflow.com/q/25269044
type: Answer
has body: After doing some trial and error work, I found that it is possible to remove some dependencies without breaking it. So far after almost one month of use, the documentation tool seems to work properly. These are the dependencies I removed: com.wordnik swagger-jersey2-jaxrs_2.10 ${swagger-jersey.version} jackson-module-scala_2.10 com.fasterxml.jackson.module scalap org.scala-lang This removes basically three big jars: scalap, scala-compiler and scala-reflect. Which means almost 19 MB of reduced size. I am not saying that you should not follow the advice of the developers from the Swagger team about not removing scala dependencies, but so far this has worked for me and wanted to share it. I made my comments and closed the issue in Github as well: https://github.com/wordnik/swagger-core/issues/624
score: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/44324703

http://stackoverflow.com/comment/39301651
type: QuestionComment
comment on: http://stackoverflow.com/q/25230504
score: 0
has text: @pedromss That works, hovewer i still don't understand what is the problem
type: Comment

http://stackoverflow.com/comment/39594450
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25386187
has text: You need to create your session before starting pushing out the output.

http://stackoverflow.com/q/25292551
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25292712
accepted answer: http://stackoverflow.com/a/25292712
has comment: http://stackoverflow.com/comment/39417423
has answer: http://stackoverflow.com/a/25292925
linked to: http://stackoverflow.com/q/1945075
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39417525
has answer: http://stackoverflow.com/a/25292658
possible better answer: http://stackoverflow.com/a/25292658
score: 6
upvote count: 6
has body: I am little bit curious about that what happen if I manually changed something into bytecode before execution. For instance, let suppose assigning int type variable into byte type variable without casting or remove semicolon from somewhere in program or anything that leads to compile time error. As I know all compile time errors are checked by compiler before making .class file. So what happen when I changed byte code after successfully compile a program then changed bytecode manually ? Is there any mechanism to handle this ? or if not then how program behaves after execution ? EDIT :- As Hot Licks, Darksonn and manouti already gave correct satisfy answers.Now I just conclude for those readers who all seeking answer for this type question :- Every Java virtual machine has a class-file verifier, which ensures that loaded class files have a proper internal structure. If the class-file verifier discovers a problem with a class file, it throws an exception. Because a class file is just a sequence of binary data, a virtual machine can't know whether a particular class file was generated by a well-meaning Java compiler or by shady crackers bent on compromising the integrity of the virtual machine. As a consequence, all JVM implementations have a class-file verifier that can be invoked on untrusted classes, to make sure the classes are safe to use. Refer this for more details.
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25292628
has title: What happen if I manually changed the bytecode before running it?

http://stackoverflow.com/comment/39363878
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25261907
has text: Thanks. Yes, JMV `CAN` handle every memory size, but my question is does it waste any memory if I use a value which is not rounded to a multiple of 2? It is more of a best practice question, I guess. Is it stated anywhere in the specification or the implementation about how JVM manages the memory(some links to this info would be good)?
score: 0

http://stackoverflow.com/comment/39548001
comment on: http://stackoverflow.com/a/25363478
type: Comment
score: 0
type: AnswerComment
has text: here it is showing error when i am using in servlet this line emp1.setFileBytes(filePart.getBytes()) , it is saying method getBytes is undefined for the type part... even trying to cast but it is not working.... suggest me here something

http://stackoverflow.com/comment/39561664
comment on: http://stackoverflow.com/q/25369738
score: 0
type: Comment
type: QuestionComment
has text: @admdrew: Would you please stop editing the question in a manner that clearly changes its meaning (and makes an already confusing situation worse).

http://stackoverflow.com/q/25246716
tagged with: playframework
has comment: http://stackoverflow.com/comment/39369853
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39334878
answer count: 1
has comment: http://stackoverflow.com/comment/39333192
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39334239
type: UnansweredQuestion
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25246945
score: -1
has body: I am trying to figure out play framework and I am trying to do some stuff in java. However I defined a superclass with 2 variables as super class Place(int ID, String Nam) { } and I want to define "nam" however it doesn't accept as "string" it says cannot resolve symbol I have done stuff written in previous examples in stackoverflow (invalidating cache and redefining directory to jdk in project structure) but nothing changed, I'm still getting the same error! Any ideas ?
has comment: http://stackoverflow.com/comment/39343627
has comment: http://stackoverflow.com/comment/39334854
has title: intelli j" cannot resolve symbol"

http://stackoverflow.com/q/25246296
has answer: http://stackoverflow.com/a/25246401
score: 0
answer count: 3
has title: files missing from src folder (Jboss/eclipse)
tagged with: java
has comment: http://stackoverflow.com/comment/39331904
has answer: http://stackoverflow.com/a/25246636
tagged with: jboss
has body: In JBoss (Eclipse) I am having a problem with my src files showing up in the src folder in the package explorer. As you can see from the picture on the left there is nothing in the folder for test, and no java files under main, but webapp. For example though I went to where the files are stored and show you that there are infact tons of files inside of the test folder. Any idea how to get them to show back up in the Package explorer in eclipse? edit: srry forgot pic
tagged with: eclipse
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25249153

http://stackoverflow.com/a/25345623
answers question: http://stackoverflow.com/q/25341037
accepted answer of: http://stackoverflow.com/q/25341037
has body: You state this: In order to access a non-static members/variables of a class you need to first create an object in public static void main(String args[]) method. That is only partiallly true. Yes. You do need to create an instance of a class in order to use its non-static members. But the instance does not need to be created in the main method. Indeed, you don't necessarily need to create any objects in main. (There are other ways to create your application's "primordial" objects ... and indeed, your application may not even have a main.) Does this mean that all the objects that are created are static? No. For a number of reasons. Your initial premise is not (entirely) true. The fact that some (primordial) objects are created by static methods does not mean that all objects are created that way. The most important reason is that there is no such thing as a static object in Java! This notion1 of static applies to fields and methods. A static field or method is one that is not a member of a single object (instance). But that doesn't apply to objects (instances) themselves. In Java, objects are always independent entities, and they are never members of something else ... at least at the programming language level. For example: public class Example { public static String test; public static void main(String[] args) { test = new String("Hi mum!"); } } The test variable is static and we assign a reference to a freshly created String object to it. But later on, we could assign the value of test to a non-static variable, or assign a reference to a different object to test. The object that we created is no different to one that we might create in a non-static context. I need to know how the memory allocation is done for static methods/variables of a class. The allocation of memory for objects is done exactly the same way if the method where new is invoked is static or non-static. The allocation of memory for objects is done exactly the same way if the field you are assigning…
type: Answer
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/44159985
has comment: http://stackoverflow.com/comment/104801199
type: Answer
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/25259836
downvote count: 1
has body: import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; public class XMLXpathReadder { public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, XPathExpressionException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(new FileInputStream(new File("C:\\Test.xml")));// same xml comments as above. XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); Element userElement = (Element) xpath.evaluate("/schema/element", document, XPathConstants.NODE); System.out.println(userElement.getAttribute("id")); System.out.println(userElement.getAttribute("name")); } } Above Code work for me. But how to read values of all elements. I am getting always first elements node only. <?xml version="1.0" encoding="UTF-8"?> test name1 test name2 test name3

http://stackoverflow.com/a/25380349
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25380211
has body: "Call sendMessage" - is starting new jvm with invoking main methiod run SendMessage, you create new jvm, new class loader, new classes, new static variables. And all this new 'things' don't know about your previous run. If you want to use some values between invoking jvm, you should store them in some files (db).

http://stackoverflow.com/q/25310053
has comment: http://stackoverflow.com/comment/39450011
has answer: http://stackoverflow.com/a/25310201
upvote count: 3
tagged with: java
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39450012
tagged with: hashmap
has answer: http://stackoverflow.com/a/25310173
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39450020
has answer: http://stackoverflow.com/a/25310299
has title: Internal structure of Hashmap
score: 2
linked to: http://stackoverflow.com/q/15768695
answer count: 3
has body: I was going through the internal structure of HashMap and got stuck in the concept of how a bucket stores multiple objects. As HashMap is an array of Entry objects, every index of array is a bucket. The Entry class is like static class Entry&lt;K,V&gt; implements Map.Entry&lt;K,V&gt; { K key; V value; Entry&lt;K,V&gt; next_entry; int hash; } On Adding a new key-value pair If we are adding a value with a key which has already been saved in HashMap, then the value gets overwritten. Otherwise the element is added to the bucket. If the bucket already has at least one element, a new one is gets added and placed in the first position in the bucket. Its next field refers to the old element. So how can a bucket store multiple object as per the 2nd point?
has comment: http://stackoverflow.com/comment/39450144
has comment: http://stackoverflow.com/comment/39450067

http://stackoverflow.com/q/25309063
type: Question
has title: JSP-VXML - Page not valid VXML
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39474667
has comment: http://stackoverflow.com/comment/39448456
tagged with: validation
score: 0
answer count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/39547601
has body: I'm using VXML in JSP page. Sample code below: &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;!DOCTYPE vxml PUBLIC "-//W3C//DTD VOICEXML 2.0//EN" "http://www.w3.org/TR/voicexml20/vxml.dtd" &gt; &lt;%@page import="VXMLPropertiesLoader"%&gt; &lt;%@page import="Context"%&gt; &lt;% Context context = new Context(this.getServletContext()); VXMLPropertiesLoader vxmlPropertiesLoader = (VXMLPropertiesLoader) context.getBean("vxmlPropertiesLoader"); %&gt; &lt;vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd" application="root.jsp"&gt; &lt;form&gt; &lt;block&gt; &lt;prompt&gt; &lt;break time="&lt;%= vxmlPropertiesLoader.getVXMLProperty("welcome_delay") %&gt;"/&gt; &lt;audio expr="'/Service/&lt;%= vxmlPropertiesLoader.getVXMLProperty("waiting_music") %&gt;'+audioExt"&gt; &lt;/audio&gt; &lt;/prompt&gt; &lt;/block&gt; &lt;/form&gt; The var break_time is correctly set, as well as audio_expr The imported_pages are in the WEB-INF/classes Eerything is fine except the server states : CRITICAL Err=205|VXIinterpreterRun: Failed to parse the URI's content. Make sure that this document consists of valid VXML. In W3C validator it states that the &lt;%@ is illegal ...
tagged with: vxml

http://stackoverflow.com/q/25252853
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39344705
downvote count: 1
has title: What are the parent components and what are the child components?
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25256795
upvote count: 1
tagged with: swing
score: 0
has body: I keep hearing these two term when it comes to painting in Swing, however, I'm not sure which is which. To my understanding is that the child components are the ones that already exist on screen (could be a JButton, JFrame, or custom painting) . and the parent components are the one to be added/drawn next. (hence, if we override the paintChildren() method when painting, the components that were already on the screen don't appear any more). Can someone validate this for me as my head is starting to hurt from thinking about, LOL

http://stackoverflow.com/comment/39547263
score: 0
comment on: http://stackoverflow.com/q/25362674
has text: yes that is a typo and no it does not give anything. I tried to debug the code `try { $RESULT = curl_exec($ch); if (!$RESULT) { $message = 'Error :' . curl_error($ch) . '- Code: ' . curl_errno($ch); throw new CurlException(); } else { // some code } } catch (CurlException $exc) { error_log($exc->getTraceAsString(), 3, $destination); }` and placed debug point at if () statement, but it never executed
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39395926
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25280911
has text: `XMLHttpRequest`s include a [`responseXML` property](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties) for XML responses. Provided a valid response, it should hold a DOM document created from the XML.

http://stackoverflow.com/comment/133507842
score: 0
type: Comment
type: AnswerComment
has text: like with ignore case `@Query("Select c from Registration c where lower(c.place) like lower(concat('%', :place,'%')")`
comment on: http://stackoverflow.com/a/25363398

http://stackoverflow.com/comment/39572433
has text: Note that `java -version` fails in Windows if you don't set the location of `java.exe` in `PATH` environment variable.
type: Comment
comment on: http://stackoverflow.com/a/25376039
type: AnswerComment
score: 1

http://stackoverflow.com/q/25372527
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 6
tagged with: dns
has title: Prevent Java DNS resolution
favorite count: 0
tagged with: proxy
tagged with: java
upvote count: 6
type: Question
has body: Question: how can I force Java not to resolve some hostnames to IP addresses. In my application, I am using Socks proxy to make connections to external sites. Our socks proxy server is configured in such a way that it can only accept URL's "www.google.com" and not the resolved IP addresses like "xxx.xxx.xx.xx". This socks proxy connections are done within another api on whose code I don't have control. I just wrote a proxyselector and made sure that whenever certain URLS are being called, it will be going through our proxy server. This logic seems to work in our lower environments . but in production boxes, somehow the URLS that are being sent to socks proxy are resolved IP's rather than URLS. My Question, how can I force Java not to resolve hostnames that go through socks proxy. Thanks. Regards, Hariharan

http://stackoverflow.com/comment/39438869
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25303478
type: Comment
has text: Just because you need to build *some* of the SQL dynamically doesn't mean you have to do it *all* dynamically. I *strongly, strongly, strongly* urge you not to do so. Specifying values directly in SQL is *fraught* with danger. You can still create the SQL dynamically, but include parameter specifiers in there and use `PreparedStatement.setDate` etc.

http://stackoverflow.com/q/25294533
answer count: 0
has comment: http://stackoverflow.com/comment/39423730
has comment: http://stackoverflow.com/comment/39422164
has comment: http://stackoverflow.com/comment/39423087
score: 0
has title: Jar file runs successfully from command line, but freezes when double clicked in windows
has comment: http://stackoverflow.com/comment/39423881
tagged with: java
has comment: http://stackoverflow.com/comment/39423149
linked to: http://stackoverflow.com/q/7325676
has comment: http://stackoverflow.com/comment/39422360
has comment: http://stackoverflow.com/comment/39421851
has body: I'm having issues running a jar file I compiled from an eclipse project. I'm fairly new to Java so I'm likely missing something simple. When I run the jar file from the command line: javaw -jar test1.jar the program runs fine. But when I double click the jar it doesn't run. I believe the issue has to do with 32 bit versus 64 bit java (double clicking the jar file opens the "javaw.exe *32" process whereas running from the command line opens "javaw.exe"). I'm using the swing GUI libraries, if that makes a difference. Is that the issue? Is there a way to make eclipse export a .jar file that will be compatible with "javaw.exe *32"? Thanks. EDIT: I figured out the error was related to using generics with JList, which is only supported in Java 7. Double clicking the .jar was running a 32-bit version of Java 6, which is what was throwing the error. Thanks for the help guys
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39422143
has comment: http://stackoverflow.com/comment/39421922
has comment: http://stackoverflow.com/comment/39423002
has comment: http://stackoverflow.com/comment/39422491
type: Question
has comment: http://stackoverflow.com/comment/39422838
has comment: http://stackoverflow.com/comment/39422217
has comment: http://stackoverflow.com/comment/39421815
has comment: http://stackoverflow.com/comment/39421487
has comment: http://stackoverflow.com/comment/39421667
has comment: http://stackoverflow.com/comment/39425770
type: UnansweredQuestion
tagged with: windows
has comment: http://stackoverflow.com/comment/39423420
tagged with: jar
has comment: http://stackoverflow.com/comment/39423628
has comment: http://stackoverflow.com/comment/39421990
has comment: http://stackoverflow.com/comment/39421777
has comment: http://stackoverflow.com/comment/39421963
tagged with: swing
has comment: http://stackoverflow.com/comment/39422084
has comment: http://stackoverflow.com/comment/39422018
has comment: http://stackoverflow.com/comment/39422906
has comment: http://stackoverflow.com/comment/39422305
has comment: http://stackoverflow.com/comment/39421618
has comment: http://stackoverflow.com/comment/39422913
has comment: http://stackoverflow.com/comment/39422921
has comment: http://stackoverflow.com/comment/39492847
linked to: http://stackoverflow.com/q/783662

http://stackoverflow.com/a/25263824
has comment: http://stackoverflow.com/comment/39364439
has body: Your equality testing is wrong. You should use the equals() method, not ==
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25263758
has comment: http://stackoverflow.com/comment/39369242
type: Answer
upvote count: 1

http://stackoverflow.com/a/38861327
has body: You could have spaces in the beginning or the ending of your path, print your file.getAbsolutePath() in order to see the current path where java is reading.
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25308155
score: 1

http://stackoverflow.com/comment/39447321
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25308533
score: 0
has text: Another question uses this format; "Balance: \\$(\\d+)". Which would be more beneficial to my situation?

http://stackoverflow.com/comment/91984047
comment on: http://stackoverflow.com/a/26793743
type: Comment
score: 0
type: AnswerComment
has text: yes it should be org.hibernate.dialect.PostgresSQLDialect in the hibernate.dialect property

http://stackoverflow.com/a/25358091
type: Answer
score: 0
has body: You might have changed the app theme accidentally in layout. So you just need to change the theme. Go to any layout and open in graphic layout then you can see app theme option at top palette. Change that to any white.And to change entire app layout themes you can do that in manifest.like below. &lt;application android:theme="@style/AppTheme" &gt;---- &lt;/application&gt;
answers question: http://stackoverflow.com/q/25357967
has comment: http://stackoverflow.com/comment/39538031
has comment: http://stackoverflow.com/comment/39541083

http://stackoverflow.com/comment/39550626
comment on: http://stackoverflow.com/q/25352037
type: QuestionComment
has text: @NitsanWakart Good point, shared mutable and/or locked resources are the problem. Reducing duplication, can help performance.
type: Comment
score: 0

http://stackoverflow.com/q/25234925
has comment: http://stackoverflow.com/comment/39310802
type: AnsweredQuestion
has body: I writing a program with a JTable // I'm not going to write all the beginning stuff DefaultTableModel model = new DefaultTableModel(); JTable t = new JTable(model); Object[] 1 = {x, y, z}; model.addRow(1); String s = 1 I was wondering how would I make it so if someone were to edit while the program was running how would I make so up date; so say y = 6 and then someone changed it to 8 how would I make s update to 8 too?
has comment: http://stackoverflow.com/comment/39310812
tagged with: java
has answer: http://stackoverflow.com/a/25234997
accepted answer: http://stackoverflow.com/a/25234997
has comment: http://stackoverflow.com/comment/39310813
type: Question
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/39310818
has title: How would I make a variable update from a row
answer count: 1
tagged with: swing

http://stackoverflow.com/comment/39402493
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25275965
has text: Well, for the first one, 'Tom' is the first value in the List in the code above. So I'm not sure the first part of your answer is proper. But I get the second option working. thanks much! I'm also having to pass a variety of data formats. Next one being List of objects. I'm still not getting the hang of it as to why are we using so many double quotes. So not sure how to do it for objects. Will be grateful for more inputs.

http://stackoverflow.com/comment/39368573
type: Comment
type: AnswerComment
has text: @Holger You are right, parallelism complicates things here. If we start building two paths from different points then we also need to include distance between end of first path and start of second path (like in case of points `A B C D` when we want to combine paths `A->B` and `C->D` we also need to include `B->C`). I am not sure in which order paths will be combined so I suspect that maybe we would end up with combining second path with first one so we using last point from first path and first point from last path will give us `A->D` which would be entirely wrong.
score: 0
comment on: http://stackoverflow.com/a/25263120

http://stackoverflow.com/comment/39575050
comment on: http://stackoverflow.com/q/25377521
has text: to be honest, this question has shown little or no effort.
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/a/25367236
accepted answer of: http://stackoverflow.com/q/25366724
type: Answer
answers question: http://stackoverflow.com/q/25366724
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I solved the problem. I had a hashCode implementation on the entities that caused an infinite loop. It's still quite a strange behavior to throw a NullPointerException in this case...

hql
tags question: http://stackoverflow.com/q/25337075
tag name: hql
tags question: http://stackoverflow.com/q/25380716
type: Tag
tags question: http://stackoverflow.com/q/25380622
tags question: http://stackoverflow.com/q/25284234
tags question: http://stackoverflow.com/q/25319422
tags question: http://stackoverflow.com/q/25246858

http://stackoverflow.com/q/25233318
has title: Liferay String generated in method to jsp
tagged with: java
type: Question
tagged with: liferay
has answer: http://stackoverflow.com/a/25241511
type: UnansweredQuestion
answer count: 1
tagged with: jsp
has body: I have a liferay portlet where I want to take an input string and transfer/"get" it from the jsp into the portlet mvc class method. That string I want to use to search a database for some results and display a generated result string. I have tried a few of the setAttribute like methods of the renderRequest but it always gives a "null" result. I start simply by inputting the initial string through a text input form and accessing it in the method. &lt;input type="text" name="&lt;portlet:namespace/&gt;class" id="&lt;portlet:namespace/&gt;class"/&gt;&lt;br/&gt; String className = ParamUtil.getString(actionRequest, "class"); That part was successful. Then I am able to create the string from the search results and want to know what is the best way to display the simple string through the jsp. i.e. how can I transport this generated string to the jsp page?
score: 0

http://stackoverflow.com/comment/39601915
comment on: http://stackoverflow.com/q/25388069
has text: i use createCriteria because i create another JOIN later with the 2 one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/80949193
score: 3
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27494158
has text: After adding below sonar properties in Jenkins it started working for me .... `sonar.java.binaries=.` Hope it will help someone.

http://stackoverflow.com/comment/39521457
has text: open a command prompt, and execute the command `java -jar yourJarFile.jar`. Post the result.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25349000

http://stackoverflow.com/q/25282126
has comment: http://stackoverflow.com/comment/39430634
tagged with: sockets
has comment: http://stackoverflow.com/comment/39430109
has answer: http://stackoverflow.com/a/25460935
accepted answer: http://stackoverflow.com/a/25460935
has comment: http://stackoverflow.com/comment/39405940
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has title: Getting a ConnectionClosedException with Http.Core talking to Http.Client 4?
tagged with: java
tagged with: java-7
answer count: 1
has comment: http://stackoverflow.com/comment/39438092
has comment: http://stackoverflow.com/comment/39438366
has comment: http://stackoverflow.com/comment/39430838
favorite count: 0
type: Question
tagged with: apache-httpcomponents
tagged with: apache-httpclient-4.x
has body: I am trying my hand at using http.core &amp; client 4.3. In general it works well, and is quite pleasant to deal with. However, I am getting a ConnectionClosedException on one of my transfers and I can't see why. Others work just fine as far as I can tell. Everything follows the examples in a pretty straight forward way. If it didn't, it was re-written to as much as possible in an effort to get rid of this. There are 2 servers, both running the same code [A &amp; B] A HttpClient sends a request "AX" (POST) to B B HttpService receives the "AX" post, processes it B HttpClient sends a reply "BR" (POST) to A on a different port Later This should happen after the connection to A is closed, or as close as possible Right now the code doesn't actually care A receives the reply from B (on a different thread) and does things In the problem scenario, A is running as the server, and B is sending a POST. Sorry it isn't always clear, since in one transaction both sides end up running server and client code. A Sends POST to B:8080. Get back a proper response inline, everything ok. POST Connection to B:8080 gets closed properly B sends new POST (like an ACK) to A (ex... B:53991 => A:9000). A Processs everything. No issues A rasies ConnectionClosedException Since I don't why it's happening for sure, I tried to put everything I think is relevant in there. My only thought right now is that it has something to with making sure I add/change connection control headers, but I can't see how that would affect anything. Stack Trace from machine "A", when the reply from B comes org.apache.http.ConnectionClosedException: Client closed connection at org.apache.http.impl.io.DefaultHttpRequestParser.parseHead(DefaultHttpRequestParser.java:133) at org.apache.http.impl.io.DefaultHttpRequestParser.parseHead(DefaultHttpRequestParser.java:54) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260) at org.apache.http.impl.DefaultBHttpServerConnection.receiveRequestHeader(…

http://stackoverflow.com/q/25339159
type: UnansweredQuestion
has body: I am getting "java.lang.OutOfMemoryError: Java heap space" i have read about it and found out running Java with the command-line option -Xmx can solve this. But unfortunately i can't do that because this is an online judge problem. Can you guys suggest me any other way to reduce the heap size in the code? public static void main(String[] args) throws IOException { // Scanner bf = new Scanner(System.in); BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String x = "a"; String y = "a"; for (int i = 0; i &lt; 48000; i++) { x = x.concat("a"); y = y.concat("a"); } if (!x.isEmpty() &amp;&amp; !y.isEmpty() &amp;&amp; x.matches("\\p{L}+") &amp;&amp; y.matches("\\p{L}+") &amp;&amp; x.length() &lt;= 50000 &amp;&amp; y.length() &lt;= 50000) { int i, j; int lenx = x.length(); int leny = y.length(); System.out.println(x.length() + " " + y.length()); int[][] table = new int[lenx + 1][leny + 1]; // Initialize table that will store LCS's of all prefix strings. // This initialization is for all empty string cases. for (i = 0; i &lt;= lenx; i++) { table[i][0] = 0; } for (i = 0; i &lt;= leny; i++) { table[0][i] = 0; } // Fill in each LCS value in order from top row to bottom row, // moving left to right. for (i = 1; i &lt;= lenx; i++) { for (j = 1; j &lt;= leny; j++) { // If last characters of prefixes match, add one to former value. if (x.charAt(i - 1) == y.charAt(j - 1)) { table[i][j] = 1 + table[i - 1][j - 1]; } // Otherwise, take the maximum of the two adjacent cases. else { table[i][j] = Math.max(table[i][j - 1], table[i - 1][j]); } } } // This is our answer. System.out.println(table[lenx][leny]); } bf.close(); } String x and y can not be more than 50000 in length. edit: I have heard that sparse matrix uses less memory would you suggest me to implement it? increase heap is not an option because it is too large (50000X50000)
score: -1
linked to: http://stackoverflow.com/q/24510188
downvote count: 2
has answer: http://stackoverflow.com/a/25339263
upvote count: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/44537458
favorite count: 0
type: Question
has title: java.lang.OutOfMemoryError in Longest common sequence (LCS)

http://stackoverflow.com/comment/39521973
comment on: http://stackoverflow.com/q/25341920
score: 0
type: Comment
type: QuestionComment
has text: Yeah, it's been implemented in schema.xml as `<similarity class="org.apache.lucene.search.similarities.PercentageSimilarityClass"\>` and it states it has been added to the classloader on Solr startup, so is there something wrong with the code itself?

javascript
tags question: http://stackoverflow.com/q/25380952
tags question: http://stackoverflow.com/q/25290599
tags question: http://stackoverflow.com/q/25280911
tags question: http://stackoverflow.com/q/25298063
tags question: http://stackoverflow.com/q/25379122
tags question: http://stackoverflow.com/q/25287724
tags question: http://stackoverflow.com/q/25280088
tags question: http://stackoverflow.com/q/25286558
tags question: http://stackoverflow.com/q/25355022
tags question: http://stackoverflow.com/q/25294258
tags question: http://stackoverflow.com/q/25270372
tags question: http://stackoverflow.com/q/25268305
tags question: http://stackoverflow.com/q/25332208
tags question: http://stackoverflow.com/q/25303420
tags question: http://stackoverflow.com/q/25359786
tags question: http://stackoverflow.com/q/25365054
tags question: http://stackoverflow.com/q/25307958
tags question: http://stackoverflow.com/q/25239777
tags question: http://stackoverflow.com/q/25280220
tags question: http://stackoverflow.com/q/25273808
tags question: http://stackoverflow.com/q/25364756
tags question: http://stackoverflow.com/q/25284608
tags question: http://stackoverflow.com/q/25261715
tags question: http://stackoverflow.com/q/25373902
tags question: http://stackoverflow.com/q/25381568
tags question: http://stackoverflow.com/q/25260674
tags question: http://stackoverflow.com/q/25309540
tags question: http://stackoverflow.com/q/25323388
tags question: http://stackoverflow.com/q/25292728
tags question: http://stackoverflow.com/q/25287890
tags question: http://stackoverflow.com/q/25350609
tag name: javascript
tags question: http://stackoverflow.com/q/25282874
tags question: http://stackoverflow.com/q/25366779
tags question: http://stackoverflow.com/q/25232239
tags question: http://stackoverflow.com/q/25380963
tags question: http://stackoverflow.com/q/25350078
tags question: http://stackoverflow.com/q/25372515
tags question: http://stackoverflow.com/q/25307459
tags question: http://stackoverflow.com/q/25385911
tags question: http://stackoverflow.com/q/25306170
tags question: http://stackoverflow.com/q/25250438
tags question: http://stackoverflow.com/q/25375649
tags question: http://stackoverflow.com/q/25283846
tags question: http://stackoverflow.com/q/25255028
tags question: http://stackoverflow.com/q/25370751
tags question: http://stackoverflow.com/q/25379340
tags question: http://stackoverflow.com/q/25236619
tags question: http://stackoverflow.com/q/25319271
tags question: http://stackoverflow.com/q/25261839
tags question: http://stackoverflow.com/q/25357166
tags question: http://stackoverflow.com/q/25286791
tags question: http://stackoverflow.com/q/25364377
tags question: http://stackoverflow.com/q/25341980
tags question: http://stackoverflow.com/q/25233804
tags question: http://stackoverflow.com/q/25265340
tags question: http://stackoverflow.com/q/25303859
tags question: http://stackoverflow.com/q/25350621
tags question: http://stackoverflow.com/q/25247162
type: Tag
tags question: http://stackoverflow.com/q/25288330
tags question: http://stackoverflow.com/q/25337976
tags question: http://stackoverflow.com/q/25239348
tags question: http://stackoverflow.com/q/25319909
tags question: http://stackoverflow.com/q/25235457
tags question: http://stackoverflow.com/q/25354484

http://stackoverflow.com/comment/39393013
has text: @Newbie - you are swapping each time your `(min !=i)` condition is true. You will end up swapping a value which is *already swapped*, i.e, your array will actually be *out-of-order* (with respect to the expected output of each iteration) in the iteration.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25279433
type: AnswerComment

http://stackoverflow.com/q/25253451
has comment: http://stackoverflow.com/comment/39345825
answer count: 2
has answer: http://stackoverflow.com/a/25253566
has comment: http://stackoverflow.com/comment/39345890
has answer: http://stackoverflow.com/a/25253742
has comment: http://stackoverflow.com/comment/39346069
tagged with: java
tagged with: string
has comment: http://stackoverflow.com/comment/39345914
type: Question
has comment: http://stackoverflow.com/comment/39346234
has body: I have a String like this: String content = "{"begin"bf3b178a70.jpg","end",....},{"id":,"f06190e8938.jpg","end",....}" and i want to cut out the image ID like this: bf3b178a70.jpg f06190e893.png and after that, i want compose the image ID with a new url like this: url.com/image/bf3b178a70.jpg url.com/image/f06190e893.png I begin with substring() to cut the first part and with content.split(""id":,"); but i have problems with a string array and normal string. I used the string array with a for-loop, because the real string is very long. Will someone please help me?
has comment: http://stackoverflow.com/comment/39345887
has comment: http://stackoverflow.com/comment/39346304
accepted answer: http://stackoverflow.com/a/25253566
type: AnsweredQuestion
has title: Cut a specific part of String in loop
score: 0
possible better answer: http://stackoverflow.com/a/25253742

http://stackoverflow.com/q/25253527
tagged with: java
has comment: http://stackoverflow.com/comment/39371907
has comment: http://stackoverflow.com/comment/39375307
has title: binary name for primitive type in ITypeBinding
has body: In org.eclipse.jdt.core.dom, under ITypeBinding interface, there's getBinaryName() and getName() method. The explanation under getName() is very detailed for each type. However, it's not quite clear in the javadoc. Although I can find detailed explanation of the binary name for each type in java language specification 3rd edition, section 13.1, i can't find the binary name for primitive type. What's the binary name for primitive type there? and any source that I can check?
score: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39369877
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25269746
type: Question
tagged with: primitive-types
has comment: http://stackoverflow.com/comment/39346356
type: UnansweredQuestion

http://stackoverflow.com/a/25329064
has comment: http://stackoverflow.com/comment/39486895
type: Answer
has comment: http://stackoverflow.com/comment/39487083
score: 0
answers question: http://stackoverflow.com/q/25328589
has body: First of all, I'd seriously reconsider what you're trying to do here. If you're trying to store an entire XML document in a single field then you might be much better off either storing it as an XMLTYPE datatype in your Oracle database or using tXMLMap in Talend to parse the XML and put each element and attribute into separate columns. On the other hand, if this is a single, huge element of your XML document then you might also be better storing it as a CLOB. If you absolutely must persist with this idea of keeping it in a VARCHAR column for whatever reason (and I'd be absolutely certain that that's what you need to do because it will tank your database's performance) then you're going to need to use a tJavaRow to split this into chunks. The tExtractRegexField component will only output the match groups that you capture and there's no way (that I know of) of dynamically capturing groups in some recursive manner that Talend can use. I don't think you can output into a dynamic schema with the tJavaRow (or at least never seen it done) so you'll have to profile your data to get a rough idea of how many columns you need to cover all your data (so if you are splitting it into fields of 255 each and your maximum field length is 25500 then you need 100 columns). From here you then want to add all of those columns to the tJavaRow's output schema and then use some code that looks a little like the answer to this question but modify it to link each String[] to your output field. You might need to make this a for loop and explicitly point each element of the String[] to each output_row.column. As an example with some horrible code that is absolutely going to be some of the worst performing code you'll ever see but demonstrates the principle: String col1 = ""; String col2 = ""; String col3 = ""; String col4 = ""; String col5 = ""; String[] data = input_row.hugeData.split(""); for (int i = 0; i &lt; data.length; i++) { if (i == 0) { // Do nothing, it's an empty element } else if …
has comment: http://stackoverflow.com/comment/39486828
has comment: http://stackoverflow.com/comment/39486577

http://stackoverflow.com/comment/39377409
type: Comment
type: QuestionComment
score: 0
has text: Yep, O(1), if you're interested in how these things are implemented, you can see the source http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Collections.java#Collections.unmodifiableList%28java.util.List%29
comment on: http://stackoverflow.com/q/25270710

http://stackoverflow.com/comment/39568999
has text: @KickButtowski - Sorry. I hate when it happens to me.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25374220
type: AnswerComment

http://stackoverflow.com/comment/39444637
type: Comment
has text: You should combine various layout managers to do that
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25306555

http://stackoverflow.com/q/25360926
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/25361196
score: 2
has title: SwingWorker creates multiple thread
tagged with: java
answer count: 1
has body: I don't know if I used SwingWorker correctly. In my requirements, I need to refreshed every seconds, so I need a SwingWorker that needs to execute every seconds. A part of my code illustrated below on how I used to loop my SwingWorker. // Parent class /** * Initialize background services. */ private void initServices() { this.dtModel = (DefaultTableModel) tblHistory.getModel(); // Default data model of the jTable this.updateTimer = new Timer(1000, new ActionListener() { // I don't know if this is right, I use Timer to loop the Swingworker @Override public void actionPerformed(ActionEvent e) { new CallHistoryWatcherService(CallHistory.this, updateTimer, dtModel).execute(); } }); updateTimer.setRepeats(false); updateTimer.start(); } // Watcher class /** * Watch the CallInformations if any update has been made. * This will check every seconds. * @param history * @param updateTimer * @param dtModel */ public CallHistoryWatcherService(CallHistory history, javax.swing.Timer updateTimer, DefaultTableModel dtModel) { // Initialize values } @Override protected Collection&lt;Vector&gt; doInBackground() throws Exception { Collection&lt;Vector&gt; chunks = new ArrayList&lt;&gt;(); for (CallInformations info : CallInformations.getCallInformations(OrderBy.Ascending)) { Vector v = new Vector(); // Get from data from Database then place it to Vector chunks.add(v); } return chunks; } @Override protected void done() { try { history.updateTableData(get()); // From parent class, manually update the data based on new Collection of data System.out.println("Call History refreshed..."); } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); } COLUMN_NAMES.clear(); updateTimer.restart(); // Again, I don't know if this is right, restart the timer to execute the SwingWorker }
favorite count: 0
type: Question
tagged with: swingworker

http://stackoverflow.com/q/25301663
favorite count: 0
possible better answer: http://stackoverflow.com/a/25364887
tagged with: c#
type: Question
has answer: http://stackoverflow.com/a/25364887
tagged with: java
has comment: http://stackoverflow.com/comment/39434750
tagged with: eclipse
has title: Are java or c# projects still being build without using IDE
type: AnsweredQuestion
has body: I was Reading a tutorial on MVN in that he is explaining how to build the project using Commands in terminal using apache maven. I have eclipse installed on my system and did the samples using it so I am thinking that why to read about CLI as we are having lot of good IDE's (eclipse,sts,visual studio(c#) etc). So will it be helpful for reading about CLI commands.
accepted answer: http://stackoverflow.com/a/25301726
answer count: 2
downvote count: 0
tagged with: maven
score: 1
has answer: http://stackoverflow.com/a/25301726
upvote count: 1

http://stackoverflow.com/a/25469491
has body: Java does not support multiple annotation of this type. But you can write something like this Create a class with annotated field. Create setters and getters to access the field. Create all your name,email field as instance of this class. This way fields will implicitly annotated as NotNull. public class NotNullString { @NotNull String str; public void set(String str) { this.str = str; } public String get() { return this.str; } } NotNullString name; NotNullString email;
upvote count: 1
answers question: http://stackoverflow.com/q/25261236
score: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39553861
type: Comment
has text: This is better fit for comment. +1 though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25366608

http://stackoverflow.com/comment/39332965
comment on: http://stackoverflow.com/q/25246529
score: 0
type: Comment
has text: You should probably also include the Spring config. It knows it's trying to run the `execute` method because the logs know to try `validateExecute()` etc. Unrelated, but ` uploadFile ` is sufficient.
type: QuestionComment

http://stackoverflow.com/q/25374505
has body: According to the HP Fortify documentation, the Static Code Analyzer first translates the source code into an intermediate format, and then it scans the translated code and generates a vulnerability report. It says the translation can be done using the following Ant code: &lt;antcall target="compile"&gt; &lt;param name="build.compiler" value="com.fortify.dev.ant.SCACompiler"/&gt; &lt;/antcall&gt; This will call your "compile" target but force it to use the SCACompiler instead of the regular javac compiler. I have run Fortify on our Java code and it produces vulnerability reports. But I do not see the intermediate files anywhere. I ran a diff between the Java class files that the regular javac compiler produced and the Java class files that the SCACompiler produced, and they were exactly the same. Are the intermediate files stored somewhere else, or does Fortify automatically delete them after performing the scan?
has comment: http://stackoverflow.com/comment/39569584
tagged with: java
accepted answer: http://stackoverflow.com/a/25388335
has title: Where does HP Fortify put the intermediate files?
favorite count: 0
has answer: http://stackoverflow.com/a/25388335
type: Question
answer count: 2
upvote count: 2
score: 2
tagged with: fortify
downvote count: 0
possible better answer: http://stackoverflow.com/a/25529941
has answer: http://stackoverflow.com/a/25529941
type: AnsweredQuestion

http://stackoverflow.com/comment/39597544
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25376529
has text: @LuiggiMendoza it is coming from a legacy API.

http://stackoverflow.com/comment/39384376
comment on: http://stackoverflow.com/q/25273914
score: 0
type: Comment
type: QuestionComment
has text: @Matt not really - your factory could hold a `Map<String, Class<?>>` and be populated with certain identifiers for which objects of the registered classes can be created at runtime. Similar to `factory.register("smallGreen", SmallGreenCar.class); factory.create("smallGreen");`

http://stackoverflow.com/a/25250461
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39340401
has comment: http://stackoverflow.com/comment/39342280
accepted answer of: http://stackoverflow.com/q/25250181
has body: Try this: import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { String prompt = "Please enter a string or type QUIT to finish"; Scanner userInput = new Scanner(System.in); Vector&lt;String&gt; names = new Vector&lt;String&gt;(); System.out.println(prompt); String input = null; while (userInput.hasNextLine()) { input = userInput.nextLine(); if (input.equals("QUIT")) break; names.add(input); } for (String s : names) { System.out.println("You typed: "); System.out.println(s); } } }
answers question: http://stackoverflow.com/q/25250181
type: Answer
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/46045671
type: QuestionComment
comment on: http://stackoverflow.com/q/25238289
has text: @mikera, So has the problem been solved? Post the solution.
score: 0
type: Comment

http://stackoverflow.com/comment/63780780
has text: That stray `var` on a line by itself is strange. Is there supposed to be a comma after the definition of `_equals` instead of a semicolon?
comment on: http://stackoverflow.com/q/25379340
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/comment/39334960
has text: You'll save time and typing using Spring Data REST over Jersey.
comment on: http://stackoverflow.com/q/25241896
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25270871
tagged with: int
has answer: http://stackoverflow.com/a/25270895
has comment: http://stackoverflow.com/comment/39380205
has answer: http://stackoverflow.com/a/25271279
upvote count: 0
tagged with: java
downvote count: 2
tagged with: palindrome
favorite count: 0
has answer: http://stackoverflow.com/a/25271418
type: Question
has title: Checking for palindromes using array on ints, help (storing digits of long in array int)
type: UnansweredQuestion
score: -2
tagged with: long-integer
tagged with: arrays
has body: Here is some code I wrote to check if a long is palindromic, using an array of integers. I did it like this to test my skills, (failed) so don't comment on better ways to check if a number is a palindrome. import java.util.Scanner; public class digextester { static Scanner input = new Scanner(System.in); public static void main(String[] args) { String in = input.nextLine(); long im = Long.valueOf(in).longValue(); System.out.println(im); thing(im); } public static void thing(long im) { int l = 0; while (im &gt; 0) { im = im / 10; l++; } System.out.println(l); int arrim[] = new int[l]; for (int c = 1; c &lt;= l; c++) { arrim[c] = ((int) (im - (im / 10) * 10)); // also tried = im%10 im = im / 10; } int e = 1; int d = 0; while (e &lt; (l / 2)) { if (arrim[e] == arrim[(l - e) + 1]) { d = 0; } else { d = 20; e = l; } e++; } if (d == 0) { System.out.println("pal"); } else { System.out.println("not pal"); } } } Here is the Exception I get in thread "main": java.lang.ArrayIndexOutOfBoundsException: 5 at digextester.thing(digextester.java:27) - arrim[c] = ((int)(im-(im/10)*10)) ; at digextester.main(digextester.java:12) - thing(im); Can someone please explain what is causing this Exception?
has answer: http://stackoverflow.com/a/25271255
answer count: 4

http://stackoverflow.com/a/25344074
has comment: http://stackoverflow.com/comment/39518593
has comment: http://stackoverflow.com/comment/39522368
type: Answer
answers question: http://stackoverflow.com/q/25342885
has body: The most straightforward solution here seems to be the following: One can consider each pair of points. For each pair, one computes the distance of each other point to the line connecting the two points. If this distance is nearly zero, then the point lies on the line. When this is done for all pairs, one can pick the pair for which the highest number of points lies on the connecting line. Of course, this is not very elegant, as it is in O(n^3) and performs some computations twice. But it is very simple and rather reliable. I just implemented this as a MCVE here: One can set points with left-clicking the mouse. Right-clicks clear the screen. The maximum number of points in one line is displayed, and the corresponding points are highlighted. (EDIT: Updated to handle points that have a distance of 0, based on the comment) import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Line2D; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class PointsOnStraightLineTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(new PointsPanel()); f.setSize(600, 600); f.setLocationRelativeTo(null); f.setVisible(true); } } class PointsOnStraightLine { // Large epsilon to make it easier to place // some points on one line with the mouse... private static final double EPSILON = 5.0; List&lt;Point&gt; maxPointsOnLine = new ArrayList&lt;Point&gt;(); void compute(List&lt;Point&gt; points) { maxPointsOnLine = new ArrayList&lt;Point&gt;(); for (int i=0; …
has comment: http://stackoverflow.com/comment/102178047
upvote count: 2
downvote count: 0
score: 2

http://stackoverflow.com/comment/41228238
score: 0
has text: My bad. I had a typo in the address. It works with shared drive jar. Next thing is to pass java object to c++, keep it there and pass it back to java in a different function call. JNI sure is challenging.
comment on: http://stackoverflow.com/a/25374412
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25232367
has comment: http://stackoverflow.com/comment/39384503
has body: I am trying to use postgres on a EJB in a EAR, but i keep getting the error: java.lang.ClassNotFoundException: org.postgresql.driver so my app is not finding the jar. According to what I saw here: How to use 3rd party libraries in glassfish?, I should put the jar on either glassfish3/glassfish/domains/domain1/lib/ext or glassfishv3/glassfish/domains/domain1/lib, I tried both and is not working. I was also not sure of something, should I add the jar to that folder and then reference the build path (using netbeans) of my app to the jar on that folder? or should I omit this step? Anyhow, I tried both, referencing it and not doing it (only adding the jar to the folder in glassfish) and is not working. So, how can I add an external jar to my application (EAR) that is put on a glassfish cluster?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39310701
tagged with: jar
linked to: http://stackoverflow.com/q/2507099
type: Question
tagged with: postgresql
score: 0
tagged with: java
has title: Glassfish and Java EE external JAR
tagged with: glassfish

http://stackoverflow.com/a/25366995
type: Answer
answers question: http://stackoverflow.com/q/25366897
score: 4
has body: Swing is not meant to use KeyListeners, using a Key Binding will work way better, and you don't have to worry about focus as much. See: http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html Keybinding is hard, here is a tutorial: http://www.dreamincode.net/forums/topic/245148-java-key-binding-tutorial-and-demo-program/
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25366897

http://stackoverflow.com/comment/39440201
comment on: http://stackoverflow.com/q/25304660
has text: possible duplicate of [How to print double value without scientific notation using Java?](http://stackoverflow.com/questions/16098046/how-to-print-double-value-without-scientific-notation-using-java)
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25335542
has title: Loop breaks even when conditions aren't met
has answer: http://stackoverflow.com/a/25335563
tagged with: java
has comment: http://stackoverflow.com/comment/39498642
type: Question
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39498618
answer count: 1
downvote count: 3
score: -3
has body: if (i== 0) { boolean goOn = false; do { int randy = (int) (Math.random()*people); System.out.println(workers[randy] + ": Sunday, 7-12"); int randy1 = (int) (Math.random()*people); System.out.println(workers[randy1] + ": Sunday, 9-12"); int randy2 = (int) (Math.random()*people); System.out.println(workers[randy2] + ": Sunday, 12-4"); int randy3 = (int) (Math.random()*people); System.out.println(workers[randy3] + ": Sunday, 12-4"); if (randy != randy1 &amp;&amp; randy != randy2 &amp;&amp; randy != randy3 &amp;&amp; randy1 != randy2 &amp;&amp; randy1 != randy3 &amp;&amp; randy2 != randy3); { goOn = true; } } while (goOn==false); System.out.println("Done!"); } If you look below, for some reason this loop continues even when one of the randomly generated numbers is equal to another. Kind of new to Java - just playing around, but why is this happening? For context, people is an integer and and workers[] is a list of names.
tagged with: loops
has comment: http://stackoverflow.com/comment/39498762
has comment: http://stackoverflow.com/comment/39498703
favorite count: 0

http://stackoverflow.com/a/25295738
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25294711
has comment: http://stackoverflow.com/comment/39424055
accepted answer of: http://stackoverflow.com/q/25294711
has comment: http://stackoverflow.com/comment/39424000
has body: You just need to have the following: @XmlAccessorType(XmlAccessType.FIELD) public class A { @XmlElement(name="Data") private AData data; } @XmlAccessorType(XmlAccessType.FIELD) public class B { @XmlElement(name="Data") private BData data; } @XmlRootElement(name="Content") @XmlAccessorType(XmlAccessType.FIELD) public class Content { @XmlElement(name="A") private A a; @XmlElement(name="B") private B b; }
type: Answer

http://stackoverflow.com/comment/39445554
comment on: http://stackoverflow.com/a/25307636
score: 0
has text: Yes, there is. :) Since 1.8 - http://docs.oracle.com/javase/8/docs/api/java/util/Map.html#replace-K-V-.
type: Comment
type: AnswerComment

numbers
tags question: http://stackoverflow.com/q/25370033
tags question: http://stackoverflow.com/q/25328900
tags question: http://stackoverflow.com/q/25252441
tags question: http://stackoverflow.com/q/25256885
type: Tag
tag name: numbers

http://stackoverflow.com/q/25259243
has answer: http://stackoverflow.com/a/25259512
accepted answer: http://stackoverflow.com/a/25259487
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25331530
downvote count: 0
has comment: http://stackoverflow.com/comment/39356128
tagged with: java
has comment: http://stackoverflow.com/comment/39356527
has answer: http://stackoverflow.com/a/25259324
possible better answer: http://stackoverflow.com/a/25259444
has title: How to not repeat code within catch blocks?
has answer: http://stackoverflow.com/a/25259380
has answer: http://stackoverflow.com/a/25259444
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25259581
has answer: http://stackoverflow.com/a/25259487
answer count: 9
has comment: http://stackoverflow.com/comment/39356281
has answer: http://stackoverflow.com/a/25259644
has comment: http://stackoverflow.com/comment/39356192
has comment: http://stackoverflow.com/comment/112779765
linked to: http://stackoverflow.com/q/341971
has answer: http://stackoverflow.com/a/25260381
has comment: http://stackoverflow.com/comment/39356646
has body: I am having a hard time not to repeat myself in a Java program I am working on at the moment. Say, I need to declare a lot of methods that basically are structured in the following way: public SomeEntity doSomething (String someAttribute, String anotherAttribute) { EntityManager em = this.createEntityManager(); EntityTransaction tx = null; try { /* * ... independent logic ... */ tx = em.getTransaction(); } catch (RuntimeException e) { if (tx != null &amp;&amp; tx.isActive()) { tx.rollback(); } throw e; } finally { em.close(); } return something; } The method body of all methods needs to contain theses elements for resource management. The "independent logic" itself will be rather complex too, so putting the try/catch statement in a separate method won't really work. I want to avoid to repeat this code. What are the best practices to apply in these situations?
score: 34
upvote count: 34

http://stackoverflow.com/a/25309460
has body: You can define a public static method to get the correct operation based on a String: public static Operation get(String input) { if(input.equals("+")) { return ADD; } if(input.equals("-")) { return SUBTRACT; } throw new IllegalArgumentException(); } Then you would call it like: Operation op = Operation.get("+"); op.apply(2, 3);
upvote count: 4
answers question: http://stackoverflow.com/q/25309311
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25309311
score: 4
has comment: http://stackoverflow.com/comment/39449296
type: Answer

http://stackoverflow.com/comment/39389231
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25277203
has text: Yep, that will make `Wed Aug 7 18:06:40 EDT 46475` become to `2014` wont it?

http://stackoverflow.com/comment/39358906
type: Comment
comment on: http://stackoverflow.com/q/25238426
has text: @Marco13 I have this line: `g.drawImage(image, 0, 0, WIDTH * SCALE, HEIGHT * SCALE, null);` with `WIDTH` being 266, `HEIGHT` being 200, and `SCALE` being 3. If I remove this line, the image is still being drawn, so it seems this line doesn't actually do anything at all. It actually seems that I only need the `statusHandler.render(g);` line, because with just that it still renders.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/81385629
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25348845
has text: If you have an Ant task, you need to make sure its xml configuration and the makejar.launch do not contain references to the original name of the project
type: Comment

http://stackoverflow.com/a/25364433
accepted answer of: http://stackoverflow.com/q/25364025
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39658533
has comment: http://stackoverflow.com/comment/39549979
has comment: http://stackoverflow.com/comment/39668129
has comment: http://stackoverflow.com/comment/39550020
has comment: http://stackoverflow.com/comment/39550396
score: 1
has comment: http://stackoverflow.com/comment/39664645
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/25364025
has comment: http://stackoverflow.com/comment/39669888
has comment: http://stackoverflow.com/comment/39666568
has comment: http://stackoverflow.com/comment/39667145
has body: The reason is because you're doing all of the work on the JavaFX Application Thread. When you set some attribute, like the label's text, on the JavaFX Application Thread the results don't immediately get displayed. Instead, it waits until your code is finished running, at which point the framework takes over again and can display your changes. In order to get around this, you need to execute long running code on a separate thread, to avoid blocking the redrawing of the GUI. Take a look at Concurrency in JavaFX for details on how to implement that.
has comment: http://stackoverflow.com/comment/39667490

http://stackoverflow.com/comment/39564165
type: Comment
type: QuestionComment
has text: @dimoniy is correct. I submitted an answer, then noticed the URL you were trying to access. /WEB-INF/ can not serve anything. Tomcat is physically incapable of serving files from inside that directory.
comment on: http://stackoverflow.com/q/25371200
score: 0

http://stackoverflow.com/comment/39580569
type: Comment
has text: Of course there's other ways to do it, we've been doing it other ways for more then 15 years ( with Java), but, in my personal experience, try with resources is significantly simpler are more robust and one of the features of Java 7 I use all the time
type: QuestionComment
comment on: http://stackoverflow.com/q/25380684
score: 1

http://stackoverflow.com/comment/39309137
type: AnswerComment
has text: The short version: The for loop keeps going *while* the test is true, not *until* is is true.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25234081

http://stackoverflow.com/comment/39475200
score: 1
has text: @Sheppard_ - Its just one of the caveats of learning a new language, assume nothing
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25323202

http://stackoverflow.com/a/36129083
answers question: http://stackoverflow.com/q/25243675
type: Answer
has body: The inputStream.available() returns 0 for my requests too. I don't know if my solution works every time, but it works for me. You can get additional information about the uploaded file with one more parameter in the method and you can use it to check the name of the file. If it's empty, the InputStream should be empty: @POST @Path("/test") @ApiOperation ( value = "Test", response = String.class) @Consumes(MediaType.MULTIPART_FORM_DATA) public String test( @FormDataParam("file") InputStream is, @FormDataParam("file") FormDataContentDisposition fileDetails ) { String fileName = fileDetails.getFileName(); if (fileName != null &amp;&amp; !fileName.equals("")) { // read the input stream } return is.read(); }
score: 0

http://stackoverflow.com/q/25235314
type: Question
tagged with: mongodb
answer count: 2
possible better answer: http://stackoverflow.com/a/25235446
accepted answer: http://stackoverflow.com/a/25235464
has answer: http://stackoverflow.com/a/25235464
has answer: http://stackoverflow.com/a/25235446
downvote count: 0
has body: How to convert below query into Java code for Mongo Java driver? db.post.aggregate( [ { $match : {"name" :{'$in': ["michael", "jordan"] } }}, { $group : { _id : "$game.id" , count : { $sum : 1 } } } ] ) My function is not working: DBObject match = new BasicDBObject('$match', new BasicDBObject("name", names));
type: AnsweredQuestion
has title: How to use aggregation in Mongo db Java driver with $match and $in?
score: 1
tagged with: java
upvote count: 1
favorite count: 0
tagged with: mongodb-query

http://stackoverflow.com/comment/39396850
has text: changed. thanks for the remark
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25281533

http://stackoverflow.com/comment/39579896
comment on: http://stackoverflow.com/q/25380264
score: 0
type: Comment
type: QuestionComment
has text: Try setting the status first. Ut ti doesn't make sense to send some content and set a header that says there is no content.

http://stackoverflow.com/comment/82142270
type: Comment
type: AnswerComment
has text: .anyRequest(); will block your site
comment on: http://stackoverflow.com/a/44802025
score: 1

http://stackoverflow.com/a/25369914
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25348958
type: Answer
has body: The only thing I see missing is that the code never enables the position vertex attribute. This call should be in onSurfaceCreated(), where the vertex attributes are set up: glEnableVertexAttribArray(aPositionLocation);
has comment: http://stackoverflow.com/comment/39562573
accepted answer of: http://stackoverflow.com/q/25348958
score: 2

http://stackoverflow.com/a/25339588
score: 0
has body: It can be like this because of getting that list from db might take while and your app can go directly to the next line of code which is where you declare your dataAdapter. You can try using AsyncTask. Something like this should help; `class GetList extends AsyncTask&lt;String, Void, List&lt;String&gt;&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Getting List..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected List&lt;String&gt; doInBackground(String... args) { List&lt;String&gt; list = db.getFriends(); ... return list; } @Override protected void onPostExecute(List&lt;String&gt; result) { pDialog.dismiss(); ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); friendSpinner.setAdapter(dataAdapter); } }` And in the onCreate() method; `GetList getList = new GetList(); getList.execute();` Hope this helps.
answers question: http://stackoverflow.com/q/25322046
type: Answer

http://stackoverflow.com/comment/39587799
comment on: http://stackoverflow.com/a/25322619
type: AnswerComment
has text: Correction: You only need getters.
score: 1
type: Comment

http://stackoverflow.com/a/30258029
has comment: http://stackoverflow.com/comment/48622296
type: Answer
has comment: http://stackoverflow.com/comment/48620207
has comment: http://stackoverflow.com/comment/48621224
score: 0
has body: I assume your code is merely pseudo code. (It is not Java code as tagged, so maybe you better provide us with real example code). But I'll go with the idea you have. You have one data structure arr. And you have four threads modifying arr concurrently. Your code is not thread safe. To make it thread safe you can use a mutex (one of the techniques to handle concurrency). Wrap a mutex around the arr. This will lock arr and only the thread owning the mutex can access arr. The mutex should be obtained in the beginning of the for loops and released in the end of the for loops. The loops will be competing for the mutex, the order is in general unpredictable. P.S.: If you can assert that no arr element references an object, that is referenced by another arr element, then you probably don't need to care too much about thread safety. But it is better to write thread safe code really.
has comment: http://stackoverflow.com/comment/48623304
has comment: http://stackoverflow.com/comment/48620443
has comment: http://stackoverflow.com/comment/48620918
has comment: http://stackoverflow.com/comment/48622832
answers question: http://stackoverflow.com/q/25330591

http://stackoverflow.com/a/25379819
has comment: http://stackoverflow.com/comment/39580434
has comment: http://stackoverflow.com/comment/39579267
has comment: http://stackoverflow.com/comment/39580546
has comment: http://stackoverflow.com/comment/39580658
has comment: http://stackoverflow.com/comment/39579332
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39580356
has comment: http://stackoverflow.com/comment/39579419
accepted answer of: http://stackoverflow.com/q/25349164
type: AcceptedAnswer
score: 1
has body: Have a look at the following example. Yours what a little hard to follow, especially because I am not familiar with OpenCSV. If you look at the getModelFromCsvFile it prettey much serves the same function as your read() method, except I return a DefaultTableModel and use a split instead. You can use your own implementation for the method. You just need to use the delimiter to set it in open csv. I am not sure how to set the delimiter with open csv, but I'm sure if you know the api, it's something trivial If you look at the getDelimiterComboBox, I create the combo box with an ActionListener. When the value in the combo box changes, I call the getModelFromCsvFile and then set a new model for the table. It should be pretty easy to follow, but this is the basic idea you want to go after. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; public class ReadFileDemo { private String defaultFile = "D:\\Book.txt"; private File currentFile = new File(defaultFile); private JTable table; public ReadFileDemo() { DefaultTableModel model = getModelFromCsvFile(currentFile, ";"); table = new JTable(model); JFrame frame = new JFrame(); frame.add(new JScrollPane(table)); frame.add(getDelimiterComboBox(new String[] {";", ".", "\t"}), BorderLayout.NORTH); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); frame.setVisible(true); } /** * Similar to your read() method */ public DefaultTableModel getModelFromCsvFile(File file, String delimiter) { DefaultTableModel model = null; String line; boolean isFirstLine = true; try(BufferedReader reader = new BufferedReader(new FileReader(file))) { while ((line = reader.readLine…
answers question: http://stackoverflow.com/q/25349164

jackson
tags question: http://stackoverflow.com/q/25375979
tags question: http://stackoverflow.com/q/25270823
tag name: jackson
tags question: http://stackoverflow.com/q/25263940
tags question: http://stackoverflow.com/q/25367448
tags question: http://stackoverflow.com/q/25307994
tags question: http://stackoverflow.com/q/25381791
tags question: http://stackoverflow.com/q/25276479
tags question: http://stackoverflow.com/q/25352916
tags question: http://stackoverflow.com/q/25327698
tags question: http://stackoverflow.com/q/25266268
tags question: http://stackoverflow.com/q/25259259
tags question: http://stackoverflow.com/q/25361919
tags question: http://stackoverflow.com/q/25354009
tags question: http://stackoverflow.com/q/25252715
tags question: http://stackoverflow.com/q/25269090
tags question: http://stackoverflow.com/q/25338923
tags question: http://stackoverflow.com/q/25379510
tags question: http://stackoverflow.com/q/25290915
tags question: http://stackoverflow.com/q/25231390
tags question: http://stackoverflow.com/q/25367979
type: Tag
tags question: http://stackoverflow.com/q/25375228
tags question: http://stackoverflow.com/q/25387978
tags question: http://stackoverflow.com/q/25334751
tags question: http://stackoverflow.com/q/25272043
tags question: http://stackoverflow.com/q/25294343
tags question: http://stackoverflow.com/q/25238464
tags question: http://stackoverflow.com/q/25383482
tags question: http://stackoverflow.com/q/25316641
tags question: http://stackoverflow.com/q/25239072
tags question: http://stackoverflow.com/q/25233131

http://stackoverflow.com/comment/39549956
type: QuestionComment
comment on: http://stackoverflow.com/q/25364506
has text: Oli - I don't think so it's a different list object.
score: 0
type: Comment

http://stackoverflow.com/comment/39461632
score: 0
comment on: http://stackoverflow.com/a/25292746
type: Comment
has text: Thank you for help. I re-think my own code and I found a bug there. Now it works.... just two instructions should be inside if-statement :)
type: AnswerComment

http://stackoverflow.com/comment/39433139
score: 0
type: Comment
has text: @bimboxX Again, even if it was `Serializable`, which it isn't, thread safety applies to a **single** process. Your client is on one physical machine running in a process. Your server is on one physical machine running in a different process.
type: AnswerComment
comment on: http://stackoverflow.com/a/25300564

http://stackoverflow.com/q/25330169
answer count: 2
has answer: http://stackoverflow.com/a/25330232
possible better answer: http://stackoverflow.com/a/25330192
has answer: http://stackoverflow.com/a/25330192
type: AnsweredQuestion
score: 3
upvote count: 3
has body: I know that the code below does make sense: try { ... } catch (FileNotFoundException exc) { ... } catch (IOException exc) { ... } But does declaring those parent and child exceptions in the throws clause make sense? Suppose I have the following code: public void doSomething() throws FileNotFoundException, IOException { ... } We all know that FileNotFoundException is a subclass of IOException. Now does it make sense in any way (readability, performance, et cetera) to declare it like that, opposing to just this: public void doSomething() throws IOException { ... }
tagged with: java
accepted answer: http://stackoverflow.com/a/25330232
downvote count: 0
has title: Is it useful to declare parent and child exceptions in the same throws clause?
tagged with: throws
favorite count: 0
type: Question
tagged with: exception

http://stackoverflow.com/comment/39416994
type: Comment
type: QuestionComment
has text: What is your question?
comment on: http://stackoverflow.com/q/25292287
score: 0

http://stackoverflow.com/comment/39349437
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25255210
has text: Hi, its just throws an expection at conn.
type: Comment

http://stackoverflow.com/comment/39354097
has text: A POJO is a simple Java object whilst a DAO is a facade to access the database not directly by SQL or similar but by passing objects at it and the DAO has to handle persisting by itself.
comment on: http://stackoverflow.com/q/25258046
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/39544544
type: Comment
has text: IS(NOT) NULL is the SQL construct you are looking for. Passing null won't work even in JDBC.
type: AnswerComment
comment on: http://stackoverflow.com/a/25361424
score: 0

http://stackoverflow.com/q/25360064
tagged with: grails
type: AnsweredQuestion
score: 0
answer count: 3
has title: What could the reason of the exception 'org.hibernate.QueryException Message Not all named parameters have been set:' possibly be?
tagged with: java
tagged with: hibernate
has body: So I am trying to execute the following query in grails User user = springSecurityService.currentUser def approverGroupList = approverGroupService.getApproverGroupsByUser(user.id) return VerificationRequest.executeQuery("select distinct v.fundTransfer from VerificationRequest v where v.fundTransfer.creator.corporateHouse=:corporateHouse and v.verified = false and v.fundTransfer.status ='QUEUED' and v.approverGroup in (:approverGroupList)", [corporateHouse:corporateHouse],[approverGroupList:approverGroupList]) However I am getting the following exception : /fund-transfer/list-verification-requests Class org.hibernate.QueryException Message Not all named parameters have been set: [approverGroupList] [select distinct v.fundTransfer from VerificationRequest v where v.fundTransfer.creator.corporateHouse=:corporateHouse and v.verified = false and v.fundTransfer.status ='QUEUED' and v.approverGroup in (:approverGroupList)] Also corporateHouse is an object that's passes to the method executing this query and its not null. What could be the reason? P.S. I am new to grails!
has answer: http://stackoverflow.com/a/25360228
has answer: http://stackoverflow.com/a/25360224
has answer: http://stackoverflow.com/a/25360134
possible better answer: http://stackoverflow.com/a/25360224
type: Question
has comment: http://stackoverflow.com/comment/39541622
accepted answer: http://stackoverflow.com/a/25360228

http://stackoverflow.com/comment/39308194
type: QuestionComment
comment on: http://stackoverflow.com/q/25233186
score: 1
has text: Looks like the Scala IDE doesn't implement these (yet?). The Eclipse term for these seems to be "Task Tags", BTW.
type: Comment

http://stackoverflow.com/a/26648627
type: Answer
has comment: http://stackoverflow.com/comment/100790919
answers question: http://stackoverflow.com/q/25350724
score: 2
downvote count: 0
has body: Not an answer, more a work-around, for your reference. After bashing our heads around this issue, and doing a lot of research, we gave up. We've opened this issue with Google, and implemented the following work around: In order to upload a file, the app first gets an Upload Token via an endpoint that requires the client-certificate, and afterwards uses this token to upload to an endpoint that doesn't require the client certificate (but still over SSL (Https)). Yes, it's a minor breach of security, but we had to do it. We've protected it as much as we could. I promise to update when the Google's ticket will be updated (and hopefully resolved).
upvote count: 2

http://stackoverflow.com/q/25360131
has answer: http://stackoverflow.com/a/25363478
has comment: http://stackoverflow.com/comment/39548111
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39542593
score: 0
tagged with: blob
has body: I have one pojo class with setter and getter method and one servlet class in which i am getting values from jsp page and then calling a function of dataaccess class which is EmployeeBean and passing parameter so problem is coming its not getting inserted into databse because blob and datatype probelm please anyone help me here... public class Employee { private int empId; private String iname; private String photo; private String contentType; private int contentLength; private InputStream inputstream; public InputStream getInputstream() { return inputstream; } public void setInputstream(InputStream inputstream) { this.inputstream = inputstream; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } public int getContentLength() { return contentLength; } public void setContentLength(int contentLength) { this.contentLength = contentLength; } public String getIname() { return iname; } public void setIname(String iname) { this.iname = iname; } } @MultipartConfig(maxFileSize = 18177215) @WebServlet(name = "FileUploadServlet", urlPatterns = {"/FileUploadServlet"}) public class FileUploadServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); InputStream inputStream = null; Employee emp1 = (Employee)session.getAttribute("emp1"); int n = emp1.getEmpId(); emp1.setEmpId(emp1.getEmpId()); emp1.setIname(request.getParameter("iname")); Part filePart = request.getPart("photo"); if (filePart != null) { emp1.setContentType(filePart.getContentType()); emp1.setContentLength((int) filePart.getSize()); inputStream = filePart.getInputStream(); emp1.setInputstream(inputStream); EmployeeBean eb = new EmployeeBean(); emp1 = eb.addImage(emp1); session.setAttribute("emp1",emp1); response.sendRedirect("EmployeeDetail.jsp"); } } } @Override protected void doGet(Ht…
has comment: http://stackoverflow.com/comment/39545200
has comment: http://stackoverflow.com/comment/39545390
linked to: http://stackoverflow.com/q/25135454
tagged with: java
has comment: http://stackoverflow.com/comment/39547673
tagged with: image
tagged with: servlets
has comment: http://stackoverflow.com/comment/39547795
type: Question
has comment: http://stackoverflow.com/comment/39546926
has title: how to store image or any type of document in database using mvc
answer count: 1
accepted answer: http://stackoverflow.com/a/25363478
tagged with: javabeans

http://stackoverflow.com/q/25304588
favorite count: 0
type: Question
score: 2
type: AnsweredQuestion
answer count: 3
upvote count: 2
has comment: http://stackoverflow.com/comment/39440096
tagged with: java
has title: How to control global variable in unitTest
has answer: http://stackoverflow.com/a/25304781
tagged with: junit
downvote count: 0
possible better answer: http://stackoverflow.com/a/25304712
accepted answer: http://stackoverflow.com/a/25304730
has body: Is it possible to control the value of the global variable in the class that I test? The global variable is used in a private method, so I use a public method (in the same class) to pass through it. How can I say that mListValService != null? public class Myclass { //my global variable private ListValServiceRemote listValService = null; public String getCodeValeurRef(Long idValeur) { return getListValService().getRlvCode(idValeur); // I want 100% coverage on this method so i have to change the value // of mListValService. private ListValServiceRemote getListValService() { if (listValService == null) { listValService = ServiceGetter.getListValService(); } return listValService; }
tagged with: variables
has answer: http://stackoverflow.com/a/25304730
has answer: http://stackoverflow.com/a/25304712

http://stackoverflow.com/comment/39549740
score: 0
type: Comment
has text: @MarkKorzhov True, you should use `.parent()` function before getting the text and then remove the strong tag's text
comment on: http://stackoverflow.com/a/25362996
type: AnswerComment

http://stackoverflow.com/a/25317015
has body: Well, asynchronous just means "without synchronization." That could be anything at all, and it doesn't have to involve threads or concurrency. For example, a network packet arrives at your network port asynchronously, whether you use multi-threading or not. ANY external event to your program is probably asynchronous. Non-blocking just means without blocking a thread. Besides IO (and NIO), the Java synchronized keyword may cause a thread to block on a memory location, regardless of any IO. Check out the docs of the ConcurrentLinkedQueue This implementation employs an efficient "wait-free" algorithm based on one described in Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms by Maged M. Michael and Michael L. Scott. So blocking refers to your threads stopping and waiting, and that's unrelated (in general) to the concept of two or more events happening without some sort of synchronizing. These concepts aren't just related to Java. They're general concepts used by all systems that I'm aware of.
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39463618
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25316798

swing
tags question: http://stackoverflow.com/q/25259158
tags question: http://stackoverflow.com/q/25287123
tags question: http://stackoverflow.com/q/25257513
tags question: http://stackoverflow.com/q/25240453
tags question: http://stackoverflow.com/q/25304958
tags question: http://stackoverflow.com/q/25238500
tags question: http://stackoverflow.com/q/25340113
tags question: http://stackoverflow.com/q/25285604
tags question: http://stackoverflow.com/q/25257504
tags question: http://stackoverflow.com/q/25328769
tags question: http://stackoverflow.com/q/25266279
tags question: http://stackoverflow.com/q/25240557
tags question: http://stackoverflow.com/q/25331226
tags question: http://stackoverflow.com/q/25307819
tags question: http://stackoverflow.com/q/25323581
tags question: http://stackoverflow.com/q/25355379
tags question: http://stackoverflow.com/q/25289051
tags question: http://stackoverflow.com/q/25256027
tags question: http://stackoverflow.com/q/25251786
tags question: http://stackoverflow.com/q/25247519
tags question: http://stackoverflow.com/q/25247220
tags question: http://stackoverflow.com/q/25377813
tags question: http://stackoverflow.com/q/25316834
tags question: http://stackoverflow.com/q/25364587
tags question: http://stackoverflow.com/q/25383441
tags question: http://stackoverflow.com/q/25337235
tags question: http://stackoverflow.com/q/25379958
tags question: http://stackoverflow.com/q/25236845
tags question: http://stackoverflow.com/q/25269848
tags question: http://stackoverflow.com/q/25250590
tags question: http://stackoverflow.com/q/25383059
tags question: http://stackoverflow.com/q/25367688
tags question: http://stackoverflow.com/q/25284104
tags question: http://stackoverflow.com/q/25292102
tags question: http://stackoverflow.com/q/25360878
tags question: http://stackoverflow.com/q/25308857
tags question: http://stackoverflow.com/q/25326965
tags question: http://stackoverflow.com/q/25358591
tags question: http://stackoverflow.com/q/25303119
tags question: http://stackoverflow.com/q/25248791
tags question: http://stackoverflow.com/q/25389479
tags question: http://stackoverflow.com/q/25282234
tags question: http://stackoverflow.com/q/25373009
tags question: http://stackoverflow.com/q/25327766
tags question: http://stackoverflow.com/q/25305877
tags question: http://stackoverflow.com/q/25305054
tags question: http://stackoverflow.com/q/25354328
tags question: http://stackoverflow.com/q/25365016
tags question: http://stackoverflow.com/q/25253027
tags question: http://stackoverflow.com/q/25291981
tags question: http://stackoverflow.com/q/25252853
tags question: http://stackoverflow.com/q/25350468
tags question: http://stackoverflow.com/q/25374750
tags question: http://stackoverflow.com/q/25325940
tags question: http://stackoverflow.com/q/25232718
tags question: http://stackoverflow.com/q/25379386
tags question: http://stackoverflow.com/q/25373449
tags question: http://stackoverflow.com/q/25270939
tags question: http://stackoverflow.com/q/25259852
tags question: http://stackoverflow.com/q/25372649
tags question: http://stackoverflow.com/q/25357165
tags question: http://stackoverflow.com/q/25253140
tags question: http://stackoverflow.com/q/25282508
tags question: http://stackoverflow.com/q/25279727
tags question: http://stackoverflow.com/q/25350934
tags question: http://stackoverflow.com/q/25230257
tags question: http://stackoverflow.com/q/25314503
tags question: http://stackoverflow.com/q/25259252
tags question: http://stackoverflow.com/q/25326343
tags question: http://stackoverflow.com/q/25342370
tags question: http://stackoverflow.com/q/25243723
tags question: http://stackoverflow.com/q/25337389
tags question: http://stackoverflow.com/q/25372938
tags question: http://stackoverflow.com/q/25366897
tags question: http://stackoverflow.com/q/25236817
tags question: http://stackoverflow.com/q/25240214
tags question: http://stackoverflow.com/q/25360578
tags question: http://stackoverflow.com/q/25362409
tags question: http://stackoverflow.com/q/25324081
tags question: http://stackoverflow.com/q/25371263

http://stackoverflow.com/a/25284316
has comment: http://stackoverflow.com/comment/136390266
downvote count: 0
has comment: http://stackoverflow.com/comment/139678415
answers question: http://stackoverflow.com/q/25283110
has body: I'm using the Java Printing API, but have problems setting print margins. ... Solution I had to provide additional print attributes to override the default print margins, MediaPrintableArea. Most printers cannot print on the entire surface of the media, due to printer hardware limitations. MediaPrintableArea can be used to query the acceptable values for a supposed print job, and to request an area within the constraints of the printable area to be used in a print job. HashPrintRequestAttributeSet attr = new HashPrintRequestAttributeSet(); attr.add(new MediaPrintableArea(0f, 0f, w/72f, h/72f, MediaPrintableArea.INCH)); PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintService(ps); job.setPrintable(this); job.setJobName(jobName); job.print(attr); j.setVisible(false); j.dispose(); The key was to provide the attributes along with the print() command. Source Help with print margins
has comment: http://stackoverflow.com/comment/136390408
type: Answer
has comment: http://stackoverflow.com/comment/139679042
score: 9
upvote count: 9

http://stackoverflow.com/a/25315909
accepted answer of: http://stackoverflow.com/q/25315268
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25315268
has body: That should work, except that you should probably use a TypeToken instead of just a Class in order to supply Gson with the correct parameterized type. List&lt;String&gt; lst = GSON.fromJson(val, new TypeToken&lt;ArrayList&lt;String&gt;&gt;(){}.getType()); (I'm assuming that the variable GSON is a suitably configured instance of the Gson class)
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39354766
type: Comment
type: AnswerComment
has text: then suppose i need the files inside the folder which is inside the jar how to get it without using `JarFile` class.
comment on: http://stackoverflow.com/a/25258380
score: 0

http://stackoverflow.com/q/25281720
tagged with: ruby
has answer: http://stackoverflow.com/a/44774638
answer count: 3
upvote count: 2
tagged with: calabash
downvote count: 0
has comment: http://stackoverflow.com/comment/39409117
has answer: http://stackoverflow.com/a/33388958
favorite count: 0
type: Question
has body: I am facing an issue when invoking a method of an android application through back door function. In our project we are using backdoor for logging an event, simulating the hardware event using an calabash function called backdoor. This function is getting invoked but is failing in perform_action function as below undefined method `perform_action' for #&lt;Object:0x253ea38&gt; (NoMethodError). This backdoor is used to hook an application function and we can use to our test cases to check response , make the settings using backdoor delegation I think I am wrong in calling the passing the parameter to backdoor, could u please let me how to invoke. I have tried these statements and have failed in invoking. I am using calabash-android 0.4.18 and had imported this function. In My apk my sample java file is like this public class sample { public boolean isDemoModel() { Log.d("Vageesh","Vageesh to test backboor"); return true; } } In my script I tried to invoke using below ways and has failed for NoMethod error backdoor('isDemoModel()','') backdoor("'isDemoModel()'","") backdoor("adb shell am broadcast -a sh.calaba.instrumentationbackend.InstrumentationBackend.isDemoModel",'') Could any one please provide input on how an application function could be called. In IoS it is direct call like backdoor('isDemoModel()',''). Regards Vageesh
type: UnansweredQuestion
has title: Issues in invoking backdoor function for android using calabash tests
has answer: http://stackoverflow.com/a/33386326
tagged with: android
tagged with: java
score: 2

http://stackoverflow.com/comment/39565151
score: 0
type: QuestionComment
has text: This question is off-topic because it doesn't appear to be about programming.
type: Comment
comment on: http://stackoverflow.com/q/25371879

http://stackoverflow.com/q/25291981
tagged with: java
answer count: 1
tagged with: swing
has title: delete checkboxes after button clicked
accepted answer: http://stackoverflow.com/a/25292199
type: Question
has answer: http://stackoverflow.com/a/25292199
type: AnsweredQuestion
score: 0
has body: is there a way to delete a checkbox from it's current position? E.g 1 - I have four checkboxes One, Two, Three and Four 2 - If I select checkbox Two and press delete button, checkbox Two will be removed and I want the checkbox Three to move up to checkbox Two position and checkbox Four to move up to checkbox Three position. For now in my codes, I set the checkbox visibility to false after the checkbox Two is selected and delete button is press. My desired output after checkbox Two is selected and delete button is pressed. checkbox Three to move up to checkbox Two position and checkbox Four to move up to checkbox Three position immediately. my current codes import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; public class CheckBoxTest { JPanel panel = new JPanel(new GridLayout(0, 1)); JButton button = new JButton("Delete!"); String[] names = {"One", "Three","Four"}; JCheckBox[] checkboxes; JFrame frame = new JFrame(); public CheckBoxTest() { checkboxes = new JCheckBox[3]; for(int i = 0; i &lt; names.length; i++) { checkboxes[i] = new JCheckBox(); checkboxes[i].setText(names[i]); panel.add(checkboxes[i]); } panel.add(button); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800, 600); frame.setVisible(true); button.addActionListener(new btnActionPerformed()); } public class btnActionPerformed implements ActionListener { @Override public void actionPerformed(ActionEvent e) { for(int i = 0; i &lt; names.length; i++) { if(checkboxes[i].isSelected()) { System.out.println(checkboxes[i].getText() + " is deleted"); checkboxes[i].setVisible(false); } } } } public static void main(String args[]) { new CheckBoxTest(); } }

http://stackoverflow.com/a/25370228
answers question: http://stackoverflow.com/q/25370194
score: 0
has comment: http://stackoverflow.com/comment/39561293
has comment: http://stackoverflow.com/comment/39561407
has body: Just try to check in the directory itself instead of single file.
has comment: http://stackoverflow.com/comment/39561268
type: Answer
has comment: http://stackoverflow.com/comment/39561251
has comment: http://stackoverflow.com/comment/39628827

http://stackoverflow.com/comment/39592196
has text: how could I add the repository containing snapshot version.please guide mee.
comment on: http://stackoverflow.com/a/25386622
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39311088
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25235016
has text: does genre have only one element? let say for id = 2, so genre hash only Film inside of it?

http://stackoverflow.com/q/25351421
accepted answer: http://stackoverflow.com/a/25352041
has comment: http://stackoverflow.com/comment/39526245
has comment: http://stackoverflow.com/comment/47817492
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25352041
has comment: http://stackoverflow.com/comment/39554042
has comment: http://stackoverflow.com/comment/43749328
has comment: http://stackoverflow.com/comment/39553991
tagged with: string
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/47797656
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/39526006
downvote count: 9
tagged with: java
tagged with: regex
has comment: http://stackoverflow.com/comment/39526413
linked to: http://stackoverflow.com/q/366202
has title: How can I split a string except when the delimiter is protected by quotes or brackets?
linked to: http://stackoverflow.com/q/25293099
tagged with: split
has body: I asked How to split a string with conditions. Now I know how to ignore the delimiter if it is between two characters. How can I check multiple groups of two characters instead of one? I found Regex for splitting a string using space when not surrounded by single or double quotes, but I don't understand where to change '' to []. Also, it works with two groups only. Is there a regex that will split using , but ignore the delimiter if it is between "" or [] or {}? For instance: // Input "text1":"text2","text3":"text,4","text,5":["text6","text,7"],"text8":"text9","text10":{"text11":"text,12","text13":"text14","text,15":["text,16","text17"],"text,18":"text19"} // Output "text1":"text2" "text3":"text,4" "text,5":["text6","text,7"] "text8":"text9" "text10":{"text11":"text,12","text13":"text14","text,15":["text,16","text17"],"text,18":"text19"}

http://stackoverflow.com/comment/39616110
type: Comment
comment on: http://stackoverflow.com/q/25386566
score: 0
type: QuestionComment
has text: @jmehrens The Eclipse Debug view doesnt show any Threads in this case. When GF starts up correctly I get the Thread view after a few seconds.

http://stackoverflow.com/comment/39376440
comment on: http://stackoverflow.com/q/25270185
score: 0
has text: Couple things: first off, the Java "standard" is to have getters and setters wrap your instance variables. This makes it easier to change things later on if some logic needs to happen to validate the state of things (which you can't do with method access). Second, then, assuming you've done that, the answer is no: it is generally considered best practice for these kind of classes to not have interfaces.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25344088
type: Question
upvote count: 14
has body: I'm unclear on how to implement task cancellation in RXJava. I'm interested in porting an existing API built using Guava's ListenableFuture. My use case is as follows: I have an single operation that's composed of a sequence of futures joined by Futures.transform() Multiple subscribers observe the operation's final future. Each observer can cancel the final future, and all observers witness the cancellation event. Cancellation of the final future results in the cancellation of its dependencies, e.g. in sequence 1->2->3, cancellation of 3 is propagated to 2, and so on. There's very little info in the RxJava wiki about this; the only references I can find to cancellation mention Subscription as an equivalent to .NET's Disposable, but as far as I can see, Subscription only offers the ability to unsubscribe from subsequent values in the sequence. I'm unclear on how to implement "any subscriber can cancel" semantics through this API. Am I thinking about this in the wrong way? Any input would be appreciated.
score: 14
has answer: http://stackoverflow.com/a/25351336
accepted answer: http://stackoverflow.com/a/25351336
tagged with: rx-java
tagged with: java
has title: How does task cancellation work in RxJava?
type: AnsweredQuestion
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/25293280
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39418916
has comment: http://stackoverflow.com/comment/39425000
has comment: http://stackoverflow.com/comment/39419177
type: Answer
accepted answer of: http://stackoverflow.com/q/25293196
has comment: http://stackoverflow.com/comment/39425754
has comment: http://stackoverflow.com/comment/39418870
answers question: http://stackoverflow.com/q/25293196
has body: Look at your loop: for(int year = 11; year &lt;= 13; year++){ for(int i = 1; i &lt;= 350; i++){ //generating 1050 URLs at one shot StringBuffer regNo = new StringBuffer("1111").append(year).append("111").append(String.format("%03d", i)); String url = "magicUrl" + regNo; System.out.println(url); worker = new MyRunnable(url, regNo.toString()); } } You're overwriting worker each time through the loop, so by the time you get to executor.execute(worker);, worker holds the last value you assigned to it, which will be the runnable created from the last url generated. Try replacing the line worker = new MyRunnable(url, regNo.toString()); with executor.execute(new MyRunnable(url, regNo.toString())); and see if that fixes it.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39423083

http://stackoverflow.com/q/25338923
has answer: http://stackoverflow.com/a/25339290
tagged with: jackson
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39504587
answer count: 2
possible better answer: http://stackoverflow.com/a/25339290
score: 2
tagged with: java
tagged with: hibernate
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39504947
accepted answer: http://stackoverflow.com/a/27075933
type: Question
has body: I have Task and RelatedTask entities: Every task can have a many related tasks, but every there can be some kind of circle : Task #1 has 3 related tasks - > #2, #3, #4 and task #4 has related tasks #1 and #5 1 -> 2, 3, 4 -> 1, 5 This circle making error in loading, how can I prevent it ? Here is my entities: @JsonAutoDetect @Entity public class Task { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long taskId; @OneToMany(fetch = FetchType.EAGER, mappedBy = "task", cascade = CascadeType.ALL) private List&lt;TaskRelated&gt; relatedTasks = new ArrayList&lt;TaskRelated&gt;(); } @JsonAutoDetect @Entity public class TaskRelated { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long taskRelatedId; @OneToOne @JoinColumn(name="relatedTaskId", insertable=false, updatable=false) private Task relatedTask; @JsonIgnore @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="taskId", insertable=false, updatable=false) private Task task; } The ERROR is when JACKSON try to serialize it: at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) at org.codehaus.jackson.map.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:72) at org.codehaus.jackson.map.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:23) at org.codehaus.jackson.map.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:86) at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) at org.codehaus.jackson.map.ser.BeanProper…
tagged with: serialization
has title: JPA - jackson - @JsonAutoDetect - circle relationship OneToMany - preventing LOOP loading errors
has answer: http://stackoverflow.com/a/27075933
upvote count: 2

jframe
tags question: http://stackoverflow.com/q/25388419
tags question: http://stackoverflow.com/q/25364018
tags question: http://stackoverflow.com/q/25285604
tags question: http://stackoverflow.com/q/25304355
tags question: http://stackoverflow.com/q/25373341
tags question: http://stackoverflow.com/q/25347172
tags question: http://stackoverflow.com/q/25326965
tags question: http://stackoverflow.com/q/25255598
tags question: http://stackoverflow.com/q/25253027
tags question: http://stackoverflow.com/q/25355587
tag name: jframe
tags question: http://stackoverflow.com/q/25233881
tags question: http://stackoverflow.com/q/25300328
tags question: http://stackoverflow.com/q/25286461
tags question: http://stackoverflow.com/q/25353857
tags question: http://stackoverflow.com/q/25335064
tags question: http://stackoverflow.com/q/25341576
tags question: http://stackoverflow.com/q/25289051
tags question: http://stackoverflow.com/q/25251786
tags question: http://stackoverflow.com/q/25230909
tags question: http://stackoverflow.com/q/25290872
tags question: http://stackoverflow.com/q/25357165
tags question: http://stackoverflow.com/q/25311680
tags question: http://stackoverflow.com/q/25230257
type: Tag
tags question: http://stackoverflow.com/q/25262727
tags question: http://stackoverflow.com/q/25370184
tags question: http://stackoverflow.com/q/25250726

http://stackoverflow.com/comment/39381896
has text: I update my code as u said here .mind me ask u to look at them ??
comment on: http://stackoverflow.com/a/25272758
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39447281
has text: he wants a nested method
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25308513

http://stackoverflow.com/comment/39415055
has text: Thanks, usar! This post explained my problem!
comment on: http://stackoverflow.com/a/25290615
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39391948
has text: The nexus 7 is arm, not x86, so remove the APP_ABI line from Applications.mk (arm is default), or add "armeabi" (or armeabi-v7a) there as well, or change it into "all", to build a larger binary supporting all official ABIs.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25273324

http://stackoverflow.com/a/25365794
answers question: http://stackoverflow.com/q/25365689
type: Answer
score: 0
has body: In both way Dog object doesnt override equals and hashcode. Approach 1 The same Dog reference is used to put and load. So If hashcode is not overridden then object memory location is used. Since both the reference is same. So Same memory location is used . Then it works fine. Approach 2 In this approach two different reference used. So Both the memory locations are different. Then map didnt find the value of second memory location.

http://stackoverflow.com/comment/123460724
has text: My understanding of ATOMIC comes from DB world - it means that `rename-atomic` is somthing like [`start transaction` -> `kill dst file if exist` -> `change name of src file` -> `commit transaction`]. While transaction is not commited - readers see previous state of data (eiter `no file` at first iteration or `last known version of file` otherwise), once transaction is commited - reader should see only final state, and in this state there is no "NoSuchFile" for 2nd+ iteration.
comment on: http://stackoverflow.com/a/69817342
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39674324
type: Comment
has text: So there would be no workaround to switching the branches of all projects together? For example our main project requires version 1.1 of A, 1.5 of B, 4.2 of C and etc. Is there a way for me to switch all these projects at the same time?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25400214

http://stackoverflow.com/a/25335128
downvote count: 0
has body: The behaviour of the method is specified in the documentation (the javadoc). Here's the documentation for Window.pack. Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. The resulting width and height of the window are automatically enlarged if either of dimensions is less than the minimum size as specified by the previous call to the setMinimumSize method.
type: AcceptedAnswer
score: 3
accepted answer of: http://stackoverflow.com/q/25335064
type: Answer
answers question: http://stackoverflow.com/q/25335064
upvote count: 3

http://stackoverflow.com/a/25257312
answers question: http://stackoverflow.com/q/25257277
score: 1
downvote count: 0
upvote count: 1
has body: Your Code: EditText name = (EditText) findViewById(R.id.name); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signup); Intent resign = getIntent(); } What You Should Do: public class SignupActivity extends ActionBarActivity { EditText name; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signup); name = (EditText)findViewById(R.id.name); Intent resign = getIntent(); } }
type: Answer

http://stackoverflow.com/comment/92574495
has text: You have set the response as JSON type but it is expecting application/octet-stream. Try to set @Produces(MediaType.APPLICATION_OCTET_STREAM)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25264604
type: Comment

http://stackoverflow.com/a/25330730
score: 3
has body: This is probably a case of the JDK's bin directory not being in your PATH. Try to put it in your path. see this other stack overflow question for more details. The directions are the pretty much the same for windows 8 Stack Overflow Answer
type: Answer
answers question: http://stackoverflow.com/q/25330488
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39568094
score: 0
has text: so when you clicked on number one, Joptionpane has to show 1 for example?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25373037

http://stackoverflow.com/comment/39496695
comment on: http://stackoverflow.com/a/25333844
score: 0
type: AnswerComment
has text: Seems like that example brings up an issue because it is a non final primitive, as stated by the book: "Safely published effectively immutable objects can be used safely by any thread without additional synchronization", so I guess my concern should not be worried about :-)
type: Comment

http://stackoverflow.com/comment/39564796
has text: I am getting your point but you are stating it wrong. 2's complement has nothing to do with adding 1's before. It is because as @peter stated ,the number for example 7 has leading 0's which are inverted to all 1's
comment on: http://stackoverflow.com/q/25371805
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/39529397
score: 0
type: Comment
has text: How do you know the NPE is "noncatchable"? (Not that I suggest catching it because it likely indicates an error in your code somewhere.)
type: QuestionComment
comment on: http://stackoverflow.com/q/25353414

http://stackoverflow.com/q/25299611
answer count: 2
tagged with: java
downvote count: 0
tagged with: mysql
score: 1
upvote count: 1
tagged with: tomcat
favorite count: 0
type: Question
has body: I have a Grails application which is deployed in Apache Tomcat server. Everything works fine but sometimes the application receives around 100-200 requests in succession(Due to an API integration and these many requests are sent by the API to my application that too within a few minutes and not by my application to the API) and tomcat starts to hang(There are no errors though). The request is mostly to perform some small DB updates from the data sent by the API used. Is there a way i can handle this? Any jvm setting or any code changes to handle this?
accepted answer: http://stackoverflow.com/a/25299651
has answer: http://stackoverflow.com/a/25299651
possible better answer: http://stackoverflow.com/a/56726204
tagged with: grails
has title: Tomcat hangs due to large requests
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56726204

http://stackoverflow.com/comment/39309914
type: Comment
has text: @duffymo not the most helpful comment. You know that AWS and Heroku use this approach right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25234469

http://stackoverflow.com/q/25274046
tagged with: java
has answer: http://stackoverflow.com/a/25274453
tagged with: string
has comment: http://stackoverflow.com/comment/39383742
has comment: http://stackoverflow.com/comment/39383741
type: Question
has comment: http://stackoverflow.com/comment/39384202
has comment: http://stackoverflow.com/comment/39384217
possible better answer: http://stackoverflow.com/a/25274287
linked to: http://stackoverflow.com/q/25025347
has body: I am trying to get file names from a directory to a String, remove the file extensions from the String so I can convert the file names to Integers (The file names are numbers, like 00123.jpg). (I want to convert it to an int to get the average number between the largest number and the smallest number of the array) Here's what I did so far: File currentBoot = new File(destination); //Directory String[] fileNames = currentBoot.list(); //Returns array of file names (Including .jpg) for (int i = 0; i&lt;fileNames.length;i++) { fileNames[i] = fileNames[i].replace(".jpg", ""); //Removes .jpg from the file names } int numbers[] = new int[fileNames.length]; for (int i = 0; i&lt;numbers.length; i++) { numbers[i] = Integer.parseInt(fileNames[i]); //Convert the file names to int } Here I add the file extension again so I can search for the file: int max = findLargest(fileNames); int min = arrayMin(fileNames); int fileNumber = (max + min)/2; String fileName = fileNumber + ".jpg"; Here's my problem: numbers[] returns the file names but removes any useless zeros (Replaces 00123 with 123). The number of zeros on the file names changes between devices (I use a system folder with those files in it) and my app crashes at different devices because it looks for 123.jpg instead of 00123.jpg (I add the file extensions back later). How do I convert a String to an int but keeping the leading zeros?
has comment: http://stackoverflow.com/comment/39384250
has comment: http://stackoverflow.com/comment/39393880
has title: Converting String to int but keeping the length
has answer: http://stackoverflow.com/a/25274498
has answer: http://stackoverflow.com/a/25274287
has comment: http://stackoverflow.com/comment/39393912
has comment: http://stackoverflow.com/comment/39385070
has comment: http://stackoverflow.com/comment/39384360
duplicate of: http://stackoverflow.com/q/25025347
type: AnsweredQuestion
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25274453

http://stackoverflow.com/a/25276904
downvote count: 0
upvote count: 1
score: 1
has body: If you're expecting one character it doesn't make sense to call readLine(). By definition, a line includes a line terminator, and if you're only expecting one character it will have to be the line terminator itself. Use InputStream.read() as I already stated in commentary.
answers question: http://stackoverflow.com/q/25276491
type: Answer

theory
tags question: http://stackoverflow.com/q/25293610
tag name: theory
type: Tag

http://stackoverflow.com/q/25312425
accepted answer: http://stackoverflow.com/a/25315029
type: Question
has body: I have a j2ee app running on GAE. There is that pre-generated index.html, which is called every time I run the server - let's say http://localhost:8080. But I want to write my own front-end using AngularJS. For that, I created the whole project with Yeoman and copied all the files to folder in my j2ee project. Right now -> I can call manually the AngularJS webapp like this: http://localhost:8080/webapp/app/index.html But obviously, that is not the way one wants to go. I would like to call it simply on http://localhost:8080. How can I achieve this?
has answer: http://stackoverflow.com/a/25315029
answer count: 2
has answer: http://stackoverflow.com/a/32752984
has title: How to change path to index.html (AngularJS) in GAE j2ee
type: AnsweredQuestion
score: 0
tagged with: angularjs
possible better answer: http://stackoverflow.com/a/32752984
tagged with: google-app-engine
tagged with: java

http://stackoverflow.com/comment/39443756
comment on: http://stackoverflow.com/a/25306389
has text: i don't understand why the AmazonS3Client needs the credentials. I would expect it to be available in the scope, because if i do it using ./elastic-mapreduce the credentials are available. And using 'store' in pig also is able to write to the bucket
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25369502
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25352716
answers question: http://stackoverflow.com/q/25352716
score: 0
has body: I resolved the issue I had by deleting Google+ data related to my previous game login and logging in again. I do not know what caused this error in the first place but it may be due to wrong settings in my Developer Console. I did change some things, like re-authenticated the app but the changes took effect only after deleting old data.
type: Answer

http://stackoverflow.com/comment/39543773
has text: Thanks for correction! Now i understand, why netbeans always says me to do this.
type: AnswerComment
comment on: http://stackoverflow.com/a/25361252
score: 0
type: Comment

http://stackoverflow.com/comment/39416949
comment on: http://stackoverflow.com/a/25292307
score: 0
type: AnswerComment
has text: That's true, but does it really answer the OP's question? Normally, when you read a text-file on Windows, you don't see the `\r`. You only see if it you're reading a text-file in binary mode.
type: Comment

http://stackoverflow.com/comment/39500262
score: 0
type: AnswerComment
type: Comment
has text: Where does the NoClassDefFoundError occur from the stack trace?
comment on: http://stackoverflow.com/a/25336333

http://stackoverflow.com/q/25380168
has comment: http://stackoverflow.com/comment/39750931
has comment: http://stackoverflow.com/comment/39620452
has body: Given a Collection of type T, what is the Java 8 idiomatic way to convert it to a List of type T? Is it the following?: Collection&lt;Foo&gt; f; f.stream().collect(Collectors.toList());
favorite count: 0
type: Question
has title: Converting a Collection<T> to a List<T>
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/25380218
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39750648

http://stackoverflow.com/q/25230580
tagged with: annotations
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25231020
has comment: http://stackoverflow.com/comment/39302329
favorite count: 0
type: Question
has title: Annotation is not visible on some compilers
tagged with: android
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39302095
has comment: http://stackoverflow.com/comment/39301709
has body: i have quite a funny problem. I have defined annotation: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface MyAnnot { } I have: public interface F&lt;T&gt;{ public void onFinish(T param); } public abstract class Foo&lt;T&gt; implements F&lt;T&gt;{ } Also: public class Bar extends Foo&lt;Drawable&gt;{ @Override @MyAnnot public void onFinish(Drawable d){ // ... } } And: public class FooBar extends Bar{ @Override @MyAnnot public void onFinish(Drawable d){ // ... } } In one of methods in Foo I added: Method method = this.getClass().getMethod("onFinish", Object.class); if (method.isAnnotationPresent( MyAnnot.class )){ //Do sth } I'm using this in android project, on one of my computers this works fine, but on second isAnnotationPresent always returns false. Application was run in both cases by IntelliJ Idea, on the same phone. Additionally if i use this.getClass().getMethod("onFinish", Drawable.class); it works on all computers.
upvote count: 0
has comment: http://stackoverflow.com/comment/39302300
type: UnansweredQuestion

http://stackoverflow.com/comment/39438796
has text: This was perfect! I thank you a lot. I just need to add 'queueConnection.start()' to making that work on my code!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25287997

http://stackoverflow.com/comment/39516432
type: Comment
comment on: http://stackoverflow.com/a/25336863
score: 0
type: AnswerComment
has text: yes ,thats what I always prefer and works fine everytime

http://stackoverflow.com/comment/39375023
comment on: http://stackoverflow.com/q/25269493
has text: You escape them. `\\[` `\\]`. Please read [Regex: Special Characters](http://www.regular-expressions.info/characters.html)
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25312585
answers question: http://stackoverflow.com/q/25292485
type: Answer
has body: I've managed to solve this somehow, thanks @GPI for tips. I'm fairly new to the Spring WS and javax.xml.whatever, so I can't tell if this is either the right or elegant way of doing this, but it does exactly what I want. This code adds custom header elements to &lt;SOAP-ENV:Header&gt;, based on my objects generated from XSD schemas via JAXB. I have no idea how does the Transformer know where I want to put these elements, but it places them correctly in Header section. public class HeaderComposingCallback implements WebServiceMessageCallback { private final String action; public HeaderComposingCallback( String action ) { this.action = action; } @Override public void doWithMessage(WebServiceMessage webServiceMessage) throws IOException, TransformerException { SoapHeader soapHeader = ((SoapMessage)webServiceMessage).getSoapHeader(); try { JAXBContext context = JAXBContext.newInstance( MessageHeader.class, Security.class ); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document securityDocument = builder.newDocument(); Document headerDocument = builder.newDocument(); Marshaller marshaller = context.createMarshaller(); marshaller.marshal( HeaderFactory.getHeader( action ), headerDocument ); marshaller.marshal( SecurityFactory.getSecurity(), securityDocument ); Transformer t = TransformerFactory.newInstance().newTransformer(); DOMSource headerSource = new DOMSource( headerDocument ); DOMSource securitySource = new DOMSource( securityDocument ); t.transform( headerSource, soapHeader.getResult() ); t.transform( securitySource, soapHeader.getResult() ); } catch (JAXBException | ParserConfigurationException e) { e.printStackTrace(); } } } Then I simply pass HeaderComposingCallback object to marshalSendAndReceive() method during service call. EDIT (after Arjen's comment) Arjen's right. What I wanted to do could be achieved simplier. Now my doWithMessage method looks like this: @Override public voi…
accepted answer of: http://stackoverflow.com/q/25292485
score: 4
has comment: http://stackoverflow.com/comment/129018424
upvote count: 4
has comment: http://stackoverflow.com/comment/39474903
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25342300
has comment: http://stackoverflow.com/comment/39512640
downvote count: 0
upvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25342176
has body: Try enabling SSL by adding these properties: props.put("mail.smtp.socketFactory.port", "587"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); And also try athenticating the Session like this: Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); If you have enabled two-step verification you will need to create an application password and authenticate using that.
has comment: http://stackoverflow.com/comment/39510674

http://stackoverflow.com/comment/86080072
type: Comment
has text: I tried your approach but now im getting Data truncation: Data too long for column 'dalekComponent' at row 1.
comment on: http://stackoverflow.com/a/25297718
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39442308
comment on: http://stackoverflow.com/a/25305074
type: Comment
score: 0
type: AnswerComment
has text: Check the project build path. Is it using a JDK/JRE > 1.5?

http://stackoverflow.com/q/25371136
has comment: http://stackoverflow.com/comment/39563115
has answer: http://stackoverflow.com/a/25371460
linked to: http://stackoverflow.com/q/9897254
favorite count: 0
type: Question
tagged with: android-volley
has title: NoClassDefFoundError when using Android Volley
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39563152
has comment: http://stackoverflow.com/comment/39563530
accepted answer: http://stackoverflow.com/a/25371460
has body: I am trying to make a network request using android volley library: StringRequest jsObjRequest = new StringRequest(Request.Method.GET, Network.getFullUrl("/Account/Login"), new Listener&lt;String&gt;() { @Override public void onResponse(String response) { // TODO Auto-generated method stub } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub } }); Network.getInstance(this).addToRequestQueue(jsObjRequest); I have included the library in the build path under Projects. And it compiles fine, But when I run the app I get the following error: 08-18 21:57:05.739: E/AndroidRuntime(22937): FATAL EXCEPTION: main 08-18 21:57:05.739: E/AndroidRuntime(22937): java.lang.NoClassDefFoundError: com.android.volley.toolbox.StringRequest 08-18 21:57:05.739: E/AndroidRuntime(22937): at com.fma.mobileapp.LoginActivity.attemptLogin(LoginActivity.java:173) 08-18 21:57:05.739: E/AndroidRuntime(22937): at com.fma.mobileapp.LoginActivity$2.onClick(LoginActivity.java:94) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.view.View.performClick(View.java:4475) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.view.View$PerformClick.run(View.java:18786) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.os.Handler.handleCallback(Handler.java:730) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.os.Handler.dispatchMessage(Handler.java:92) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.os.Looper.loop(Looper.java:137) 08-18 21:57:05.739: E/AndroidRuntime(22937): at android.app.ActivityThread.main(ActivityThread.java:5419) 08-18 21:57:05.739: E/AndroidRuntime(22937): at java.lang.reflect.Method.invokeNative(Native Method) 08-18 21:57:05.739: E/AndroidRuntime(22937): at java.lang.reflect.Method.invoke(Method.java:525) 08-18 21:57:05.739: E/AndroidRuntime(22937): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209) 08-18 21:57:05.739: E/AndroidRuntime(22937): at com.androi…
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: classnotfoundexception
linked to: http://stackoverflow.com/q/9870995
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39357510
score: 0
has text: May also be good to mention that the tag might be in the **Prohibited Elements** filter option in the TinyMCE plugin, in the Plugins Manager
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25252863

http://stackoverflow.com/a/25359242
type: Answer
upvote count: 1
score: 1
has body: Arrays and generics don't mix. Just use a List&lt;List&lt;Integer&gt;&gt;: List&lt;List&lt;Integer&gt;&gt; hash = new LinkedList&lt;List&lt;Integer&gt;&gt;(list.size());
downvote count: 0
answers question: http://stackoverflow.com/q/25359104

http://stackoverflow.com/q/25317678
has comment: http://stackoverflow.com/comment/39465580
answer count: 1
has comment: http://stackoverflow.com/comment/97454575
has comment: http://stackoverflow.com/comment/39482617
has body: The following code throws a NullPointerException when id matches a form revision in the database: @Transactional(readOnly = true) public FormRevision getFormRevision(Long id) { FormRevision formRevision = formRevisionDao.findOne(id); formRevision.fillLazyCollections();//NullPointerException happens here for some form revisions return formRevision; } This happens because the formRevisionDao.findOne(id) is returning null for certain form revisions. This does not happen for every form revision, but for the ones it does happen for it is consistent, and will fail every time. Additional Info: The formRevisionDAO object is auto-generated by Hibernate and looks like the following @Repository() public interface IFormRevisionDAO extends JpaRepository&lt;FormRevision, Long&gt; {} The generated hibernate query doesn't look like it could cause the cause. It only has left outer joins, and the where clause is only "id = ?". Also, this query works for other form revisions. It also does not appear to be a caching issue, as I removed caching from the FormRevision object and the problem persists. Strangest of all, if you debug the code, the first formRevisionDao.findOne(id) will return null. However, subsequent identical calls will return the expected object. I'm not sure what else could be causing this. Maybe a synchronization or Hibernate version issue (currently using Hibernate 4.1.12 and using it with "Oracle Database 10g Release 10.2.0.4.0 - 64bit Production")? Any help/insight would be greatly appreciated!
type: Question
has title: Hibernate findOne doesn't work the first time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25324286
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/25267457
has comment: http://stackoverflow.com/comment/39371269
has comment: http://stackoverflow.com/comment/39371353
answers question: http://stackoverflow.com/q/25267209
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25267209
has body: Use REQUIRES_NEW instead of REQUIRED to run it outside a transaction context. Please refer to docs you need to have @Transactional(Transactional.TxType.REQUIRES_NEW)
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/95859853
has text: It still doesn't work, I'm afraid. It will return false for a={1,2,3} and k= 3
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/54528299

http://stackoverflow.com/comment/39567555
comment on: http://stackoverflow.com/a/25353250
score: 0
has text: I ran the code for a value of N = 11; I obtained an answer but also got the message "Repetition between answers detected. Quiting." What is the purpose of that message? Does it mean that the answer cannot be obtained?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39540339
has text: That's not *executing* an sql command. That's typing out a file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25359384
score: 4

unit-testing
tags question: http://stackoverflow.com/q/25369541
tags question: http://stackoverflow.com/q/25348564
tags question: http://stackoverflow.com/q/25335461
tags question: http://stackoverflow.com/q/25372312
tags question: http://stackoverflow.com/q/25363884
tags question: http://stackoverflow.com/q/25329588
type: Tag
tags question: http://stackoverflow.com/q/25262458
tag name: unit-testing
tags question: http://stackoverflow.com/q/25341473
tags question: http://stackoverflow.com/q/25272391
tags question: http://stackoverflow.com/q/25335343
tags question: http://stackoverflow.com/q/25377894
tags question: http://stackoverflow.com/q/25339148
tags question: http://stackoverflow.com/q/25271285
tags question: http://stackoverflow.com/q/25262854
tags question: http://stackoverflow.com/q/25334486
tags question: http://stackoverflow.com/q/25230927
tags question: http://stackoverflow.com/q/25246306
tags question: http://stackoverflow.com/q/25298119
tags question: http://stackoverflow.com/q/25335874
tags question: http://stackoverflow.com/q/25379374
tags question: http://stackoverflow.com/q/25283140
tags question: http://stackoverflow.com/q/25312427
tags question: http://stackoverflow.com/q/25316108
tags question: http://stackoverflow.com/q/25260342
tags question: http://stackoverflow.com/q/25324636
tags question: http://stackoverflow.com/q/25308524
tags question: http://stackoverflow.com/q/25317777

gwt
tags question: http://stackoverflow.com/q/25384806
tags question: http://stackoverflow.com/q/25328313
tag name: gwt
tags question: http://stackoverflow.com/q/25378346
tags question: http://stackoverflow.com/q/25284410
tags question: http://stackoverflow.com/q/25319271
tags question: http://stackoverflow.com/q/25237726
type: Tag
tags question: http://stackoverflow.com/q/25383501
tags question: http://stackoverflow.com/q/25264257
tags question: http://stackoverflow.com/q/25361219
tags question: http://stackoverflow.com/q/25322786
tags question: http://stackoverflow.com/q/25365542
tags question: http://stackoverflow.com/q/25312838
tags question: http://stackoverflow.com/q/25350078
tags question: http://stackoverflow.com/q/25380952
tags question: http://stackoverflow.com/q/25364772
tags question: http://stackoverflow.com/q/25298808
tags question: http://stackoverflow.com/q/25325801
tags question: http://stackoverflow.com/q/25263594
tags question: http://stackoverflow.com/q/25357166
tags question: http://stackoverflow.com/q/25380416

http://stackoverflow.com/a/51982924
score: 0
answers question: http://stackoverflow.com/q/25242321
type: Answer
has body: @Controller: This annotation is just a specialized version of @Component and it allows the controller classes to be auto-detected based on classpath scanning. @RestController: This annotation is a specialized version of @Controller which adds @Controller and @ResponseBody annotation automatically so we do not have to add @ResponseBody to our mapping methods.

http://stackoverflow.com/comment/39453626
score: 0
has text: Accepted and changed.
type: Comment
comment on: http://stackoverflow.com/a/25311537
type: AnswerComment

http://stackoverflow.com/a/25641610
has comment: http://stackoverflow.com/comment/134024807
type: Answer
answers question: http://stackoverflow.com/q/25367292
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/54282574
has comment: http://stackoverflow.com/comment/134025414
has body: Using getEmbeddedPicture will not be enough You need to add a little bit code for that. Try this md.setDataSource(songsList.get(index).get("songPath")); byte[] artBytes = mmr.getEmbeddedPicture(); if(artBytes != null) { InputStream is = new ByteArrayInputStream(mmr.getEmbeddedPicture()); Bitmap bm = BitmapFactory.decodeStream(is); imgArt.setImageBitmap(bm); } else { imgArt.setImageDrawable(getResources().getDrawable(R.drawable.your_default_image)); } Also look at this: try { byte [] art = md.getEmbeddedPicture(); Bitmap songImage = BitmapFactory .decodeByteArray(art, 0, art.length); md.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM)); String artist =md.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST)); String genre = md.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE)); } catch (Exception e) { // TO-DO Exception } Refer the docs
has comment: http://stackoverflow.com/comment/44286075

http://stackoverflow.com/comment/39410069
score: 0
type: Comment
has text: @JPHochbaum No, this `List <Expenses> expenses = new ArrayList();` is a raw `ArrayList`.
type: AnswerComment
comment on: http://stackoverflow.com/a/25287561

http://stackoverflow.com/a/25359809
upvote count: 0
has body: The application needs to know the Tomcat installation path on your production machine to resolve the paths. Either you can hard code in your xml or you can specify a properties file that can get the installation path of tomcat i.e CATALINA_HOME or CATALINA_BASE. The reason it works in your IDE and not on your production is because the system understands the /WEB-INF in your IDE but it doesn't happen so in when you deploy it in the stand alone system. You can append your installation path of your standalone server to each of the paths. e.g. C:/Tomcat/bin. Hence you will need to refer your files like &lt;put-attribute name="body" value="C:/Tomcat/bin/WEB-INF/pages/hello.jsp" /&gt; If you are not a fan of absolute path, you can refer the variables mentioned above and how to use them from a properties file. Hope it helps.
downvote count: 1
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25359480

http://stackoverflow.com/a/25233400
downvote count: 0
has body: rundoes not throw exceptions and doesn't take parameters. You have to override the good one: public void run() { } You can add the @Override annotation to be sure that you override the good one: @Override public void run() { }
has comment: http://stackoverflow.com/comment/39307758
score: 3
accepted answer of: http://stackoverflow.com/q/25233383
type: Answer
answers question: http://stackoverflow.com/q/25233383
has comment: http://stackoverflow.com/comment/39307745
upvote count: 3
has comment: http://stackoverflow.com/comment/39307501
type: AcceptedAnswer

http://stackoverflow.com/comment/39351860
comment on: http://stackoverflow.com/q/25256490
has text: No. It doesn't throw 'file not exists exception'. There is no such exception. Don't be sloppy about things like this. It probably throws `FileNotFoundException,` but you need to confirm that.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25343566
has answer: http://stackoverflow.com/a/25343877
possible better answer: http://stackoverflow.com/a/25343846
has answer: http://stackoverflow.com/a/25346225
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39526305
has answer: http://stackoverflow.com/a/25343846
has comment: http://stackoverflow.com/comment/39512444
has body: So, I'm doing this challenge called valid palindrome and I'm stuck. My code works for small/medium strings but when it runs I get a Time Limit Exceeded message which means there has to be a better way to optimize my code. I was looking at using the charAt() and do something like ... since it's a palindrome... split it half and do a quick check of opposing characters in a for loop but I'm stuck here. /** * Palindrome Word Checker * Tests to see if an input phrase is a * palindrome (read the same if read backward and forwards) */ import java.util.Scanner; public class wordPalindrome { public static void main(String[] args) { Scanner scanner = new Scanner(System. in ); System.out.println("Palindrome Word Checker\nEnter a phrase, please:"); String theWord = ""; while (true) { theWord = scanner.nextLine(); System.out.println(theWord + ": " + wordPalindrome(theWord)); } } public static boolean wordPalindrome(String word) { // SECONDLY, we check to see how we much of the word // is left until verification. We check first to prevent // array (out of bounds) exception errors. if (word.length() == 0 || word.length() == 1) return true; // FIRST we take the last letter and compare it to the first letter // if it matches, then we move onward and return to the function // with a new word. By substring(), we take off the first/last letters // and we keep repeating this process until the length is // at 0 or 1 for odd/even lengthed words to verify its status if (word.charAt(word.length() - 1) == word.charAt(0)) return wordPalindrome(word.substring(1, word.length() - 1)); // if we fail to make an ID, then it's obviously // not a palindrome and we return false return false; } } Here is what "string" they use to crash my program: pastebin. How do I withstand a string that long? I can't obviously use String since it's so long... too much info.
accepted answer: http://stackoverflow.com/a/25343631
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25343631
has answer: http://stackoverflow.com/a/25343692
has comment: http://stackoverflow.com/comment/39512548
favorite count: 0
type: Question
has title: Java - Word palindrome for LONG strings
answer count: 5
upvote count: 0
tagged with: palindrome
has comment: http://stackoverflow.com/comment/39526333
downvote count: 1

http://stackoverflow.com/comment/39589720
has text: And about your line "I recommend putting indices after the type (`String[] array1`) so it will be unambigous."; I will indeed keep using this. I was just wondering what the differences were and why `[]` after the field-name exist, which you've answered perfectly.
comment on: http://stackoverflow.com/a/25385318
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39445898
type: QuestionComment
has text: Are you sure that you schema is allowing `dma_id` to be null?
comment on: http://stackoverflow.com/q/25307316
score: 0
type: Comment

http://stackoverflow.com/a/25273528
answers question: http://stackoverflow.com/q/25264750
type: Answer
has body: From Android 4.2 enhancements: Cryptography - Modified the default implementations of SecureRandom and Cipher.RSA to use OpenSSL. Added SSL Socket support for TLSv1.1 and TLSv1.2 using OpenSSL 1.0.1 This means that they are using another provider, and probably another default RSA padding mechanism. You should always provide a complete algorithm string and not rely on provider defaults, e.g. try "RSA/ECB/OAEPWithSHA1AndMGF1Padding" for new applications and "RSA/ECB/PKCS1Padding" for compatibility with older libraries. Note that you usually do not encrypt a file directly using RSA. Usually you encrypt the file with a random data key using e.g. AES, a symmetric cipher. Then you encrypt that AES key with the RSA public key and send the result with the ciphertext. This way you can encrypt an (almost) arbitrary number of bytes. This is called hybrid cryptography.
has comment: http://stackoverflow.com/comment/39395318
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39395220
accepted answer of: http://stackoverflow.com/q/25264750
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39402315
downvote count: 0
has comment: http://stackoverflow.com/comment/39406296

http://stackoverflow.com/q/25264738
has body: I am trying to access an input field here, but I am getting an error message stating : Element currently not visible. When I try to type an element into the input field using sendkeys method, it still doesn't result into anything. The html code of the element is below : Add a Tag Please guide me on what could possibly be going wrong here. Thank you for your time.
accepted answer: http://stackoverflow.com/a/25271662
tagged with: textbox
has answer: http://stackoverflow.com/a/25271662
type: Question
has title: Selenium Webdriver :To enter an element into ul li text box
has answer: http://stackoverflow.com/a/25265757
downvote count: 0
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25280446
tagged with: selenium-webdriver
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25265757
answer count: 3
score: 1
tagged with: java

http://stackoverflow.com/comment/39547740
type: Comment
type: QuestionComment
has text: Why the above code is not working, any ideas? i converted it to Arraylist too, still getting the same result..Please help
comment on: http://stackoverflow.com/q/25280891
score: 0

http://stackoverflow.com/comment/120013252
score: 5
has text: Since Hibernate 5 you don’t need and should not use `@Temporal` in new code. It was for annotating `Date` and `Calendar` fields, but those classes are poorly designed and long outdated Instead use classes from [java.time, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/). They have their *expected precision* built in, and you don’t use that annotation with them.
comment on: http://stackoverflow.com/q/25333711
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25354670
type: Answer
answers question: http://stackoverflow.com/q/25354157
has comment: http://stackoverflow.com/comment/39531804
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25354157
has comment: http://stackoverflow.com/comment/39531759
has body: Your activity t1 does not have any theme applied to it in the AndroidManifest.xml therefore it uses the default for your application - in your case, @style/AppTheme which includes an Action Bar. Set a theme in your Manifest: Or make a new theme specifically for the no action bar case: And use it:
downvote count: 0

http://stackoverflow.com/comment/39475604
type: Comment
comment on: http://stackoverflow.com/a/25323592
has text: This is the default behaviour of the java compiler which works exactly like this.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25305223
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25304789
answers question: http://stackoverflow.com/q/25304789
type: Answer
has body: The issue was not in that code, but rather with the path to my Keycert I was using the Server Certificate rather than the Client Certificate.
score: 3

http://stackoverflow.com/q/25256632
has answer: http://stackoverflow.com/a/25257126
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25260915
has comment: http://stackoverflow.com/comment/39351661
type: UnansweredQuestion
has body: User will enter the Date like yyyy-MM-dd or yyyy-MM-dd hh:mm:ss.Then I need to validate the timestamp. please help me on this. I need to verify these type of validations of Both (yyyy-MM-dd) or (yyyy-MM-dd hh:mm:ss). If the user enters the date is yyyy-MM-dd then will take the like this yyyy-MM-dd 00:00:00 and else if user enters the date is yyyy-MM-dd HH:mm:ss then take as it is like yyyy-MM-dd HH:mm:ss private static boolean dateValidate(String inputDate) { try { String[] datePattern = {"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd "}; for (String pattern : datePattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); Date date = sdf.parse(inputDate); String formattedDate = sdf.format(date); if (inputDate.equals(formattedDate)) { return true; } } } catch (ParseException ex) { return false; } return false; } public static void main(String args[]) { // TODO Auto-generated method stub System.out.println(SampleTest.dateValidate("2014-02-22 22:23:22")); System.out.println(SampleTest.dateValidate("2014-02-22")); }
has comment: http://stackoverflow.com/comment/39351651
score: 0
answer count: 3
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25256826
has title: how to validate the timestamp (yyyy-MM-dd HH:mm:ss) and (yyyy-MM-dd)
downvote count: 1

http://stackoverflow.com/a/25315602
score: 1
downvote count: 0
upvote count: 1
has body: Use any JSON parsing library such as GSON or Jackson and convert it into Java Object. Sample code using GSON library: Type type = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() {}.getType(); Map&lt;String, Object&gt; data = new Gson().fromJson(jsonString, type); // just iterate the map and get the desired value Sample code using Jackson library: JSONObject obj = new JSONObject(s); JSONArray jsonArray = obj.getJSONArray("meta"); for (int i = 0; i &lt; jsonArray.length(); i++) { System.out.println(jsonArray.getJSONObject(i).get("this_id")); } output: 111111 222222 333333
type: Answer
answers question: http://stackoverflow.com/q/25315405

http://stackoverflow.com/q/25260144
tagged with: java
has comment: http://stackoverflow.com/comment/39358000
has title: Throwing Exception while inserting in cells of Excel file
answer count: 1
tagged with: excel
accepted answer: http://stackoverflow.com/a/25260463
has body: I have created method to create Excel file and added header from user. The code is /** * Method to add rows to Workbook File. * &lt;br&gt;Here Flag is to check weather adding header row or datarow * @param List,Integer * @return void*/ public void addrows(List l,int flag) { int headcount=0,rowcount=1; if(flag==0) { row=sheet.createRow(0); row.setHeightInPoints(13); Iterator it=l.iterator(); while(it.hasNext()) { cell=row.createCell(headcount); cell.setCellValue(""+it.next()); headcount++; } } else if(flag==1) { Iterator it=l.iterator(); while(it.hasNext()) { row=sheet.createRow(rowcount); row.setHeightInPoints(13); rowcount++; for(int count=0;count&lt;headcount;count++) { cell = row.createCell(count); cell.setCellValue(""+it.next()); } } } } WHat changes should be made if user dosen't add any data at particular cell and we want to put null at that cell? Please help me out.. Thanks in Advance
type: Question
tagged with: null
has comment: http://stackoverflow.com/comment/39390245
has comment: http://stackoverflow.com/comment/39358281
has comment: http://stackoverflow.com/comment/39357976
tagged with: iterator
has answer: http://stackoverflow.com/a/25260463
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39574596
type: QuestionComment
has text: You can use the `View arg1`. `arg1.getId()`should return the id of the spinner. If it does not, just use the id of the parent.
score: 0
comment on: http://stackoverflow.com/q/25377224
type: Comment

http://stackoverflow.com/comment/39458928
type: QuestionComment
comment on: http://stackoverflow.com/q/25314402
type: Comment
score: 0
has text: It may not look like a big difference with such a simple example, but it will help you later on to separate this construction code and model code. There's a good video about this: https://www.youtube.com/watch?v=RlfLCWKxHJ0

http://stackoverflow.com/comment/39411477
comment on: http://stackoverflow.com/q/25286791
score: 0
has text: Each `if(document.applets[0].visibility="visible")` needs to be `if(document.applets[0].visibility === "visible")`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39357538
type: QuestionComment
has text: In your MatchDB class do you have methods that begin with addTo?
comment on: http://stackoverflow.com/q/25259864
score: 0
type: Comment

http://stackoverflow.com/comment/39446334
type: Comment
comment on: http://stackoverflow.com/q/25308070
type: QuestionComment
score: 2
has text: The import statement must be written in compile time, class loaders can be used in runtime.

http://stackoverflow.com/a/25324486
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25309293
has body: It seems that Hibernate Search does not support this feature natively (as also the lucene guys do not suggest it). There seems that only one option exists which you already stated and you refuse using it; annotating all your fields for with a name: @Fields({ @Field(index = Index.TOKENIZED), @Field(name = "ALL", index = Index.TOKENIZED) }) //your variable declaration
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39579547
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25379782
type: Comment
has text: Yes, I am using swing. I have done the highlighting part, but can't retrieve the line information's from it.

http://stackoverflow.com/a/25289272
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: You'll probably want to track allocations in Android monitor to see what's going on. See https://developer.android.com/tools/debugging/debugging-memory.html for details about debugging your app's allocations. Also check out this video from a past Google I/O about Android Memory Management: https://www.youtube.com/watch?v=_CruQY55HOk
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25288493
answers question: http://stackoverflow.com/q/25288493

http://stackoverflow.com/comment/39341676
score: 0
type: Comment
has text: I see so this only works as the router companies have built it in as a fetcher for a list of applications. I guess there is not equivalent of this that will not require the router company to have you on a list?
type: AnswerComment
comment on: http://stackoverflow.com/a/25249646

http://stackoverflow.com/comment/39513890
score: 0
type: Comment
type: AnswerComment
has text: You are my hero! Thx a lot. I would never found it out on my own!
comment on: http://stackoverflow.com/a/25341812

http://stackoverflow.com/a/25332127
has comment: http://stackoverflow.com/comment/39492104
has comment: http://stackoverflow.com/comment/39609724
has comment: http://stackoverflow.com/comment/39493228
has comment: http://stackoverflow.com/comment/39493155
has comment: http://stackoverflow.com/comment/39492196
has body: Spring cannot deduce that it need to Inject User.class in the constructor of EntityManager to satisfy the depdenency in UserServiceImpl. If you are using Spring 4, You can to define a bean of type EntityManager&lt;User, Integer&gt;: @Configuration public class Config { @Bean public EntityManager&lt;User, Integer&gt; userEntityManager() { new EntityManager(User.class); } } Edit: Or define a BeanDefinitionRegistryPostProcessor that will check for beans that require EntityManager as dependency, identify the required type, construct the new EntityManager bean for the required type and add it to the bean registry. @Component public class MyEntityManagerBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor { @Override public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { for (String beanName : beanFactory.getBeanDefinitionNames()) { final BeanDefinition beanDefinition = getOriginatingBeanDefinition( beanFactory.getBeanDefinition(beanName)); final Class&lt;?&gt; beanClass = getClass(beanDefinition.getBeanClassName()); if (beanClass != null) { ReflectionUtils.doWithFields(beanClass, new ReflectionUtils.FieldCallback() { public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { if (field.isAnnotationPresent(Autowired.class) || field.isAnnotationPresent( Inject.class)) { if (field.getGenericType() instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); final Class&lt;?&gt; rawType = (Class) parameterizedType.getRawType(); if (rawType.equals(EntityManager.class)) { final Class&lt;?&gt; typeArgument = (Class&lt;?&gt;) parameterizedType.getActualTypeArguments()[0]; beanFactory.registerSingleton(field.getName(), new EntityManager(typeArgument)); } } } } }); } } } private Class&lt;?&gt; getClass(String className) throws BeansException { if (className != null) { try { return Class.forName(className); } c…
has comment: http://stackoverflow.com/comment/39498650
upvote count: 3
answers question: http://stackoverflow.com/q/25331213
downvote count: 0
has comment: http://stackoverflow.com/comment/39667747
score: 3
has comment: http://stackoverflow.com/comment/39492080
type: Answer

http://stackoverflow.com/q/25352929
has title: Syntax Error: Import statement with multiple semi-colon
type: AnsweredQuestion
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/25352939
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25353048
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25352939
has comment: http://stackoverflow.com/comment/39528671
has body: This might be a weird question, but a valid one. I know below statement does not have compilation error: ArrayList list = new ArrayList();;; //(with three `;` semi-colon) Okay now I have written below import statement: import java.util.ArrayList;;; (with three `;` semi-colon) But I got below compilation error: Syntax error on token ";", invalid StaticImportOnDemandDeclarationName Why?
possible better answer: http://stackoverflow.com/a/25353048
upvote count: 1

http://stackoverflow.com/q/25366480
has body: i would try to change the system recent app layout in a custom rom. Actually, in android stock, we have a simple vertical scrollable column with recent apps.. I would change it and make a gridview like LG --> http://www.androidcentral.com/sites/androidcentral.com/files/styles/large_wm_brw/public/article_images/2014/07/task-switchers.jpg?itok=DQwWAMpQ it's not so easy and i need help.. i have some question; 1) Change the xml only is enought? 2) Have i to change the adapter too in java or something else in java code? The xml is this one: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.android.systemui.recent.RecentsPanelView android:id="@id/recents_root" android:layout_width="fill_parent" android:layout_height="fill_parent" android:foreground="@drawable/bg_protect" systemui:recentItemLayout="@layout/status_bar_recent_item" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"&gt; &lt;FrameLayout android:id="@id/recents_bg_protect" android:background="@drawable/status_bar_recents_background" android:fitsSystemWindows="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true"&gt; &lt;com.android.systemui.recent.RecentsVerticalScrollView android:layout_gravity="top|left|center" android:id="@id/recents_container" android:scrollbars="none" android:fadingEdge="vertical" android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stackFromBottom="true" android:divider="@null" android:layout_marginEnd="0.0dip"&gt; &lt;LinearLayout android:id="@id/recents_linear_layout" android:fitsSystemWindows="true" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/com.android.systemui.recent.RecentsVertic…
favorite count: 0
has title: Change recent layout android
type: Question
tagged with: gridview
tagged with: android-framelayout
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
upvote count: 1
tagged with: android
tagged with: java
tagged with: android-recents

http://stackoverflow.com/q/25244719
tagged with: reflection
tagged with: java
downvote count: 2
answer count: 1
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/25245043
has comment: http://stackoverflow.com/comment/39328951
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/39329070
has title: Issue with using an object created via reflection
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39329452
has comment: http://stackoverflow.com/comment/39329118
has body: I am trying to write a program that can be used to send messages to a set of subscribers. The subscribers and technology used to deliver the messages is not important. The message types are defined by an XML schema and are implemented as a Java API. There is an abstract super-type that all message types extend. The API defines static methods to allow for conversion between XML and Java and vice versa (fromXML() and toXML()). I am having difficulties implementing this. I have included a sample of the code I am trying to get to work below. It does not compile as written. The abstract super-type is the MessageType class and my plan is to pass in the name of the "real" message type and have this code create the necessary objects to do what is needed to send a message of the specified sub-type. public class Writer { public static void runExample(String[] args) throws Exception { UUID serviceID = UUID.fromString(args[1]); ServiceBus bus = ServiceBus.getServiceBus(); bus.init(serviceID); // The intention is to pass the message type name so that this code can be used for any // "message" type. String msgName = args[0]; // Get the message type class from the passed name. Class&lt;? extends MessageType&gt; msgClass = (Class&lt;? extends MessageType&gt;) Class.forName(msgName); // Create a writer for the specified message type. MessageWriter&lt;? extends MessageType&gt; writer = bus.createWriter(msgName, msgClass); // Read in some XML content from a file. String xml = loadMsg(args[2]); // Want to do something like this: msgClass object = msgClass.fromXML(xml); // Of course, this does not compile. Is there a way to do this? // Create a java object of the message type from the XML read in. MessageType object = MessageType.fromXML(xml); // With the line above the statement below fails to compile with the error: // The method write(capture#4-of ? extends MessageType) in the type // MessageWriter&lt;capture#4-of ? extends MessageType&gt; is not applicable for // the arguments (Mess…
has comment: http://stackoverflow.com/comment/39329230

http://stackoverflow.com/comment/39431280
type: Comment
score: 0
has text: are you already updated to java 8?
type: QuestionComment
comment on: http://stackoverflow.com/q/25299749

http://stackoverflow.com/comment/39486716
type: Comment
type: QuestionComment
score: 0
has text: see how many `final` methods you can find in the JDK, then decide if you think it's a good idea.
comment on: http://stackoverflow.com/q/25329340

http://stackoverflow.com/comment/39322317
has text: For build to stop as your test fails just make use of mvn clean install in your command prompt ,this will result in build failure if any of your test fails.
type: Comment
comment on: http://stackoverflow.com/a/25241207
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39425727
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25296615
has text: The Spring 2.5.6 documentation of HibernateTemplate already advised to avoid the usage of HibernateTemplate completely.
type: Comment

http://stackoverflow.com/comment/39334063
score: 0
comment on: http://stackoverflow.com/q/25247164
type: QuestionComment
type: Comment
has text: @KevinPanko - possibly, but the one you linked to doesn't provide any quality answers.

http://stackoverflow.com/a/25359636
type: Answer
has comment: http://stackoverflow.com/comment/39544845
score: 0
has body: Check HTTP requests to confirm that you have percent encoded characters in you HTTP requests. IE9 has a problem with percent encoded characters in URL. KB article explaining it is by design. Blog post explaining how does URI mechanism work at older Windows platform. I wasn't able to find a solution for it. I had option to not to use encoding of URL requests to BIRT. I bypassed problem converting characters which needed encoding in something I understand and then replacing those converted character in BIRT script to its original value.
has comment: http://stackoverflow.com/comment/39542745
answers question: http://stackoverflow.com/q/25359103

http://stackoverflow.com/a/25240962
answers question: http://stackoverflow.com/q/25240899
has body: You can use gitlog to create a history of committed changes. You can set since and until parameters to specify a date range. http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History $ git log
score: 0
type: Answer

http://stackoverflow.com/comment/39576162
has text: *I am looking for a way which doesn't iterate through each element of fields* - Not possible because you have an array to work on and you need to check each element and compare it against "sumUp.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25378144
type: Comment

http://stackoverflow.com/q/25375647
possible better answer: http://stackoverflow.com/a/47027588
has body: I have a try block which handles quite a few file opening/closing/reading/writing (more than one file). It looks like: try { // commands } catch (IOException e) { System.err.println("Error: " + e); } The main problem is that e.toString() does not contain information about the filename for which the exception was thrown, if there is an error. I could check each read/write/open/close operation separately, and then know which file the error happens with, but that seems to defeat the purpose of having the elegant try-catch structure. Is there any other way out? I just want to be able to print the file name for which e had the error in the try block. EDIT: Maybe I should make it clear in which scenario this issue arises. This happens when I parse command-line arguments, input/output files, etc. I pass the file names to various functions and methods that can return with an IO error. It seems reasonable to require that I would have a generic way of handling any file problem by printing the error and the filename that had that error. I understand that IOException is more broad than handling IO with files, but surely it makes sense, given that IOException is a specialized exception class, to have a method that returns the IO source for which the error occurred.
has comment: http://stackoverflow.com/comment/39571688
has comment: http://stackoverflow.com/comment/39571836
favorite count: 0
has answer: http://stackoverflow.com/a/47027588
type: Question
upvote count: 2
has title: how to get the filename of a thrown IOException in java?
has answer: http://stackoverflow.com/a/25376867
has comment: http://stackoverflow.com/comment/39571723
accepted answer: http://stackoverflow.com/a/25376867
type: AnsweredQuestion
score: 0
tagged with: ioexception
has comment: http://stackoverflow.com/comment/39571748
answer count: 2
downvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39648783

http://stackoverflow.com/q/25260939
linked to: http://stackoverflow.com/q/412772
linked to: http://stackoverflow.com/q/10489191
answer count: 1
tagged with: wsdl
has comment: http://stackoverflow.com/comment/102320289
has comment: http://stackoverflow.com/comment/39517596
linked to: http://stackoverflow.com/q/7284126
has comment: http://stackoverflow.com/comment/39502168
upvote count: 28
favorite count: 0
score: 28
has title: SOAP Encoding is not supported
has comment: http://stackoverflow.com/comment/60784404
has answer: http://stackoverflow.com/a/43999833
has comment: http://stackoverflow.com/comment/39507796
tagged with: java
tagged with: soap
has body: I have WSDL url like with below format and that seems is correct. After using wsimport in terminal for parse that I get an error: Run from terminal: tux-world@alachiq:~/Desktop/Project/java > wsimport -keep -s wsdl/ example.com/wsdl/wsdl.php?wsdl parsing WSDL... [ERROR] "Use of SOAP Encoding is not supported. SOAP extension element on line 59 in example.com/wsdl/wsdl.php?wsdl has use="encoded" " Failed to parse the WSDL. WSDL for Parse: <?xml version="1.0" encoding="ISO-8859-1"?> <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:tsmswsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:tsmswsdl"> <xsd:schema targetNamespace="urn:tsmswsdl" > <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> <xsd:complexType name="outGetMessages"> <xsd:complexContent> <xsd:restriction base="SOAP-ENC:Array"> <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema> <part name="user" type="xsd:string" /> <part name="pass" type="xsd:string" /> <part name="idend" type="xsd:int" /> <part name="count_request" type="xsd:int" /> <part name="return" type="tns:outGetMessages" /> <part name="user" type="xsd:string" /> <part name="pass" type="xsd:string" /> <part name="return" type="tns:outGetMessages" /> <part name="user" type="xsd:string" /> <part name="pass" type="xsd:string" /> <part name="sms_number" type="xsd:string" /> <part name="mobile" type="xsd:string" /> <part name="msg" type="xsd:string" /> <part name="send_date" type="xsd:string" /> <part name="return" type="tns:outGetMessages" /> Get specific user info Get specific us…
has comment: http://stackoverflow.com/comment/39360570
type: Question
has comment: http://stackoverflow.com/comment/71465364
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39330243
comment on: http://stackoverflow.com/q/25245448
type: QuestionComment
has text: "It is showing error" is *never* enough information. What error, and where?
type: Comment
score: 2

http://stackoverflow.com/a/25286105
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39405352
has body: ArrayStoreException is Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. Object[] arr = new Object[2]; String input = "Boo;Foo;1000"; Integer somInt = new Integer(0); arr = input.split(";", -1); somInt = Integer.parseInt(arr[2].toString()); arr[2] = ""+somInt; //storing non string value will give error for (int i = 0; i &lt; arr.length; i++) { System.out.println(arr[i]); }
type: Answer
answers question: http://stackoverflow.com/q/25285572

http://stackoverflow.com/comment/39436131
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25292485
has text: @GPI Thanks for your reply. Yes, I've seen that and that's not what I'm looking for (I edited my post and it's title). Security header was just an example, my service uses one more custom header (eb:MessageHeader). And again, I have corresponding schema compiled to Java class, but I'm not able to insert it into the message. `Wss4jSecurityInterceptor` is just another way of creating header from scratch, while I have fully composed object I want to insert into header.
score: 0

http://stackoverflow.com/comment/39316446
type: QuestionComment
comment on: http://stackoverflow.com/q/25237914
type: Comment
has text: But cant get the array ,it display the values as zero
score: 0

http://stackoverflow.com/q/25321724
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39476335
has comment: http://stackoverflow.com/comment/39472040
tagged with: java
answer count: 1
tagged with: mysql
has body: Trying to make two comboboxes work together but... right now my first combo box is giving me error... I tried to make code changes but nothing much happened. cbArea = new javax.swing.JComboBox(); cbArea.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N cbArea.setModel(new javax.swing.DefaultComboBoxModel()); try { Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/database", "user", "passwd"); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("select area_name from area"); while (rs.next()) { cbArea.addItem(rs.getString("area_name")); } if (con != null) con.close(); if (stmt != null) stmt.close(); if (rs != null) rs.close(); } catch (Exception ex) { System.out.println(ex); } cbArea.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cbAreaItemStateChanged(evt); } }); cbArea.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbAreaActionPerformed(evt); } }); It gives me error as java.sql.SQLException: After end of result set What to do?
type: Question
tagged with: jdbc
has title: java.sql.SQLException: After end of result set
has answer: http://stackoverflow.com/a/25321860
accepted answer: http://stackoverflow.com/a/25321860

http://stackoverflow.com/a/54159592
answers question: http://stackoverflow.com/q/25333711
downvote count: 0
score: 7
upvote count: 7
has body: If you're looking for short answer: In the case of using java.util.Date, Java doesn't really know how to directly relate to SQL types. This is when @Temporal comes into play. It's used to specify the desired SQL type. Source: Baeldung
type: Answer

http://stackoverflow.com/comment/39596173
comment on: http://stackoverflow.com/a/25295200
has text: This pointed me to the right direction. I used a `BeanDefinitionRegistryPostProcessor` to create proxy bean definitions and mark the real implementations as not being candidates for autowiring. Thanks
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/73572452
score: 1
type: Comment
has text: Recently the source code miner powering Eclipse Code Recommenders has been released as part of an Eclipse IDE Tool Suite [1]. With that you can analyze any source code stored in your local Eclipse Workspace. There is also an enterprise server available that is suitable to analyze arbitrary Maven or P2 code repositories. With that, building models for any library (and sharing its models) seems possible. [1] https://ctrlflow.com/insights/enterprise/.
type: AnswerComment
comment on: http://stackoverflow.com/a/25339091

http://stackoverflow.com/q/25329306
has answer: http://stackoverflow.com/a/25329450
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: algorithm
tagged with: java
has body: i am writing program on extension of prim's algorithm in java. i am using the code from the following book Algorithms, 4th Edition. My problem is as follow: in the running time the for loop to read all the edges does not loop until the last one, it only read the first line After running the program i got the following result and error: 0 0.71000 1 0.46000 2 0.80000 3 0.36000 4 0.26000 5 0.57000 6 0.68000 7 0.85000 16 0 4 5 0.35 4-5 0.35000 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at EdgeWeightedGraph.addEdge(EdgeWeightedGraph.java:207) at EdgeWeightedGraph.<init>(EdgeWeightedGraph.java:152) at PrimMST.main(PrimMST.java:174) here is the file. Thanks import java.util.*; import java.io.*; public class EdgeWeightedGraph { private final int V; //private double VertexCost; private int E; //private int degree; private Bag<Edge>[] adj; private ArrayList<Vertex> vertex; //private ArrayList<Edge>[] adj; /** * Initializes an empty edge-weighted graph with V vertices and 0 edges. */ public EdgeWeightedGraph( int V ) { //vertex = new ArrayList<Vertex>(); if (V < 0) throw new IllegalArgumentException("Number of vertices must be nonnegative"); //if (VertexCost < 0) throw new IllegalArgumentException("The cost of the vertices must be nonnegative"); this.V = V; // (Bag<Edge>[]) this.E = 0; adj = (Bag<Edge>[]) new Bag[V]; //vertex = new ArrayList<Vertex>(); for (int v = 0; v < V; v++) { adj[v] = new Bag<Edge>(); // System.out.println(adj[v]); } } /** * Initializes a random edge-weighted graph with V vertices and E edges. * param V the number of vertices * param E the number of edges */ public EdgeWeightedGraph(int V, int E) { this(V); if (E < 0) throw new IllegalArgumentException("Number of edges must be nonnegative"); // for (int j = 0; j < V; j++) { // double cost = Math.round(100 * Math.random()) / 100.0; //Vertex u = new Vertex(v,cost); //vertex.add(u); //} for (int i = 0; i < E; i++) { int v = (int) (Math.random() * V); int w = (int) (Math.random() …
has comment: http://stackoverflow.com/comment/39486375
score: -1
upvote count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
answer count: 1
downvote count: 1
has title: “Exception in thread ”main“ java.Lang.NullPointerException” Error

http://stackoverflow.com/a/25289868
answers question: http://stackoverflow.com/q/25272433
has body: Bill, If you've not seen it already this post: http://dontpanic82.blogspot.com/2012/06/multi-value-fields-and-beans-in-xpages.html Has good information on Java Beans and multi Value fields. As info here is some code PIECES I'm currently using in my beans for working with multi-value. Note though that I'm using the OpenNTF API which makes things a little easier. the multi-value field that I'm working with is called "categoryAdmins". Again - the blog post might be of more interest since you're not using the API currently. good Luck. Dave private List&lt;String&gt; categoryAdmins; this.categoryAdmins = new ArrayList&lt;String&gt;(); /** * Get the Multi-Value Field Category Admins * * @return */ public Object getCategoryAdmins() { if (null == this.categoryAdmins) { this.categoryAdmins = new ArrayList&lt;String&gt;(); } return this.categoryAdmins; } /** * Translate the Category Admins to a Vector for saving back to Multi-Value * Field * * @param inputMulti */ public void setCategoryAdmins(Object inputMulti) { this.categoryAdmins = UtilStrings.getVectorizedStrings(inputMulti); } // Load from document - Note Using OpenNTF API this.categoryAdmins = lookupDoc.getItemValue("categoryAdmins", ArrayList.class); // Save back to document lookupDoc.replaceItemValue("categoryAdmins", this.categoryAdmins);
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39425239
has comment: http://stackoverflow.com/comment/39426248

http://stackoverflow.com/q/25298169
has answer: http://stackoverflow.com/a/25298428
has comment: http://stackoverflow.com/comment/39428674
type: AnsweredQuestion
answer count: 2
downvote count: 0
has body: I have looked for a bit, trying to find the answer to my question, but I haven't found anything. I am programming in Java, and I was wondering if there was an efficient way to take the user's input and compare with a number of possible outputs. I would then like the program to execute code depending on the Input. I know you are able to do switch() if(){ as well as do AND or OR in an if(){ statement. I am trying to avoid doing an if(){ statement with a bunch of }else if{ statement as well as AND / ORs in an if(){ statement. I was just wondering if a switch() would be the way to go, or if there was a more efficient way of doing that. EDIT: I haven't written anything yet. I was just wondering. If the question is too vague, don't worry. I was just curious. Thanks again! Thanks, ~Rane
upvote count: 1
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25298595
possible better answer: http://stackoverflow.com/a/25298428
favorite count: 0
has title: How to Efficiently Comparing User Input with multiple Output Scenario in Java
tagged with: user-input
type: Question
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25298595
has comment: http://stackoverflow.com/comment/39428780

http://stackoverflow.com/q/25251168
linked to: http://stackoverflow.com/q/19102000
score: 1
tagged with: java
has title: Converting a simple Applet GUI from Swing to JavaFX
accepted answer: http://stackoverflow.com/a/25269960
type: Question
possible better answer: http://stackoverflow.com/a/25267913
answer count: 2
has answer: http://stackoverflow.com/a/25269960
tagged with: javafx
downvote count: 0
has comment: http://stackoverflow.com/comment/39342992
upvote count: 1
has comment: http://stackoverflow.com/comment/39342054
tagged with: applet
tagged with: swing
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25267913
has body: I am trying to create an applet that will replace a confusing CLI with a nice JavaFX GUI. I don't have extensive experience with GUI design and most of what we learned in the classroom environment was Swing/AWT. Having toyed a little bit with JavaFX, I feel that it has already shown to be far better, however there aren't many good tutorials/articles out there about creating JavaFX programs intended to run as applets. Right now I can't even seem to convert the following simple login UI from Swing to JavaFX. import java.applet.Applet; import java.awt.*; import javax.swing.*; public class ACLEditor extends Applet { public void init() { /* Basic Layout */ setLayout(new GridLayout(5, 2)); /* Components */ JLabel username_l = new JLabel("Username:"); JTextField username = new JTextField("", 10); JLabel password_l = new JLabel("Password:"); JPasswordField password = new JPasswordField("", 10); JLabel hostname_l = new JLabel("Hostname:"); JTextField hostname = new JTextField("0.0.0.0", 10); JButton connect_btn = new JButton("Connect"); /* Place all Controls on the Layout */ add(username_l); add(username); add(password_l); add(password); add(hostname_l); add(hostname); add(connect_btn); } } Any help on this would be appreciated. Note: I do understand how to create a JavaFX UI for a standalone application, I just can't seem to grasp how to make it into an applet

http://stackoverflow.com/comment/39384140
type: AnswerComment
comment on: http://stackoverflow.com/a/25252146
has text: I'd be interested in hearing about different approaches to looking up type information for query string fields. The FHIR spec defines some 400 search fields across all its Resources. Having to check the type for each field would be laborious if that information had be separately encoded in some way. My inclination is to use FHIR's XML schemas to lookup up the type information on the fly. This should avoid having to enumerate in advance type information for each possible key.
type: Comment
score: 0

http://stackoverflow.com/q/25277683
type: UnansweredQuestion
score: 0
tagged with: birt
tagged with: java
has body: I designed report by BIRT on eclipse and I can run it from run button how can I run it be java code?
answer count: 1
has comment: http://stackoverflow.com/comment/39577746
tagged with: eclipse
has title: How to run BIRT reports in a java application?
type: Question
has answer: http://stackoverflow.com/a/25322605

http://stackoverflow.com/q/25234797
tagged with: eclipse
has answer: http://stackoverflow.com/a/25254487
favorite count: 0
type: Question
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/25237561
has body: When I go to open eclipse, it gives me a run time error saying that the path to the JDK is not right. I have no idea where to save the link so that i can get it to open
has comment: http://stackoverflow.com/comment/39315107
answer count: 2
has title: where and how do i save the jdk link so that eclipse will open?
tagged with: java

http://stackoverflow.com/comment/39587966
has text: @ElliottFrisch I am not looking for RPC/ESB method, but a JAVA API so that C++ can call in its program. The call should be just one line, more like a function call with pass-in parameters and return value.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25374325

http://stackoverflow.com/comment/100790919
has text: The link provided seems to require an account. Are you in a position to update this with any new developments?
comment on: http://stackoverflow.com/a/26648627
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25370501
tagged with: java
has answer: http://stackoverflow.com/a/25370833
downvote count: 0
has title: Java method not continuing past while loop
has answer: http://stackoverflow.com/a/25371070
has comment: http://stackoverflow.com/comment/39563709
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39563854
has comment: http://stackoverflow.com/comment/39565063
has comment: http://stackoverflow.com/comment/39562111
has comment: http://stackoverflow.com/comment/39561880
tagged with: while-loop
possible better answer: http://stackoverflow.com/a/25371070
linked to: http://stackoverflow.com/q/20816555
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39561775
has body: When I run this code, the lines after the while loop are never executed. I've done testing inside the loop itself, and as far as i can tell the loop itself is completing, the method just never moves on to the following line. I am aware there are multiple similar topics, but most seem to reference proper string comparisons and infinite loops. Example input for this would be: Maria 1 2 3 4 Output should be: Maria's GPA is 2.50. Any help would be appreciated. public static void printGPA(){ Scanner console = new Scanner(System.in); String studentName = ""; int counter = 0; int gpa = 0; System.out.print("Enter a student record: "); while (console.hasNext()){ if (console.hasNextInt()){ gpa += console.nextInt(); counter += 1; } else { studentName = console.next(); } } System.out.print(studentName + "'s GPA is "); System.out.printf("%.2f.", ((double)gpa / (double)counter)); }
has answer: http://stackoverflow.com/a/25371386
accepted answer: http://stackoverflow.com/a/25370833
upvote count: 2
has answer: http://stackoverflow.com/a/25371095

http://stackoverflow.com/comment/39569237
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25374128
has text: From the very brief test i did it seemed this has done the trick. Thank you.

http://stackoverflow.com/q/25270240
tagged with: awt
has comment: http://stackoverflow.com/comment/39376869
type: Question
tagged with: abstract-class
has title: Class is not abstract and does not override abstract method AWT Program
accepted answer: http://stackoverflow.com/a/25270278
has comment: http://stackoverflow.com/comment/39376501
tagged with: java
has answer: http://stackoverflow.com/a/25270278
has comment: http://stackoverflow.com/comment/39376493
type: AnsweredQuestion
score: 0
tagged with: compiler-errors
possible better answer: http://stackoverflow.com/a/25270500
answer count: 3
tagged with: user-interface
has answer: http://stackoverflow.com/a/25270500
has answer: http://stackoverflow.com/a/51090969
has comment: http://stackoverflow.com/comment/39414299
has body: import java.awt.*; import java.awt.event.*; public class QuadraticSolver extends Frame implements ActionListener, WindowListener { private TextField tfX2; private TextField tfX; private TextField tfNum; private TextField tfVal1; private TextField tfVal2; private TextField tfRoots; private Label lblX2; private Label lblX; private Label lblNum; private Label lblVal1; private Label lblVal2; private Label lblRoots; private Button btnCheckRoots; private Button btnCalc; private Button btnClear; double a = 0, b = 0, c = 0; double Val1 = 0, Val2 = 0, Discriminant = 0; String StrVal1, StrVal2; public QuadraticSolver() { Panel panelX2Comp = new Panel(new FlowLayout()); { lblX2 = new Label("Enter Co-Efficient Of X^2:"); panelX2Comp.add (lblX2); tfX2 = new TextField("", 20); tfX2.setEditable(true); panelX2Comp.add(tfX2); } Panel panelXComp = new Panel(new FlowLayout()); { lblX = new Label("Enter Co-Efficient Of X:"); panelXComp.add(lblX); tfX = new TextField("", 20); tfX.setEditable(true); panelXComp.add(tfX); } Panel panelNumComp = new Panel(new FlowLayout()); { lblNum = new Label("Enter Number:"); panelNumComp.add(lblNum); tfNum = new TextField("", 20); tfNum.setEditable(true); panelNumComp.add(tfNum); } Panel panelButtons = new Panel(new FlowLayout()); { btnCalc = new Button("Calculate"); btnCalc.setEnabled(false); panelButtons.add(btnCalc); { btnCalc.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { a = Double.parseDouble(tfX2.getText()); b = Double.parseDouble(tfX.getText()); c = Double.parseDouble(tfNum.getText()); Val1 = (-b + Math.sqrt(Discriminant)) / (2 * a); Val2 = (-b - Math.sqrt(Discriminant)) / (2 * a); StrVal1 = String.valueOf(Val1); StrVal2 = String.valueOf(Val2); tfVal1.setText(StrVal1); tfVal2.setText(StrVal2); tfX2.setText(""); tfX.setText(""); tfNum.setText(""); btnCalc.setEnabled(false); } } ); } btnCheckRoots = new Button("Nature Of Roots"); panelButtons.add(btnCheckRoots); { btnCheckRoots.addActionListener(new…

http://stackoverflow.com/q/25374941
possible better answer: http://stackoverflow.com/a/25375385
answer count: 5
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39570814
has answer: http://stackoverflow.com/a/25376281
type: Question
has comment: http://stackoverflow.com/comment/39570427
has title: Async task crashing during doInBackground()
has answer: http://stackoverflow.com/a/25375036
has comment: http://stackoverflow.com/comment/39570298
has body: I am having a problem with my android app that i'm trying to develo,apparently it crushes when it's to execute doInBackground,my logcat looks like this: 08-19 04:40:57.046: D/request!(4766): starting 08-19 04:40:57.125: W/dalvikvm(4766): threadid=9: thread exiting with uncaught exception (group=0x40018578) 08-19 04:40:57.132: E/AndroidRuntime(4766): FATAL EXCEPTION: AsyncTask #1 08-19 04:40:57.132: E/AndroidRuntime(4766): java.lang.RuntimeException: An error occured while executing doInBackground() 08-19 04:40:57.132: E/AndroidRuntime(4766): at android.os.AsyncTask$3.done(AsyncTask.java:200) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.FutureTask.setException(FutureTask.java:125) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.FutureTask.run(FutureTask.java:138) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) 08-19 04:40:57.132: E/AndroidRuntime(4766): at java.lang.Thread.run(Thread.java:1019) 08-19 04:40:57.132: E/AndroidRuntime(4766): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. 08-19 04:40:57.132: E/AndroidRuntime(4766): at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:577) 08-19 04:40:57.132: E/AndroidRuntime(4766): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:292) 08-19 04:40:57.132: E/AndroidRuntime(4766): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 08-19 04:40:57.132: E/AndroidRuntime(4766): at org.…
has comment: http://stackoverflow.com/comment/39571706
has answer: http://stackoverflow.com/a/25375522
has answer: http://stackoverflow.com/a/25375862
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25375036
score: 0
has comment: http://stackoverflow.com/comment/39570318
has comment: http://stackoverflow.com/comment/39570381
has comment: http://stackoverflow.com/comment/39570276
has answer: http://stackoverflow.com/a/25375385

http://stackoverflow.com/q/25254852
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25254892
answer count: 2
has title: how arrayDeque.peek() Method in java working with while loop
has comment: http://stackoverflow.com/comment/39348579
has comment: http://stackoverflow.com/comment/39348445
has comment: http://stackoverflow.com/comment/39348546
has comment: http://stackoverflow.com/comment/39348425
type: Question
has comment: http://stackoverflow.com/comment/39348537
has answer: http://stackoverflow.com/a/54810753
tagged with: java
has comment: http://stackoverflow.com/comment/39348453
has comment: http://stackoverflow.com/comment/39348904
has comment: http://stackoverflow.com/comment/39348484
possible better answer: http://stackoverflow.com/a/54810753
accepted answer: http://stackoverflow.com/a/25254892
has body: import java.util.ArrayDeque; class Main { public static void main(String[] args) { ArrayDeque&lt;Integer&gt; arrayDeque = new ArrayDeque&lt;&gt;(); arrayDeque.push(10); arrayDeque.push(11); arrayDeque.push(15); arrayDeque.push(20); arrayDeque.push(200); arrayDeque.add(700); while (arrayDeque.peek() != null) { System.out.println(arrayDeque.pop() + " "); } } } Good Day .. I have a question regarding the peek() method in ArrayDeque Class .. all the method will do is retrieve the head of the arrayDeque without removing it. so if that is the case how it's working perfectly without going for an infinite loop .. I mean who told the Method to look for the Next element after each complete loop.

http://stackoverflow.com/comment/39305328
has text: It's not clear to me what the problem is you're describing. From looking at the code it should print two lines, just like you say it should. Can you show us exactly the output you're receiving?
type: QuestionComment
score: 5
comment on: http://stackoverflow.com/q/25232318
type: Comment

http://stackoverflow.com/comment/73367639
has text: but if services are catching exceptions ? . Am I correct here "if one transaction is active then in case of another service with `@Transaction` will reuse it" ?. So wouldn't there be any way of making transaction failure cascading
type: Comment
comment on: http://stackoverflow.com/a/42899742
type: AnswerComment
score: 0

http://stackoverflow.com/q/25367120
has comment: http://stackoverflow.com/comment/39555080
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25367341
has title: example EBCDIC file for Java program to convert EBCDIC to ASCII
has comment: http://stackoverflow.com/comment/39555175
upvote count: 1
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26037785
tagged with: ebcdic
has answer: http://stackoverflow.com/a/26037785
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25367341
has comment: http://stackoverflow.com/comment/39554917
has body: I am trying to convert EBCDIC file to ASCII using following code : InputStreamReader rdr = new InputStreamReader(new FileInputStream(&lt;your file&gt;),java.nio.Charset.forName("ibm500")); while((String line = rdr.readLine()) != null) { System.out.println(line); I am trying to find a sample file in EBCDIC format to send it as an input to this program. Can anyone please point me to a sample file. can't find anything online.
answer count: 2

http://stackoverflow.com/q/25268312
has answer: http://stackoverflow.com/a/25268385
accepted answer: http://stackoverflow.com/a/25268385
tagged with: java
has comment: http://stackoverflow.com/comment/39380496
score: -1
has title: Difference between JVM, server/jvm.dll file and Java HotSpot VM both client and server versions
linked to: http://stackoverflow.com/q/16568253
downvote count: 2
tagged with: jvm-hotspot
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/8503327
has comment: http://stackoverflow.com/comment/39372665
linked to: http://stackoverflow.com/q/198577
tagged with: virtual-machine
has comment: http://stackoverflow.com/comment/39372738
favorite count: 0
type: Question
type: AnsweredQuestion
has body: Can someone please explain me the difference between JVM, server\jvm.dll file and Java HotSpot VM. I have already studied jvm.dll file from Difference between java.exe, javaw.exe and jvm.dll and HotSpot from Difference between JVM and HotSpot? Real differences between "java -server" and "java -client"? http://www.oracle.com/technetwork/java/whitepaper-135217.html#solid but still didn't understand the concept. Please give a simple and clear explanation.

http://stackoverflow.com/q/25384063
has body: I have a program that prints the ArrayList in java. The ArrayList should retain the order of insertion right? import java.util.*; class Generator { String[] s = { "snow", "white", "and", "the", "seven", "dwarfs" }; String s1; static int i = 0; String next() { s1 = s[i]; i++; if (i == s.length) { i = 0; } return s1; } public static void main(String[] args) { Collection&lt;String&gt; al = new ArrayList&lt;String&gt;(); // Collection&lt;String&gt; ll=new LinkedList&lt;String&gt;(); Generator g = new Generator(); for (int i = 0; i &lt; 10; i++) { al.add(g.next()); // ll.add(g.next()); } System.out.println(al); // System.out.println(ll); } } with the LinkedList object stuff commented, I am getting right output [snow, white, and, the, seven, dwarfs, snow, white, and, the] but when I uncomment the LinkedList code I am getting output as: [snow, and, seven, snow, and, seven, snow, and, seven, snow] [white, the, dwarfs, white, the, dwarfs, white, the, dwarfs, white] Can anyone please explain me this behavior? I am confused.
has answer: http://stackoverflow.com/a/25384138
tagged with: java
has answer: http://stackoverflow.com/a/29381971
has answer: http://stackoverflow.com/a/25384143
answer count: 4
type: Question
has title: Java ArrayList behaving differently
has answer: http://stackoverflow.com/a/25384110
has comment: http://stackoverflow.com/comment/39587160
type: UnansweredQuestion
tagged with: collections
score: 0

http://stackoverflow.com/a/25311241
has comment: http://stackoverflow.com/comment/39472011
type: Answer
downvote count: 0
upvote count: 1
has body: i had same issue. After a long search in google i found a solution in Google's Android Developer documents. if you are using version 4.2+ of android you have to add a prefix to your urls. You can add it server side or you can add: String convertedHtml = yourHtmlString.replace("&lt;a href=\"#", "&lt;a href=link:\""); Than you can override and check your link: webView.setWebViewClient(new WebViewClient() { // Override URL @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { //Log.e("url:", url); if (url.startsWith("link:")) { // do what you want return true; } } } I hope this will help you.
answers question: http://stackoverflow.com/q/25310598
has comment: http://stackoverflow.com/comment/39452570
score: 1

http://stackoverflow.com/a/25282894
score: 0
accepted answer of: http://stackoverflow.com/q/25271159
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25271159
type: Answer
has body: As you see in the example you referenced, direct drawing functions must be called after drawing the component, preferably in AfterDraw/chartPainted event. The following code works fine for me here: tChart1.addChartPaintListener(new ChartPaintAdapter() { @Override public void chartPainted(ChartDrawEvent e) { Axis leftAxis = tChart1.getAxes().getLeft(); TextShape label = new TextShape(tChart1.getChart()); leftAxis.drawAxisLabel(leftAxis.getPosition(), leftAxis.calcPosValue(500), 0, "CLOSE", label); } });

http://stackoverflow.com/comment/39311336
type: AnswerComment
has text: master @MadProgrammer sorry I don't know how to thread what should I do? because my previous programs I only `connect2Server` when I send files, now I have to `connect2Server` every second to determine if I lost or connected to the server.
comment on: http://stackoverflow.com/a/25234710
type: Comment
score: 0

http://stackoverflow.com/q/25261690
has comment: http://stackoverflow.com/comment/39391268
tagged with: jetty
accepted answer: http://stackoverflow.com/a/25636763
has comment: http://stackoverflow.com/comment/39363610
has answer: http://stackoverflow.com/a/25636763
has body: We are facing this issue in production environment but unable to track it out. Technology: JSP/Servlets, Jetty Server Version: jetty-distribution-8.1.15, Following is exception, what we are getting in Jetty Logs: 2014_08_10.stderrout.log.05300: SEVERE: PWC6117: File "%2Ftmp%2Fjetty-0.0.0.0-8090-ExpireApp.war-_ExpireApp-any-%2Fwebapp%2FExpiry.jsp" not found The application worked fine before but end users are unable to access .jsp file and we need a restart for the same but we want to get it resolved. Please help
has answer: http://stackoverflow.com/a/25297214
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/34761780
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/25297214
favorite count: 0
has title: SEVERE: PWC6117: File not found - Jetty
type: Question

jakarta-ee
tags question: http://stackoverflow.com/q/25244221
tags question: http://stackoverflow.com/q/25246022
tags question: http://stackoverflow.com/q/25257507
tags question: http://stackoverflow.com/q/25245773
tags question: http://stackoverflow.com/q/25232462
tags question: http://stackoverflow.com/q/25245421
tags question: http://stackoverflow.com/q/25332393
tags question: http://stackoverflow.com/q/25244539
tags question: http://stackoverflow.com/q/25250119
type: Tag
tags question: http://stackoverflow.com/q/25261775
tags question: http://stackoverflow.com/q/25246493
tags question: http://stackoverflow.com/q/25232550
tags question: http://stackoverflow.com/q/25252220
tags question: http://stackoverflow.com/q/25237111
tags question: http://stackoverflow.com/q/25352751
tags question: http://stackoverflow.com/q/25367055
tags question: http://stackoverflow.com/q/25243418
tags question: http://stackoverflow.com/q/25362684
tags question: http://stackoverflow.com/q/25377474
tags question: http://stackoverflow.com/q/25282983
tags question: http://stackoverflow.com/q/25256768
tags question: http://stackoverflow.com/q/25309293
tags question: http://stackoverflow.com/q/25257801
tags question: http://stackoverflow.com/q/25247689
tags question: http://stackoverflow.com/q/25342264
tags question: http://stackoverflow.com/q/25275909
tags question: http://stackoverflow.com/q/25257022
tags question: http://stackoverflow.com/q/25258969
tags question: http://stackoverflow.com/q/25284078
tags question: http://stackoverflow.com/q/25333337
tags question: http://stackoverflow.com/q/25375650
tags question: http://stackoverflow.com/q/25327395
tags question: http://stackoverflow.com/q/25260490
tags question: http://stackoverflow.com/q/25300120
tags question: http://stackoverflow.com/q/25247958
tags question: http://stackoverflow.com/q/25295758
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25377301
tags question: http://stackoverflow.com/q/25338473
tags question: http://stackoverflow.com/q/25242287
tags question: http://stackoverflow.com/q/25247218
tags question: http://stackoverflow.com/q/25349189
tags question: http://stackoverflow.com/q/25338377
tags question: http://stackoverflow.com/q/25256670

http://stackoverflow.com/comment/39366006
has text: For which part? Do you have a `Response` class?
comment on: http://stackoverflow.com/a/25263366
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25272081
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25270191
upvote count: 2
has body: I would parse the entire XML document with StAX, then navigate the XMLStreamReader down to the Table element and use JAXB to unmarshal that. For More Information I have written more about this use case on my blog: http://blog.bdoughan.com/2012/08/handle-middle-of-xml-document-with-jaxb.html
type: Answer

http://stackoverflow.com/a/25248280
has body: You can have a function to check date validity like this: public static String DATE_FORMAT = "MM/dd/yyyy"; public static boolean isDateValid(String date) { try { DateFormat df = new SimpleDateFormat(DATE_FORMAT); df.setLenient(false); df.parse(date); return true; } catch (ParseException e) { return false; } } You can change DATE_FORMAT according to your needing (documentation). Then your main is: public static void main(String[] args) { System.out.println("Enter the date:"); Scanner scanner = new Scanner(System.in); String date = scanner.next(); if (isDateValid(date)) System.out.println("Valid date"); else System.out.println("Invalid date"); scanner.close(); }
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25248059
type: Answer

http://stackoverflow.com/q/25316683
accepted answer: http://stackoverflow.com/a/25316696
possible better answer: http://stackoverflow.com/a/25317013
has answer: http://stackoverflow.com/a/25316696
has answer: http://stackoverflow.com/a/25317013
type: AnsweredQuestion
score: 0
has title: How do I perform this arithmatic in a more elegant manner?
tagged with: java
has body: frequency = ((x * y)) / roomSize / roomSize How do I simplify the / roomSize / roomSize ?
type: Question
has comment: http://stackoverflow.com/comment/39462613
has comment: http://stackoverflow.com/comment/39462599
answer count: 2
has comment: http://stackoverflow.com/comment/39462651

http://stackoverflow.com/a/25366119
answers question: http://stackoverflow.com/q/25366009
type: Answer
downvote count: 0
upvote count: 1
has body: In copy method public static &lt;T&gt; void copy(List&lt;? super T&gt; dest, List&lt;? extends T&gt; src) { int srcSize = src.size(); if (srcSize &gt; dest.size()) throw new IndexOutOfBoundsException("Source does not fit in dest"); if (srcSize &lt; COPY_THRESHOLD || (src instanceof RandomAccess &amp;&amp; dest instanceof RandomAccess)) { for (int i=0; i&lt;srcSize; i++) dest.set(i, src.get(i)); } else { ListIterator&lt;? super T&gt; di=dest.listIterator(); ListIterator&lt;? extends T&gt; si=src.listIterator(); for (int i=0; i&lt;srcSize; i++) { di.next(); di.set(si.next()); } } } copy replace the value with index from index 0. public static &lt;T&gt; void copy(List&lt;? super T&gt; des,List&lt;? extends T&gt; scr){ for(T f : scr){ des.add(f); } } in this approach add into tail.
score: 1

http://stackoverflow.com/a/25312647
score: 5
type: Answer
downvote count: 0
has body: No. There is no ungreedy modifier in Java. You have to use ? behind modifiers to make the quantifiers as lazy capture. This means you should denote all quantifiers with a ?, see the following pattern: "parameter:\\s+?(.*?)\\s+?(result|client|user):" Specified by: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
answers question: http://stackoverflow.com/q/25312505
upvote count: 5

http://stackoverflow.com/comment/39554442
comment on: http://stackoverflow.com/a/25339411
has text: MIDI drivers don't buffer data (except for the 1 ms framing implied by the USB protocol).
type: Comment
score: 0
type: AnswerComment

jsoup
tags question: http://stackoverflow.com/q/25365022
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/25332240
tags question: http://stackoverflow.com/q/25367207
tags question: http://stackoverflow.com/q/25384534
tags question: http://stackoverflow.com/q/25321368
tags question: http://stackoverflow.com/q/25240594
tags question: http://stackoverflow.com/q/25349803
tags question: http://stackoverflow.com/q/25236886
tags question: http://stackoverflow.com/q/25362772
tags question: http://stackoverflow.com/q/25295943
tags question: http://stackoverflow.com/q/25298769
tags question: http://stackoverflow.com/q/25342591
tags question: http://stackoverflow.com/q/25293196
tags question: http://stackoverflow.com/q/25345146
tags question: http://stackoverflow.com/q/25286691

http://stackoverflow.com/q/25263565
type: Question
has body: Hi im trying to do a persist but looks like if one of the atributes never was set but, just before do the persist I print the value and is set. I´m working with postgrest My persist metod public void saveText(Document document){ sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.getCurrentSession(); System.out.println(document.getText()); System.out.println(document.getId()); try { session.beginTransaction(); session.persist(document); session.getTransaction().commit(); } catch (HibernateException e) { e.printStackTrace(); session.getTransaction().rollback(); } } My object to pesist import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import br.com.symsar.sysged.acessobd.AccesData; @Entity @ManagedBean @SessionScoped @Table(name = "documents", schema = "public") public class Document implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "\"id\"") private int id; @Column(name = "\"text\"") private String text; public void persist() { AccesData access = new AccesData(); access.saveText(this); } /** * @return the text */ public String getText() { return text; } /** * @param text * the text to set */ public void setText(String text) { this.text = text; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } Sql query showed by hibernate Hibernate: insert into public.documents ("id", "text") values (null, ?) This is the error: ERROR: ERRO: Null value in the column "id" violates not-null constraint
accepted answer: http://stackoverflow.com/a/25286883
has answer: http://stackoverflow.com/a/25286883
has answer: http://stackoverflow.com/a/25265488
type: AnsweredQuestion
score: 0
has title: Hibernate persist error, id field is null
tagged with: java
tagged with: hibernate
answer count: 3
has comment: http://stackoverflow.com/comment/39405271
possible better answer: http://stackoverflow.com/a/25263811
has comment: http://stackoverflow.com/comment/39368316
tagged with: postgresql
has answer: http://stackoverflow.com/a/25263811

http://stackoverflow.com/q/25286931
has comment: http://stackoverflow.com/comment/39408074
has title: Transitioning from SVN to Git (git-svn, multiple branches in workspace and no dependency management)!
tagged with: git
type: Question
has body: We are currently trying to pilot the transition from Git to SVN to increase production and collaboration within our team. However we are facing some issues with trasitioning and finding counterparts which currently work for us. I've been reading up on Git and can't seem to find a specific answer. Here are some issues: Our project is composed of several subprojects each built as a project of its own. How do we manage these subprojects with Git? One of the main issues I've encountered is when switching branches, I have to individually switch branches among I've read about Subproject support as mentioned in https://git.wiki.kernel.org/index.php/SubprojectSupport, but I've also read that this isn't supported by git-svn. We have multiple SVN branches currently, each representing a release. Most of us have all relevant branches (usually 2-3) checked out in our workspace. Switching branches might be okay if it's fast, but another problem is the configuration of our build paths &amp; etc (considering we don't have any dependency management system in place at our level of development and all are done manually). Is there a way to go around this in Git, either by allowing multiple branches active in a workspace, or through rapid switching? I'm not sure if there will be any specific correct answer, but pointing me to relevant resources will be helpful as well. Thank you.
tagged with: svn
has answer: http://stackoverflow.com/a/25400214
accepted answer: http://stackoverflow.com/a/25400214
has comment: http://stackoverflow.com/comment/39429218
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39529216
has text: @HotLicks: Yes, but then in *most* cases you'd still have a logically single-type collection. Most of the time you'd just unconditionally cast after calling `get`.
comment on: http://stackoverflow.com/a/25352921
type: AnswerComment
score: 3
type: Comment

http://stackoverflow.com/q/25241550
answer count: 1
downvote count: 0
tagged with: windows-services
accepted answer: http://stackoverflow.com/a/25242757
tagged with: jvm
has comment: http://stackoverflow.com/comment/39323061
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25242757
has body: I can install, uninstall and run my service as a console application using the Apache Commons Daemon tool. The problem is when I try to run my application as a service, the service status doesn't switch from stopped to running. Script used to install the service: prunsrv.exe install ServiceName --DisplayName="Some Display Name" --Classpath %cd%\daemon.jar --Install=prunsrv.exe --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=Main --StartParams start --StopClass=Main --StopParams stop I'm running the service in windows 8 - 64bits. Any ideas of what could be the problem? EDIT: When running the application in the services.msc and I get the following message: Windows could not start the [Service Name] service on Local Computer Error 2: The system cannot find the file specified. EDIT2: Tryed in Windows 7-64bits. Same problem.
linked to: http://stackoverflow.com/q/15543053
tagged with: java
has comment: http://stackoverflow.com/comment/39323212
score: 4
has comment: http://stackoverflow.com/comment/39323041
has comment: http://stackoverflow.com/comment/39323114
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/39322812
has title: Apache Commons Daemon - Cannot launch service

http://stackoverflow.com/q/25255667
type: Question
tagged with: objectify
tagged with: google-cloud-datastore
tagged with: google-app-engine
has title: Google App Engine - How do you persist Google User type with Objectify?
has body: Google states that the the Google App Engine Datastore support the following types. Java Properties and value types Among these is com.google.appengine.api.users.User. However when I try to persist my entity it is throwing the following excpetion. [INFO] java.lang.NullPointerException [INFO] at com.google.storage.onestore.v3.OnestoreEntity$PropertyValue$UserValue.setAuthDomain(OnestoreEntity.java:1145) [INFO] at com.google.appengine.api.datastore.DataTypeTranslator$UserType.toV3Value(DataTypeTranslator.java:994) [INFO] at com.google.appengine.api.datastore.DataTypeTranslator.addPropertyToPb(DataTypeTranslator.java:165) [INFO] at com.google.appengine.api.datastore.DataTypeTranslator.addPropertiesToPb(DataTypeTranslator.java:138) [INFO] at com.google.appengine.api.datastore.EntityTranslator.convertToPb(EntityTranslator.java:61) [INFO] at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:203) [INFO] at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:180) [INFO] at com.google.appengine.api.datastore.Batcher$BatchIterator.&lt;init&gt;(Batcher.java:177) ... I tried registering it with Objectify using my own service, but it'll just say entity not found, not surprising as it is not annotated with Objectify's @Entity. How do you persist the Google User type with Objectify? ** UPDATE ** I seem to be having problems with other Google Types as well. e.g. com.google.appengine.api.datastore.Email Entity Class package com.propertywrassler.webservice.maintenance; import com.google.api.server.spi.response.BadRequestException; import com.google.appengine.api.users.User; import com.googlecode.objectify.annotation.Entity; import com.propertywrassler.webservice.util.ErrorMessage; import com.propertywrassler.webservice.util.PropertyWrasslerChildEntity; import lombok.Getter; import lombok.Setter; import org.joda.time.DateTime; @Entity public class Comment extends MyChildEntity&lt;ThingYouCo…
upvote count: 1
has comment: http://stackoverflow.com/comment/39384617
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39350263
tagged with: java
has comment: http://stackoverflow.com/comment/39350505
downvote count: 0
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/25256313
has answer: http://stackoverflow.com/a/25256313
favorite count: 0

http://stackoverflow.com/comment/39346230
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25251603
has text: The simplest calculator implementation would not show the whole expression, but rather start a new number in the text field after an operator button was pressed. This would work with my solution. But you are correct to say that this would not work for expressions which need to be parsed. For that, I'd say you would need a more complex data structure to represent the parsed text, which could still have a `lastNumberIsAfterDecimalPoint()` method.

sql
tags question: http://stackoverflow.com/q/25239801
tags question: http://stackoverflow.com/q/25377939
tags question: http://stackoverflow.com/q/25303712
tags question: http://stackoverflow.com/q/25363324
tags question: http://stackoverflow.com/q/25326549
tags question: http://stackoverflow.com/q/25324739
tags question: http://stackoverflow.com/q/25257842
tags question: http://stackoverflow.com/q/25251786
tags question: http://stackoverflow.com/q/25311457
tags question: http://stackoverflow.com/q/25254793
tags question: http://stackoverflow.com/q/25305380
tags question: http://stackoverflow.com/q/25309193
tags question: http://stackoverflow.com/q/25312861
tags question: http://stackoverflow.com/q/25331920
tags question: http://stackoverflow.com/q/25321720
tags question: http://stackoverflow.com/q/25270905
tags question: http://stackoverflow.com/q/25244044
tags question: http://stackoverflow.com/q/25318314
tags question: http://stackoverflow.com/q/25303409
tags question: http://stackoverflow.com/q/25235466
tags question: http://stackoverflow.com/q/25241953
tags question: http://stackoverflow.com/q/25369123
tags question: http://stackoverflow.com/q/25252662
tags question: http://stackoverflow.com/q/25310030
tags question: http://stackoverflow.com/q/25348938
tags question: http://stackoverflow.com/q/25328155
tags question: http://stackoverflow.com/q/25251577
tags question: http://stackoverflow.com/q/25318539
tags question: http://stackoverflow.com/q/25347664
tags question: http://stackoverflow.com/q/25371405
tags question: http://stackoverflow.com/q/25264994
tags question: http://stackoverflow.com/q/25284234
tags question: http://stackoverflow.com/q/25333102
tags question: http://stackoverflow.com/q/25378732
tags question: http://stackoverflow.com/q/25379762
tags question: http://stackoverflow.com/q/25366724
tags question: http://stackoverflow.com/q/25245310
tags question: http://stackoverflow.com/q/25302279
tags question: http://stackoverflow.com/q/25301362
tags question: http://stackoverflow.com/q/25283215
tags question: http://stackoverflow.com/q/25377565
tags question: http://stackoverflow.com/q/25267325
tags question: http://stackoverflow.com/q/25233313
tags question: http://stackoverflow.com/q/25251056
tags question: http://stackoverflow.com/q/25337478
tags question: http://stackoverflow.com/q/25378412
tags question: http://stackoverflow.com/q/25374086
tags question: http://stackoverflow.com/q/25304085
tags question: http://stackoverflow.com/q/25245773
tags question: http://stackoverflow.com/q/25232462
tags question: http://stackoverflow.com/q/25371078
tags question: http://stackoverflow.com/q/25265468
tags question: http://stackoverflow.com/q/25388069
tags question: http://stackoverflow.com/q/25386209
tags question: http://stackoverflow.com/q/25250546
tags question: http://stackoverflow.com/q/25264460
tags question: http://stackoverflow.com/q/25370711
tag name: sql
tags question: http://stackoverflow.com/q/25266893
tags question: http://stackoverflow.com/q/25369211
tags question: http://stackoverflow.com/q/25335813
type: Tag
tags question: http://stackoverflow.com/q/25357918
tags question: http://stackoverflow.com/q/25271333
tags question: http://stackoverflow.com/q/25382587
tags question: http://stackoverflow.com/q/25341870
tags question: http://stackoverflow.com/q/25332855
tags question: http://stackoverflow.com/q/25356493
tags question: http://stackoverflow.com/q/25319422
tags question: http://stackoverflow.com/q/25318776
tags question: http://stackoverflow.com/q/25264143
tags question: http://stackoverflow.com/q/25299687
tags question: http://stackoverflow.com/q/25240725
tags question: http://stackoverflow.com/q/25236923
tags question: http://stackoverflow.com/q/25260478
tags question: http://stackoverflow.com/q/25365834
tags question: http://stackoverflow.com/q/25289638
tags question: http://stackoverflow.com/q/25360336
tags question: http://stackoverflow.com/q/25259195
tags question: http://stackoverflow.com/q/25378448

http://stackoverflow.com/comment/62938633
type: Comment
has text: This works for non-nullable relationships, too, which was exactly what I needed. Thanks.
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/26426909

http://stackoverflow.com/comment/49442430
type: QuestionComment
comment on: http://stackoverflow.com/q/25236748
type: Comment
has text: Did you resolve this ?
score: 0

http://stackoverflow.com/comment/39334345
comment on: http://stackoverflow.com/a/25246732
type: AnswerComment
has text: Thanks for your feedback. Update includes quote from the linked page which answers question.
score: 0
type: Comment

http://stackoverflow.com/q/25375017
type: Question
has comment: http://stackoverflow.com/comment/39570380
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/25375103
score: -1
has title: Point Tomcat 7 to use different jdk
has answer: http://stackoverflow.com/a/25375103
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11000497
upvote count: 0
tagged with: java
has body: Read this tutorial but it doesn't work on my end. Also i couldn't change my JAVA_HOME because other applications are using it. How do configure Tomcat 7 to use a different jdk or jre 7 that is installed on my system? I am using windows 7 and I have found this line in Catalina.bat but placing path of my java 7 installation directory in place of JAVA_HOME isn't working if ""%1"" == ""debug"" goto use_jdk echo Using JRE_HOME: "%JRE_HOME%" goto java_dir_displayed :use_jdk echo Using JAVA_HOME: "%JAVA_HOME%" Found a solution here Just added a new batch file setenv.bat and saved the file in TOMCAT_INSTALLATION_DIRECTORY\bin\setenv.bat or %CATALINA_BASE%/bin/setenv.bat and restarted tomcat server.
has comment: http://stackoverflow.com/comment/39570356
answer count: 1
tagged with: tomcat
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/25364474
answer count: 2
has title: android sqlite no such table
has comment: http://stackoverflow.com/comment/39550973
has comment: http://stackoverflow.com/comment/39549792
possible better answer: http://stackoverflow.com/a/25364683
linked to: http://stackoverflow.com/q/82875
has body: I'm using a premade database and I seem to be getting an error when I try to update a row. The exact error from logcat is: (1) no such table: AUD. Heres what my dbhelper class looks like: public class DataBaseHelper extends SQLiteOpenHelper { private static String TAG = "DataBaseHelper"; // Tag just for the LogCat window //destination path (location) of our database on device private static String DB_PATH = "/data/data/com.example.simplecurrency3/databases/"; private static String DB_NAME ="Currencies";// Database name private SQLiteDatabase mDataBase; private final Context mContext; public DataBaseHelper(Context context) { super(context, DB_NAME, null, 2);// 1? its Database Version if(android.os.Build.VERSION.SDK_INT &gt;= 17){ DB_PATH = context.getApplicationInfo().dataDir + "/databases/"; } else { DB_PATH = "/data/data/" + context.getPackageName() + "/databases/"; } this.mContext = context; } public void createDataBase() throws IOException { //If database not exists copy it from the assets boolean mDataBaseExist = checkDataBase(); if(!mDataBaseExist) { this.getReadableDatabase(); this.close(); try { //Copy the database from assests copyDataBase(); Log.e(TAG, "createDatabase database created"); } catch (IOException mIOException) { throw new Error("ErrorCopyingDataBase"); } } } //Check that the database exists here: /data/data/your package/databases/Da Name private boolean checkDataBase() { File dbFile = new File(DB_PATH + DB_NAME); //Log.v("dbFile", dbFile + " "+ dbFile.exists()); return dbFile.exists(); } //Copy the database from assets private void copyDataBase() throws IOException { InputStream mInput = mContext.getAssets().open(DB_NAME); String outFileName = DB_PATH + DB_NAME; OutputStream mOutput = new FileOutputStream(outFileName); byte[] mBuffer = new byte[1024]; int mLength; while ((mLength = mInput.read(mBuffer))&gt;0) { mOutput.write(mBuffer, 0, mLength); } mOutput.flush(); mOutput.close(); mInput.close(); } //Open the database, so we can query it public…
has answer: http://stackoverflow.com/a/25364683
has comment: http://stackoverflow.com/comment/39610859
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39551053
has comment: http://stackoverflow.com/comment/39550117
tagged with: android
tagged with: java
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/25368059
has comment: http://stackoverflow.com/comment/39550170
has answer: http://stackoverflow.com/a/25368059
type: Question
has comment: http://stackoverflow.com/comment/39550366

http://stackoverflow.com/q/25324620
has answer: http://stackoverflow.com/a/47752609
accepted answer: http://stackoverflow.com/a/25325548
has answer: http://stackoverflow.com/a/25325253
possible better answer: http://stackoverflow.com/a/25325253
answer count: 3
linked to: http://stackoverflow.com/q/16872945
score: 1
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has title: Case insensitive highlighting in TextView
has answer: http://stackoverflow.com/a/25325548
type: AnsweredQuestion
has body: I am using this code to highlight the text origString = origString.replaceAll(textToHighlight,""+textToHighlight+""); Textview.setText(Html.fromHtml(origString)); This code changes the color in case-sensitve, but it does not change the color which is case-insensitive ! How can I accomplish this ? Thanks in advance ! UPDATE : After User45639834 answer getting The method replaceAll(String, String) is undefined for the type new AdapterView.OnItemClickListener(){} This is my code showing the text in dialog listview1.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(AdapterView<?> parent, View view, int position, long id){ if(Flag.querytable==0) { final Dialog dialog; Log.v("hi",((TextView) view.findViewById(R.id.textView3)).getText().toString()+""); if(((TextView) view.findViewById(R.id.textView3)).getText().toString()!="") { dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.description); Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/BOOKOS.TTF"); TextView desc = (TextView) dialog.findViewById(R.id.textView3);//desc TextView part = (TextView) dialog.findViewById(R.id.textView1); TextView A_name= (TextView) dialog.findViewById(R.id.textView5); TextView italic = (TextView) dialog.findViewById(R.id.textView2); TextView AS_name = (TextView) dialog.findViewById(R.id.textView4); Button b = (Button)dialog.findViewById(R.id.button1); italic.setTypeface(null, Typeface.ITALIC); part.setTypeface(typeface); A_name.setTypeface(typeface); italic.setTypeface(typeface); AS_name.setTypeface(typeface); desc.setTypeface(typeface); String origString1=((TextView) view.findViewById(R.id.textView1)).getText().toString(); String origString2=((TextView) view.findViewById(R.id.textView2)).getText().toString(); String origString3=((TextView) view.findViewById(R.id.textView3)).getText().toString(); String origString4=((TextView) view.findViewById(R.id.textView4)).getText(…
upvote count: 1
downvote count: 0
tagged with: textview
has comment: http://stackoverflow.com/comment/82465279
favorite count: 0
type: Question

http://stackoverflow.com/comment/39386376
type: AnswerComment
comment on: http://stackoverflow.com/a/25275497
score: 0
type: Comment
has text: +1 for the link. I couldn't find that when I posted my answer.

http://stackoverflow.com/comment/39753527
type: QuestionComment
score: 0
has text: it did not work for me, but solution of person below did
comment on: http://stackoverflow.com/q/25296517
type: Comment

http://stackoverflow.com/comment/39464977
has text: @LuiggiMendoza You're right. Considering that he calls reflection "refraction", I think the best idea would be to use a tested library.
score: 1
comment on: http://stackoverflow.com/q/25317748
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25359282
accepted answer of: http://stackoverflow.com/q/25359245
has comment: http://stackoverflow.com/comment/39542556
has comment: http://stackoverflow.com/comment/39541837
type: Answer
has comment: http://stackoverflow.com/comment/39541431
has comment: http://stackoverflow.com/comment/39541944
score: 0
has body: You have null values. JSONObject can't accept null values. See How do you set a value to null with org.json.JSONObject in java?
has comment: http://stackoverflow.com/comment/39543626
answers question: http://stackoverflow.com/q/25359245
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39542496

http://stackoverflow.com/q/25329413
has comment: http://stackoverflow.com/comment/39486594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39486554
answer count: 3
has answer: http://stackoverflow.com/a/25329454
tagged with: java
favorite count: 0
has body: So as far as I know, in java you can't access objects directly, you only have the pointer to it. So for example I have this code: public class App { public App() { Thing t = null; doStuff(t); System.out.println(t); } public void doStuff(Thing a) { a = new Thing(); } public static void main(String[] args) { new App(); } } class Thing { } And the output is null. Why? I've passed the pointer to a method which gave it a new Thing instance to point to. Is it because it's a new pointer? Also how can I resolve it without returning anything from doStuff()?
type: Question
has answer: http://stackoverflow.com/a/25329445
has title: Java null object
accepted answer: http://stackoverflow.com/a/25329434
duplicate of: http://stackoverflow.com/q/40480
tagged with: null
upvote count: 0
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/25329434
linked to: http://stackoverflow.com/q/40480
possible better answer: http://stackoverflow.com/a/25329445

http://stackoverflow.com/comment/39353074
type: QuestionComment
has text: I take a reseller, fill the form with his data, and let the user edit it, then after the submit i reach the editReselleSubmit method. When i reach the try block i got a modified (by the user) version of the reseller that i wish i could merge with the original one, and this can be done only if the 2 objects have the same id, as we can see from the original [example](https://github.com/playframework/playframework/blob/2.2.x/samples/java/computer-database-jpa/app/models/Computer.java#L51) in the update method, merge fail because reseller reference i got is gone, so we are still missing something
comment on: http://stackoverflow.com/q/25247001
score: 0
type: Comment

http://stackoverflow.com/q/25317640
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/513832
tagged with: java
accepted answer: http://stackoverflow.com/a/25317667
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25317667
tagged with: string
downvote count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
type: Question
tagged with: if-statement
has title: Unable to find matching string in ArrayList<String>
has body: The idea is simple: Load a text file into a string. Split this string into paragraphs. Split all paragraphs into words. Add each individual word to an ArrayList. The result is an ArrayList containing all of the words in the text file. The procedure works; it loads all of the words in an ArrayList fine. HOWEVER, any "IF" statements to find a specific item in the ArrayList do not work. EXCEPT: if the word is a newline. public String loadText(String resourceName){ // Load the contents of a text file into a string String text = ""; InputStream stream = FileIO.class.getResourceAsStream(resourceName); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String str = ""; try { while ((str = reader.readLine())!=null){ text += str + "\n"; } } catch (Exception e) { System.out.println("Unable to load text stream!"); } return text; } public void test(){ ArrayList&lt;String&gt; collectionOfWords = new ArrayList&lt;String&gt;(); String text = loadText("/assets/text/intro.txt"); // Split into paragraphs String paragraphs[] = text.split("\n"); for (String paragraph: paragraphs){ // Split into words String words[] = paragraph.split(" "); // Add each word to the collection for (String word: words){ collectionOfWords.add(word); } // Add a new line to separate the paragraphs collectionOfWords.add("\n"); } // Test the procedure using a manual iterator for (int i=0; i&lt;collectionOfWords.size(); i++){ // ===== WHY DOES THIS WORK? if (collectionOfWords.get(i)=="\n") System.out.println("Found it!"); // ===== BUT THIS DOESN'T WORK??? if (collectionOfWords.get(i)=="test") System.out.println("Found it!"); // NOTE: Same problem if a I use: // for (String word: collectionOfWords){ // if (word=="test") // System.out.println("Found it!"); } } Sample of text file: The Quick Brown\n Fox Jumps Over\n test the lazy dog\n Any ideas? I am at the point to just scratch my design and try something totally different...
tagged with: arraylist

http://stackoverflow.com/comment/39351112
comment on: http://stackoverflow.com/q/25255994
type: QuestionComment
score: 0
type: Comment
has text: As the post you referred to suggested, what did you get when you run `c.getClass().getInterfaces()[0].getClassLoader();`, `Beet.class.getClassLoader();`, `Carrot.class.getClassLoader();`? This will help to determine if this is truly a class loader problem.

http://stackoverflow.com/a/25302819
score: 0
has body: Try this code Calendar cal = new GregorianCalendar(2013, 11, 20); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String date = df.format(cal.getTime());
answers question: http://stackoverflow.com/q/25302661
type: Answer

http://stackoverflow.com/a/25460876
accepted answer of: http://stackoverflow.com/q/25242128
type: Answer
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25242128
score: 2
has body: Finally I've found the solution that perfectly satisfies my needs. Hope this helps someone, who might be experiencing similar problem. [[^\p{Punct}\s]-]+|[\p{Punct}]

http://stackoverflow.com/a/25326757
has body: You are creating a new JTextField inside the method (and you are modfying its contents), but it's not added anywhere. Drop jTextField0 = new JTextField() and it should work (assuming you already created the text field beforehand).
type: Answer
has comment: http://stackoverflow.com/comment/39481337
has comment: http://stackoverflow.com/comment/39481306
upvote count: 2
answers question: http://stackoverflow.com/q/25326638
downvote count: 0
score: 2

irc
tags question: http://stackoverflow.com/q/25281370
tags question: http://stackoverflow.com/q/25237844
type: Tag
tags question: http://stackoverflow.com/q/25355005
tag name: irc

negative-number
type: Tag
tags question: http://stackoverflow.com/q/25286824
tag name: negative-number

http://stackoverflow.com/comment/39514814
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25344862
has text: @Mik378 - but then Smalltalk can do any kind of is-a relationship that way without inheritance. one object is-a 'nother object if they both have the same signature. C# can do the same thing with dynamic variables.
type: AnswerComment

http://stackoverflow.com/a/25413503
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25352916
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25352916
has body: In my opinion you should created new POJO classes for working with JSON which are decoupled from Android world(I mean, they can not have properties, parents which come from Android packages). It could look like this: class JsonRootRecipes { @JsonProperty("deleted") public List&lt;Number&gt; deleted; @JsonProperty("meta") public JsonMeta meta; @JsonProperty("objects") public List&lt;Object&gt; objects; // getters, setters, toString } class JsonMeta { @JsonProperty("is_anonymous") private boolean anonymous; // getters, setters, toString } // another POJOs decoupled from Android classes. Now, you have to create a service class which will be able to parse JSON and convert JsonPojo classes to your Android POJO classes. Pseudocode: class JsonService { public RootRecipes parseJson(json) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); JsonRootRecipes jsonRootRecipes = mapper.readValue(json, JsonRootRecipes.class); RootRecipes rootRecipes = null; //convert jsonRootRecipes to RootRecipes return rootRecipes; } }
has comment: http://stackoverflow.com/comment/39733744
type: Answer

http://stackoverflow.com/comment/39365937
type: Comment
type: QuestionComment
score: 0
has text: If this is Android related, developers options provide fake positions.
comment on: http://stackoverflow.com/q/25264684

http://stackoverflow.com/q/25283977
has title: ClassCastException when trying to invoke sonar with maven
upvote count: 2
answer count: 1
downvote count: 0
tagged with: maven
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39417417
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39402490
accepted answer: http://stackoverflow.com/a/25284782
tagged with: java
has answer: http://stackoverflow.com/a/25284782
tagged with: sonarqube
has body: I'm trying to analyse a project using Maven 3.2.1 and sonar maven plugin, but I'm getting a ClassCastException. My project is a multi-module Maven project with 3 projects. Here is the output in my command line: [ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:3.2:sonar (default-cli) on project: A type incompatibility occured while executing org.codehaus.sonar:sonar-maven-plugin:3.2:sonar: org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>org.codehaus.sonar:sonar-maven-plugin:3.2 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/var/lib/jenkins/.m2/repository/org/codehaus/sonar/sonar-maven-plugin/3.2/sonar-maven-plugin-3.2.jar [ERROR] urls[1] = file:/var/lib/jenkins/.m2/repository/org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.jar [ERROR] urls[2] = file:/var/lib/jenkins/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.jar [ERROR] urls[3] = file:/var/lib/jenkins/.m2/repository/junit/junit/4.10/junit-4.10.jar [ERROR] urls[4] = file:/var/lib/jenkins/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar [ERROR] urls[5] = file:/var/lib/jenkins/.m2/repository/org/codehaus/sonar/sonar-batch/3.2/sonar-batch-3.2.jar [ERROR] urls[6] = file:/var/lib/jenkins/.m2/repository/org/codehaus/sonar/sonar-core/3.2/sonar-core-3.2.jar [ERROR] urls[7] = file:/var/lib/jenkins/.m2/repository/org/mybatis/mybatis/3.1.1/mybatis-3.1.1.jar [ERROR] urls[8] = file:/var/lib/jenkins/.m2/repository/org/codehaus/sonar/sonar-update-center-common/1.3/sonar-update-center-common-1.3.jar [ERROR] urls[9] = file:/var/lib/jenkins/.m2/repository/org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar [ERROR] urls[10] = file:/var/lib/jenkins/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar [ERROR] urls[11] = file:/var/lib/jenkins/.m2/repositor…

http://stackoverflow.com/a/25270594
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25270502
answers question: http://stackoverflow.com/q/25270502
has body: When you throw an exception, you break out of the normal execution flow of the method. Therefore I believe the code following the condition shouldn't be in an else clause.
type: Answer

http://stackoverflow.com/a/25324088
has comment: http://stackoverflow.com/comment/39495897
has comment: http://stackoverflow.com/comment/39484174
has comment: http://stackoverflow.com/comment/39495322
has body: Thanks to comments by Deduplicator and user694733, here is a modified version of my original answer. The C++ version has undefined unspecified behaviour. There is a subtle difference between "undefined" and "unspecified", in that the former allows a program to do anything (including crashing) whereas the latter allows it to choose from a set of particular allowed behaviours without dictating which choice is correct. Except of very rare cases, you will always want to avoid both. A good starting point to understand whole issue are the C++ FAQs Why do some people think x = ++y + y++ is bad? , What’s the value of i++ + i++? and What’s the deal with “sequence points”?: Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression. (...) Basically, in C and C++, if you read a variable twice in an expression where you also write it, the result is undefined. (...) At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place. (...) The “certain specified points” that are called sequence points are (...) after evaluation of all a function’s parameters but before the first expression within the function is executed. In short, modifying a variable twice between two consecutive sequence points yields undefined behaviour, but a function call introduces an intermediate sequence point (actually, two intermediate sequence points, because the return statement creates another one). This means the fact that you have a function call in your expression "saves" your Simple::X += Simple::f(); line from being undefined and turns it into "only" unspecified. Both 1 and 11 are possible and correct outcomes, whereas printing 123, crashing or sending an insulting e-mail to your boss are not allowed behaviours; you'll just never get a guarantee whether 1 or 11 will be pri…
has comment: http://stackoverflow.com/comment/39496026
has comment: http://stackoverflow.com/comment/39495896
has comment: http://stackoverflow.com/comment/39476534
has comment: http://stackoverflow.com/comment/39495803
has comment: http://stackoverflow.com/comment/39494144
score: 21
has comment: http://stackoverflow.com/comment/39554200
upvote count: 21
has comment: http://stackoverflow.com/comment/39491646
has comment: http://stackoverflow.com/comment/39482934
has comment: http://stackoverflow.com/comment/39601191
has comment: http://stackoverflow.com/comment/39602784
has comment: http://stackoverflow.com/comment/39485081
has comment: http://stackoverflow.com/comment/39494636
has comment: http://stackoverflow.com/comment/39485368
has comment: http://stackoverflow.com/comment/39478901
answers question: http://stackoverflow.com/q/25323202
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39494345

http://stackoverflow.com/q/25367256
accepted answer: http://stackoverflow.com/a/25367285
has title: Is it necessary always call this in a constructor?
tagged with: java
has comment: http://stackoverflow.com/comment/39555182
duplicate of: http://stackoverflow.com/q/2429062
duplicate of: http://stackoverflow.com/q/15825590
tagged with: this
answer count: 1
linked to: http://stackoverflow.com/q/15825590
has comment: http://stackoverflow.com/comment/39555168
type: Question
has comment: http://stackoverflow.com/comment/39555149
type: AnsweredQuestion
has body: Let's say I created this class: public class Panel extends JPanel{ private JTextBox textBox; public Panel(){ this.textBox = new JTextBox(10); add(this.textBox); } } And in my main: public class Main{ public static void main(String[] args){ Panel panel1 = new Panel(); Panel panel2 = new Panel(); } } In the class Panel, is it necessary to call this at every line, or can I leave it away? Or would it mess up the Panels?
score: 0
has comment: http://stackoverflow.com/comment/39555258
has comment: http://stackoverflow.com/comment/39555518
has answer: http://stackoverflow.com/a/25367285
linked to: http://stackoverflow.com/q/1092099

http://stackoverflow.com/q/25258461
score: 11
linked to: http://stackoverflow.com/q/21355945
has comment: http://stackoverflow.com/comment/39355462
has comment: http://stackoverflow.com/comment/39356582
has answer: http://stackoverflow.com/a/39877801
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39355799
has comment: http://stackoverflow.com/comment/39355715
has comment: http://stackoverflow.com/comment/39355233
has body: While migrating from Tomcat to Weblogic 12.1.3 I got this exception javax.naming.namenotfoundexception while trying to look up then I have tried the following : NameNotFoundException: While trying to lookup 'jdbc' only when publishing from Eclipse Kepler but not Indigo and How to access JNDI data source defined in weblogic 10.3.6 I got the in titled error now My lookup code ds = (DataSource) initContext.lookup("MyDB"); in weblogic JNDI Name MyDB Any help please?
has answer: http://stackoverflow.com/a/31833032
downvote count: 0
has comment: http://stackoverflow.com/comment/39356020
tagged with: java
has answer: http://stackoverflow.com/a/25262410
linked to: http://stackoverflow.com/q/16218663
accepted answer: http://stackoverflow.com/a/25262410
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/49620971
has comment: http://stackoverflow.com/comment/39355933
tagged with: weblogic12c
has title: javax.naming.NameNotFoundException: Unable to resolve 'MyDB'. Resolved '' Weblogic 12.1.3. c
possible better answer: http://stackoverflow.com/a/31833032
has comment: http://stackoverflow.com/comment/39356417
tagged with: jndi
has comment: http://stackoverflow.com/comment/39355868
upvote count: 11

http://stackoverflow.com/comment/39480136
type: QuestionComment
has text: You don’t need a file to create an input stream. But currently your question is way to fuzzy to say anything about it. How do the documents become an `InputStream` or how does the list of documents become a single `InputStream`? And why? The `InputStream` will most likely be read and converted to something that you could create out of your document objects directly instead, so why the detour?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25314350

http://stackoverflow.com/a/25359051
type: Answer
answers question: http://stackoverflow.com/q/25343278
has body: There's no doFirst block in doLast (&lt;&lt;) action. Instead try: task setProdProperties(dependsOn: bootRun) { doFirst { println "Not getting here" System.setProperty('spring.profiles.active', 'prod') } } and invoke the command once again.
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25297909
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25309648
answer count: 3
has body: I'm creating a simulator using Java Swing. I used JComboBox to display units of utilities such as "KW, KL, KM" etc to measure Power, Water and distance. It's simple to add bunch of items to a JComboBox. User select a unit and the JFrame will save the selection when a "save" button is clicked. JComboBox comboBox = new JComboBox(); for(ValueUnits u: ValueUnits.values()){ comboBox.addItem(u.returnUnits()); } comboBox.setSelectedIndex(-1); unitColumn.setCellEditor(new DefaultCellEditor(comboBox)); Now I want to create an multi-layer JComboBox (perhaps JMenu?). The function of such should behave as a multi-layer JMenu. When the JComboBox is clicked, it will show the first layer - category such as "Electricity, Water, Distance...", Then when mouse hover over Electricity, a list of Electricity units such as "KW, MW, W ..." will show. These collections are fetched from Enumerations. I wonder what's the most correct way to create such component. Thank you so much world!
score: 1
tagged with: java
tagged with: multi-level
has title: How to create a multi-layer JComboBox
has answer: http://stackoverflow.com/a/25313271
tagged with: jcombobox
type: Question
accepted answer: http://stackoverflow.com/a/25309648
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25301775
tagged with: swing
tagged with: jmenu
favorite count: 0
possible better answer: http://stackoverflow.com/a/25313271

http://stackoverflow.com/comment/39461401
type: AnswerComment
has text: Thanks, you are right. Could this be applied to receive? i have one thread that listen to every datagram received and depending on its address it will alert one or another thread to process the payload, creating new threads in case no thread exist with that address.
score: 0
comment on: http://stackoverflow.com/a/25315829
type: Comment

http://stackoverflow.com/q/25357785
tagged with: string
has answer: http://stackoverflow.com/a/25358359
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39537778
downvote count: 0
answer count: 3
has body: After analyzing a heap dump I found that there were some 30MB strings allocated (single string of 30 MB). Is there a way to set a break point while debugging the application so I can find the code which allocates these huge strings? Since thousands of strings are allocated during application run it isn't possible just putting a break point on each string allocation. I believe conditional break point will be too slow as well. If possible I would want to exam those strings content to understand the origin of these allocation. For example they may be a result of a web service call which usually is called with small amount of data but in rare cases with huge input (which are the cases I want to find).
has answer: http://stackoverflow.com/a/25359261
accepted answer: http://stackoverflow.com/a/25359261
tagged with: java
has answer: http://stackoverflow.com/a/25359373
has comment: http://stackoverflow.com/comment/39537676
has comment: http://stackoverflow.com/comment/39537639
type: Question
has comment: http://stackoverflow.com/comment/39537524
score: 5
upvote count: 5
possible better answer: http://stackoverflow.com/a/25359373
has title: Find large strings allocation during java debug session
has comment: http://stackoverflow.com/comment/39537775

http://stackoverflow.com/comment/39357588
score: 0
type: AnswerComment
has text: Yeah, generics make it really complicated, as said in Java 7 you don't need to repeat it after the new. In a future version they will support static initialization of objects.
comment on: http://stackoverflow.com/a/25245707
type: Comment

http://stackoverflow.com/comment/39586574
comment on: http://stackoverflow.com/q/25382930
type: QuestionComment
has text: I'm also using IntelliJ 13.1.4. So when you click onto an unmodified tab and click on an empty line inside a method or class, the caret position isn't at the start?
type: Comment
score: 0

http://stackoverflow.com/q/25332249
has comment: http://stackoverflow.com/comment/39492639
has comment: http://stackoverflow.com/comment/39492578
has comment: http://stackoverflow.com/comment/39493071
type: Question
upvote count: 2
has body: I have two public classes Employee and Salary in the same package. Employee is the parent class and Salary is the child class. When I compile the Employee class using the "-d" flag the code compiles fine and also generates the appropriate directory structure as per the package name. However when I try to compile the Salary class it gives me the following error: Salary.java:2: cannot find symbol symbol: class Employee public class Salary extends Employee{ 1 error Here is my code: Employee.java package com.alok.Manage; public class Employee{ private int eno; private String name; Employee() { this(0,""); } Employee(int n,String nm) { this.eno=n; this.name=nm; } public int getEno() { return this.eno; } public String getName() { return this.name; } } Salary.java package com.alok.Manage; public class Salary extends Employee{ private int Salary; public int getSal() { return this.Salary; } public void setsal(int s) { this.Salary=s; } } If I remove the package declaration from both the files then it compiles without any errors.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39492807
answer count: 1
has comment: http://stackoverflow.com/comment/39492495
has title: Cannot find symbol in same Package
has answer: http://stackoverflow.com/a/25332521
has comment: http://stackoverflow.com/comment/39492680
has comment: http://stackoverflow.com/comment/39492651
has comment: http://stackoverflow.com/comment/39492534
favorite count: 0
has comment: http://stackoverflow.com/comment/39492412
has comment: http://stackoverflow.com/comment/39492506
has comment: http://stackoverflow.com/comment/39492516
type: AnsweredQuestion
tagged with: package
tagged with: symbols
tagged with: java
has comment: http://stackoverflow.com/comment/39492527
tagged with: compilation
accepted answer: http://stackoverflow.com/a/25332521

http://stackoverflow.com/comment/39427905
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25268770
has text: Or maybe even use [`equalsIgnoreCase`](http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#equalsIgnoreCase-java.lang.String-) rather than `equals`.
score: 0

tomcat7
tags question: http://stackoverflow.com/q/25282255
tags question: http://stackoverflow.com/q/25378429
tags question: http://stackoverflow.com/q/25362674
tags question: http://stackoverflow.com/q/25256573
tags question: http://stackoverflow.com/q/25316012
tags question: http://stackoverflow.com/q/25278775
tags question: http://stackoverflow.com/q/25256768
tag name: tomcat7
tags question: http://stackoverflow.com/q/25295207
tags question: http://stackoverflow.com/q/25376630
tags question: http://stackoverflow.com/q/25375017
tags question: http://stackoverflow.com/q/25336173
type: Tag

http://stackoverflow.com/a/25292628
has body: You can certainly do this, and there are even tools to make it easier, like http://set.ee/jbe/. The Java runtime will run your modified bytecode just as it would run the bytecode emitted by the compiler. What you're describing is a Java-specific case of a binary patch. The semicolon example wouldn't be an issue, since semicolons are only for the convenience of the compiler and don't appear in the bytecode.
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39417624
has comment: http://stackoverflow.com/comment/39417515
answers question: http://stackoverflow.com/q/25292551
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39417648

http://stackoverflow.com/comment/39339648
type: Comment
type: QuestionComment
has text: in `getSelectedNode`, you never actually test the node.
score: 0
comment on: http://stackoverflow.com/q/25249674

http://stackoverflow.com/a/25326537
type: Answer
has comment: http://stackoverflow.com/comment/39481048
has body: You state in comment: I have to use it like this, because after the Login(InternalFrame) the main Frame disposes the desktopPane and loads other elements like Jlists etc. So if I use the component listener where do I place it? Inside this method or somewhere else? No you don't. Perhaps better would be to use a CardLayout to swap views. This way you can display your login JPanel first, You can center this JPanel in another JPanel by giving the wrapper JPanel a GridBagLayout, and then adding your login JPanel to it in a default way (without GridBagConstraints) And then add this wrapper JPanel to your CardLayout using JPanel. and then on successful login, swap to the work JPanel. Another option: Use a modal dialog such as a modal JDialog or a JOptionPane to do the login. Display an introduction JPanel in the main GUI Display the dialog above this, again making it modal, so that the user cannot interact with the main GUI until the dialog has been dealt with. When the dialog is no longer visible, program flow returns to the calling code. Here is where you check the results entered into the dialog which will tell you whether to swap from the intro JPanel to your work JPanel. Again, use CardLayout to help you swap.
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39481000
answers question: http://stackoverflow.com/q/25326343

http://stackoverflow.com/comment/39428599
has text: Yup it's definitely adding the second list being passed twice.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25298113
type: AnswerComment

http://stackoverflow.com/a/25261126
score: 1
type: Answer
downvote count: 0
has body: Struts2 session tracking uses the underlying Servlet session tracking system. You should get some understanding of how this works, given that HTTP is stateless. There's an explanation here. This underlying mechanism (using cookies or URL re-writing) itself only works on a single web-application, so you cannot use it directly. Instead, I suggest using your own cookie, and have both applications able to read the cookie (to check if the user is logged in) and set it (when logging in). Set the value of the cookie to some unique ID of the logged-in user.
upvote count: 1
answers question: http://stackoverflow.com/q/25260763

http://stackoverflow.com/comment/39708924
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25268709
has text: @user3556256, when you are attempting to learn a new concept, create a simple test program to prove the concept. Then once it works apply the knowledge to your real program. This is called a `SSCCE`. I posted a simple example for you. Good luck.
type: Comment

http://stackoverflow.com/q/25351490
has answer: http://stackoverflow.com/a/25353073
tagged with: equals
has comment: http://stackoverflow.com/comment/39526499
upvote count: 12
has answer: http://stackoverflow.com/a/25351833
has comment: http://stackoverflow.com/comment/39526466
has comment: http://stackoverflow.com/comment/39526596
has title: Why is String.equals much slower for non-identical (but equal) String objects?
score: 11
tagged with: string
downvote count: 1
has comment: http://stackoverflow.com/comment/39526443
favorite count: 0
possible better answer: http://stackoverflow.com/a/25353073
has comment: http://stackoverflow.com/comment/39526478
has comment: http://stackoverflow.com/comment/39526518
type: AnsweredQuestion
tagged with: performance
accepted answer: http://stackoverflow.com/a/25353025
tagged with: java
has answer: http://stackoverflow.com/a/25353025
has comment: http://stackoverflow.com/comment/39526623
has answer: http://stackoverflow.com/a/25352073
answer count: 4
type: Question
has body: I'm delving into the question of is String.equals() really that bad and while trying to do some benchmarking of it came across some surprising results. Using jmh, I wrote up a simple test (code and pom at end) which sees how many times the function can be run in 1 second. Benchmark Mode Samples Score Score error Units c.s.SimpleBenchmark.testEqualsIntern thrpt 5 698910949.710 47115846.650 ops/s c.s.SimpleBenchmark.testEqualsNew thrpt 5 529118.774 21164.872 ops/s c.s.SimpleBenchmark.testIsEmpty thrpt 5 470846539.546 19922172.099 ops/s The this is a 1300x factor between testEqualsIntern and testEqualsNew which is frankly quite surprising to me. The code for String.equals() does have a test for the same object, which would kick the identical (interned in this case) string objects out quite quickly. I just have have significant difficulty believing that the additional code which appears to amount to walking over an array of size 1 for the two tests and comparing elements is that much of a performance hit. I've also put in a test with another simple method call in the String to make sure I wasn't seeing something that is too crazy. package com.shagie; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; public class SimpleBenchmark { public final static int ITERATIONS = 1000; public final static String EMPTY = ""; public final static String NEW_EMPTY = new String(""); @Benchmark public int testEqualsIntern() { int count = 0; String str = EMPTY; for(int i = 0; i < ITERATIONS; i++) { if(str.equals(EMPTY)) { count++; } } return count; } @Benchmark public int testEqualsNew() { int count = 0; String str = NEW_EMPTY; for(int i = 0; i < ITERATIONS; i++) { if(str.equals(EMPTY)) { count++; } } return count; } @Benchmark public int testIsEmpty() { int count = 0; String str = NEW_EMPTY; for(int i = 0; i < …
has comment: http://stackoverflow.com/comment/39526854

http://stackoverflow.com/a/25236563
score: 0
has body: set contentDescription for each image &amp; after selecting one of the image get content discription Toast.makeText(context,imageview.getContentDiscription(),Toast.LENGTH_SHORT).show();
has comment: http://stackoverflow.com/comment/39313873
answers question: http://stackoverflow.com/q/25236546
has comment: http://stackoverflow.com/comment/39313933
type: Answer

http://stackoverflow.com/comment/39532559
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25353943
has text: Wow, I can't believe I didn't catch that! Thank you @Orabîg. It looks perfect now. Love this website for how fast the questions are answered.
type: Comment

http://stackoverflow.com/q/25281257
tagged with: tcp
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25281661
tagged with: spring-integration
has answer: http://stackoverflow.com/a/25281661
tagged with: java
has title: Java TCP split packets
type: AnsweredQuestion
score: 0
has body: I am using spring-integration TCP connections. From the Serializer implementation i write some bytes directly to the given OutputStream. The first byte seems to be sent on its own (in it's own TCP packet, which is by the way reported malformed by wireshark) and then the remaining bytes in the next packet. Changing the first two bytes to be written in one call (two byte long array) causes these two bytes to be sent in a seperate packet (not malformed) and the remaning in the next packet. This outcome is reproducible. Is this something I can (or should) affect? It is causing problems on the reading end, because that equipment apparently expects the entire message to be contained in a single TCP packet.

http://stackoverflow.com/a/25354080
has body: You should take a look at How to convert a JSON string to a Map&lt;String, String&gt; with Jackson JSON where there is the following code : JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(factory); TypeReference&lt;HashMap&lt;String,Object&gt;&gt; typeRef = new TypeReference&lt;HashMap&lt;String,Object&gt;&gt;() {}; HashMap&lt;String,Object&gt; o = mapper.readValue(inputFile, typeRef); Maybe the fact that you used the abstract class Map instead of a concrete implementation (HashMap in the above code) explains that Jackson has some difficulties when trying to fill this structure...
accepted answer of: http://stackoverflow.com/q/25354009
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25354009
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39530936
type: Answer

http://stackoverflow.com/comment/39504005
has text: Changing the scope to `compile` would work when testing in your IDE. However, this will cause problems when you actually deploy your finished project into an applications server, because there will be 2 servlet-api JARs: one provided by the server, and another within your WAR. Tomcat, for example, won't be able to start the context for your application.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25338511
type: AnswerComment

http://stackoverflow.com/q/25387983
has comment: http://stackoverflow.com/comment/39596583
tagged with: documentlistener
upvote count: 2
has answer: http://stackoverflow.com/a/25388146
score: 2
accepted answer: http://stackoverflow.com/a/25388097
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25388097
tagged with: swing
has title: keep jButton grey until jTextFields != null
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39596406
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7861783
possible better answer: http://stackoverflow.com/a/25388391
answer count: 5
has answer: http://stackoverflow.com/a/25388396
linked to: http://stackoverflow.com/q/3953208
has body: I have 4 jTextFields that I save the input to a file once a submit button is pressed. I want to be able to keep the submit button disabled until each field is at least not null. Where can i put something like this if(jTextField1 == null || jTextField2 == null || jTextField3 == null || jTextField4 == null){ jButton2.setEnabled(false); } so that the program will enable/disable the button live. Like once the last field even has 1 character in it I want it to be enabled?
has answer: http://stackoverflow.com/a/25388391
has answer: http://stackoverflow.com/a/64634664

http://stackoverflow.com/q/25251476
has comment: http://stackoverflow.com/comment/39342341
tagged with: rest
tagged with: java
has answer: http://stackoverflow.com/a/25279647
has comment: http://stackoverflow.com/comment/39382652
has comment: http://stackoverflow.com/comment/39383025
has title: Getting started with Java RESTful service using javax, and Jersey Servlet dispatcher
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39383005
tagged with: jersey
has body: I am new to web services and trying to configure a simple REST service. I am following the tutorial http://www.vogella.com/tutorials/REST/article.html My TestClass is package com.test.servlettest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/hello") public class TestRestService { @GET @Produces(MediaType.TEXT_PLAIN) public String sayHello() { return "Hello Jersey"; } } And web.xml is <?xml version="1.0" encoding="UTF-8"?> ServletTest TestRestService com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.test.servlettest 1 TestRestService /test/* I am getting 404 when i am hitting URLs http://localhost:8080/ServletTest http://localhost:8080/ServletTest/test http://localhost:8080/ServletTest/test/hello What is missing here, i am not getting it. I could understand this, Jersey provides its own Servlet implementation somehow, so i do not not need to extend HttpServlet. But this class should be regietered as the tutorial says says the package where services are there EDIT The application is deployed, i verified it by adding a servlet class to the same package @WebServlet("/TestServlet") public class TestServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); out.println(" Hello World "); } } And now, hitting the URL, localhost:8080/ServletTest/TestServlet is giving me the expected result Thanks
accepted answer: http://stackoverflow.com/a/25279647
has comment: http://stackoverflow.com/comment/39382812
has comment: http://stackoverflow.com/comment/39382611
answer count: 1
has comment: http://stackoverflow.com/comment/39342913
has comment: http://stackoverflow.com/comment/39382594
has comment: http://stackoverflow.com/comment/39342438
has comment: http://stackoverflow.com/comment/39342240
has comment: http://stackoverflow.com/comment/39342887
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39454281
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/25312113
type: Comment
has text: @19greg96: Looks like you have not understood the reason of a salt. It is just there to prevent rainbow-table attacks on the md5.

http://stackoverflow.com/a/25352315
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39537198
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/39530184
has body: Load texture: Texture texture; texture = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/image.png"))); If it doesn't fix your problem, then it is something wrong with the way you bind it.
answers question: http://stackoverflow.com/q/25351323

http://stackoverflow.com/a/25258219
has comment: http://stackoverflow.com/comment/39376989
answers question: http://stackoverflow.com/q/25257415
type: Answer
has comment: http://stackoverflow.com/comment/39383002
score: 0
has comment: http://stackoverflow.com/comment/39376929
has comment: http://stackoverflow.com/comment/39355431
has comment: http://stackoverflow.com/comment/39355170
has comment: http://stackoverflow.com/comment/39381821
has comment: http://stackoverflow.com/comment/39382313
has body: try this, change : appButton.setText(mContext.getString(entry.displayNameResID())); to appButton.setText(mContext.getResources().getString(R.string.load_history_entry));
has comment: http://stackoverflow.com/comment/39355056
has comment: http://stackoverflow.com/comment/39359715

http://stackoverflow.com/a/25272331
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25272184
upvote count: 5
has comment: http://stackoverflow.com/comment/39380650
type: Answer
has body: You could make use of DataOutputStream and/or DataInputStream to store and read binary data in Java. Here is an example of how it's done: import java.io.*; public class Test{ public static void main(String args[])throws IOException{ DataInputStream d = new DataInputStream(new FileInputStream("test.txt")); DataOutputStream out = new DataOutputStream(new FileOutputStream("test1.txt")); String count; while((count = d.readLine()) != null){ String u = count.toUpperCase(); System.out.println(u); out.writeBytes(u + " ,"); } d.close(); out.close(); } } Editors' note: .close() statements should be wrapped in finally block: finally { d.close(); out.close(); } Source: http://www.tutorialspoint.com/java/java_dataoutputstream.htm
answers question: http://stackoverflow.com/q/25272184
type: AcceptedAnswer
score: 4

http://stackoverflow.com/q/25294813
has comment: http://stackoverflow.com/comment/39550263
tagged with: java
tagged with: wsc
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/42133497
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39706847
has comment: http://stackoverflow.com/comment/39460459
has body: I've recently upgraded to ODI 5.5.1 and Java 1.7. Since doing so I have not been able to perform bulk processes into salesforce using tSalesforceOutputBulkExec. I consistently get the following exception message when attempting to run jobs. Starting job TestBulk at 10:50 13/08/2014. [statistics] connecting to socket on port 3438 [statistics] connected Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.sforce.async.BatchRequest.loadBatchInfo(Ljava/io/InputStream;)Lcom/sforce/async/BatchInfo; from class com.sforce.async.BulkConnection at com.sforce.async.BulkConnection.createBatchFromStreamImpl(BulkConnection.java:154) at com.sforce.async.BulkConnection.createBatchFromStream(BulkConnection.java:131) at org.talend.salesforceBulk.SalesforceBulkAPI.createBatch(SalesforceBulkAPI.java:369) at org.talend.salesforceBulk.SalesforceBulkAPI.createBatchesFromCSVFile(SalesforceBulkAPI.java:355) at org.talend.salesforceBulk.SalesforceBulkAPI.executeBulk(SalesforceBulkAPI.java:122) at prototyping.testbulk_0_1.TestBulk.tSalesforceInput_1Process(TestBulk.java:2180) at prototyping.testbulk_0_1.TestBulk.runJobInTOS(TestBulk.java:2522) at prototyping.testbulk_0_1.TestBulk.main(TestBulk.java:2368) [statistics] disconnected Job TestBulk ended at 10:50 13/08/2014. [exit code=1] The exception appears to be occurring in the wsc.jar provided as part of the talend build but which comes from an open source package provided by salesforce and hosted on https://code.google.com/p/sfdc-wsc/downloads/list I'm not sure though whether the problem I'm seeing is in the wsc jar or within my setup. Has anyone else seen or solved this problem? Should I replace the wsc.jar file and if so is this the correct jar to replace OS_DI-Win32-r118616-V5.5.1\plugins\org.talend.designer.components.localprovider_5.5.1.r118616\components\tSalesforceBulkExec\wsc.jar
tagged with: salesforce
has title: How can I solve this exception in the tSalesforceOutputBulkExec Talend component
has comment: http://stackoverflow.com/comment/39549183
type: Question
tagged with: talend

http://stackoverflow.com/comment/39473341
has text: @hoomi code pasted in edit
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25322347

http://stackoverflow.com/q/25331323
possible better answer: http://stackoverflow.com/a/25331353
type: Question
has body: I have the following code: for(int sentenceCounter = 0; sentenceCounter &lt; sentences.length; sentenceCounter++) { double score = 0; String[] sentence = sentences[sentenceCounter].split(" "); for (int titleCounter = 0; titleCounter &lt; titles.length; titleCounter++) { for (int wordCounter = 0; wordCounter &lt; sentence.length; wordCounter++) { if (titles[titleCounter].equals(sentence[wordCounter])) { if(titleCounter == 0) { score += titleValue * hundred / 100; sentenceScore.put(sentenceCounter, score); System.out.println(sentenceCounter + " " + wordCounter + " " + score); }else { score += titleValue - titleSubtract * hundred / 100; sentenceScore.put(sentenceCounter, score); System.out.println(sentenceCounter + " " + wordCounter + " " + sentenceScore.get(0)); } System.out.println(sentenceCounter); } } } } I am trying to reset the score counter after the sentenceCounter increases, however when I set score = 0 at the right after the for loop of sentenceCounter it does not reset itself. So, how do I reset it? The steps of the program is as follows: 1. Break title into single words. 2. Break sentence into single words. 3. See if sentence contains word from title. If yes then increase score of sentence by X. 4. Repeat for next word in title. 5. If sentence contains another word from title add to previous score. 6. Repeat this for next sentence but first set score counter to zero. This is where I am stuck. This is the output I am observing from above code: 0 0 10.0 0 0 1 19.3 0 1 5 19.3 1 As you can see sentence two starts at 19.3 instead of starting at zero. Here is the program in full: import java.util.HashMap; import java.util.Map; public class MainDemo { public static void main(String[] args) { // TODO Auto-generated method stub String fullTitle = "Facebook traffic website"; String[] titles = fullTitle.split(" "); Double titleValue = 10.0; Double sentenceSubtract = 13.0; Double titleSubtract = 0.70; Double hundred = 100.0; HashMap&lt;Integer, String&gt; titleArray = …
has answer: http://stackoverflow.com/a/25331353
has comment: http://stackoverflow.com/comment/39490652
has comment: http://stackoverflow.com/comment/39490414
has title: Reset Counter to Zero in Java?
has comment: http://stackoverflow.com/comment/39490678
tagged with: counter
has comment: http://stackoverflow.com/comment/39490500
has comment: http://stackoverflow.com/comment/39490827
accepted answer: http://stackoverflow.com/a/25331951
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25331951
answer count: 2
tagged with: for-loop
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39492879
has comment: http://stackoverflow.com/comment/39491474
has comment: http://stackoverflow.com/comment/39491063
has comment: http://stackoverflow.com/comment/39490881
has comment: http://stackoverflow.com/comment/39491377
has comment: http://stackoverflow.com/comment/39490649
has comment: http://stackoverflow.com/comment/39491145
has comment: http://stackoverflow.com/comment/39490485
has comment: http://stackoverflow.com/comment/39490394
favorite count: 0

http://stackoverflow.com/q/25241362
downvote count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25241741
has comment: http://stackoverflow.com/comment/39322478
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25241668
has title: How to pull json data using java
has comment: http://stackoverflow.com/comment/39404283
accepted answer: http://stackoverflow.com/a/25241668
has comment: http://stackoverflow.com/comment/39322706
type: AnsweredQuestion
answer count: 2
has body: I am unable to pull data from this in java. The problem is that how name_value_list will be fetched afterwards. Thanks in advance. { "id" : "ets7qkt1luugsj828jugs8vuq5", "module_name" : "Users", "name_value_list" : { "mobile_max_list_entries" : { "name" : "mobile_max_list_entries", "value" : null }, "mobile_max_subpanel_entries" : { "name" : "mobile_max_subpanel_entries", "value" : null }, "user_currency_id" : { "name" : "user_currency_id", "value" : "-99" }, . . "user_language" : { "name" : "user_language", "value" : "en_us" }, "user_name" : { "name" : "user_name", "value" : "abcd" }, "user_number_seperator" : { "name" : "user_number_seperator", "value" : "," } } }
has comment: http://stackoverflow.com/comment/39322932
possible better answer: http://stackoverflow.com/a/25241741
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/25255210
type: AnsweredQuestion
score: 1
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/25255566
has answer: http://stackoverflow.com/a/25255540
has answer: http://stackoverflow.com/a/25255566
has comment: http://stackoverflow.com/comment/39349437
tagged with: httpurlconnection
has body: I've been playing around with Android Studio and trying to establish a connection to a dev environment in which reponds back with JSON. I have tested my code and Eclipse (not ADK) and it works fine. I've added the permissions to the AndroidManifest.xml file for INTERNET and ACCESS_NETWORK_STATE so that has been covered. I dont know what else to do? My Java: public class GetClientDetails { public void jsonResponse () { try{ URL url = new URL("http://invsydmdev069:7080/IFXJSON?type=PartyRq&amp;RqUID=123456789&amp;PartyId=1093300"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Accept", "application/json"); conn.setReadTimeout(10000); conn.setConnectTimeout(15000); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader (is, "UTF-8") ); try { String preJsonObj = reader.readLine(); JSONObject jsonObj = new JSONObject(preJsonObj); String strPartyId = jsonObj.getJSONObject("PartyRs").getJSONObject("PartyRec").getString("PartyId"); } catch (JSONException e) { throw new RuntimeException(e); } } catch(Exception e) { System.out.println("its fked"); } } }
type: Question
has title: Android App unable to change Response Code for HTTP Connection in JAVA
answer count: 2
has comment: http://stackoverflow.com/comment/39349546
accepted answer: http://stackoverflow.com/a/25255540
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39349335
linked to: http://stackoverflow.com/q/6343166
tagged with: http
favorite count: 0

http://stackoverflow.com/comment/39339115
score: 0
type: QuestionComment
has text: How confident are you that you don't have a circular reference? I find it really hard to believe that you are getting a StackOverflow without a circular reference.
comment on: http://stackoverflow.com/q/25249674
type: Comment

http://stackoverflow.com/a/29697849
has body: Use this -> try{ Process duration = Runtime.getRuntime().exec(new String[] { "sh", "-c", "avconv -i test.avi 2&gt;&amp;1 | grep 'Duration' | awk '{print $2}' | sed s/,//"}); String line BufferedReader in = new BufferedReader(new InputStreamReader(duration.getInputStream()) ); while ((line = in.readLine()) != null) { System.out.println(line); } }catch(IOException e){ e.printStackTrace(); }
type: Answer
answers question: http://stackoverflow.com/q/25260794
score: 0

http://stackoverflow.com/comment/39370245
type: Comment
has text: Do you have any code to post to show what you have tried?
type: QuestionComment
comment on: http://stackoverflow.com/q/25266997
score: 0

http://stackoverflow.com/a/25312192
has comment: http://stackoverflow.com/comment/39454583
type: Answer
has body: You are using the same thread for updating the JProgressBar and to run the script. Problem is that you wait for the Process to terminate (p.waitFor()), therefore, the thread will wait and not update the JProgressBar. The correct solution is to use SwingWorker . But I think you could have the thing running by starting a new Thread to run your srcipt. Something like: public void actionPerformed(ActionEvent args) { //the process starts JStartTimeTextField.setText(dateFormat.format(date)); //the progress bar should show it running (by right) aJProgressBar.setIndeterminate(true); new Thread() { public void run() { try { //create new process String command = "cmd /c start /wait" +DetectDrive+"\\starting.bat"; //run process Process p = Runtime.getRuntime().exec(command); //cause this process to stop until process p is terminated p.waitFor(); } catch (IOException | InterruptedException e1) { e1.printStackTrace(); } } }.start(); ...... Date newDate = new Date(); JStartTimeTextField.setText(dateFormat.format(newDate)); //the progress bar should stop running (by right) //aJProgressBar.setIndeterminate(false); }
score: 0
has comment: http://stackoverflow.com/comment/39454725
has comment: http://stackoverflow.com/comment/39472829
answers question: http://stackoverflow.com/q/25311938

http://stackoverflow.com/comment/39564844
has text: But my question was why so many 1's. I got my answer it is because the positive number itself has leading 0 which when inverted has all 1's. The cionfusion arises because Java does not diplay the leading 0's for a positive number.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25371863
score: 0

http://stackoverflow.com/comment/39313823
type: Comment
comment on: http://stackoverflow.com/a/25236363
score: 0
type: AnswerComment
has text: @alfasin: Those statements only create objects on the heap if they are executed. Putting an initializer in a class that is never instantiated is not enough to execute the code. In order for that code to execute, an instance of `Test123` has to be created.

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

http://stackoverflow.com/comment/39578280
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25379189
has text: Hello, I would like to ask how I can completely remove the eclipse? Just delete the whole ADT folder?

http://stackoverflow.com/a/25262100
type: Answer
answers question: http://stackoverflow.com/q/25262026
has comment: http://stackoverflow.com/comment/39395716
score: 3
accepted answer of: http://stackoverflow.com/q/25262026
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: Better to read up upon how to run external programs through the Java. You can easily use Process and ProcessBuilder classes to get the stuffs done. Readers and Writers will be needed when you are dealing with argument passing kind of stuffs. e.g. Process p = Runtime.getRuntime().exec("cmd /c dir"); this will simply open the command prompt and execute dir command which will list the folders and file list in the current folder. You can handle inputs and outputs through InputStream in = process.getInputStream(); OutputStream out = process.getOutputStream(); Check this out
has comment: http://stackoverflow.com/comment/39394905

trayicon
tags question: http://stackoverflow.com/q/25388990
type: Tag
tag name: trayicon

http://stackoverflow.com/comment/39579376
comment on: http://stackoverflow.com/a/25379637
type: AnswerComment
has text: when i change THEME_DEFAULT to R.style.Theme1 then it will works. Thx good job!
type: Comment
score: 0

http://stackoverflow.com/comment/39330935
type: Comment
score: 0
type: AnswerComment
has text: I don't have a List. The code you posted above gets marked with an error. Funny enough that `Class<?>[]` or `Class<MyBaseClass>[]` doesn't get marked but `Class<? extends MyBaseClass>[]`gets.
comment on: http://stackoverflow.com/a/25245707

http://stackoverflow.com/comment/39437259
comment on: http://stackoverflow.com/q/25302833
type: Comment
type: QuestionComment
has text: Your WS library probably has a timeout feature. For example with Jersey you can use a client configuration like `new ClientConfig().property(ClientProperties.CONNECT_TIMEOUT, 5000);`.
score: 0

http://stackoverflow.com/a/25330934
upvote count: 4
answers question: http://stackoverflow.com/q/25330464
type: AcceptedAnswer
downvote count: 0
has body: If you need sequential activity, you can call one task and then another. The simple solution in your case is something like this. ExecutorService exec = Executors.newFixedThreadPool(2); exec.execute(new Runnable() { public void run() { userProvisioner1.run(); userProvisioner2.run(); } }); exec.execute(new Runnable() { public void run() { userProvisioner3.run(); userProvisioner4.run(); } }); exec.shutdown(); exec.awaitTermination();
type: Answer
accepted answer of: http://stackoverflow.com/q/25330464
score: 4

http://stackoverflow.com/a/25380348
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/40288281
downvote count: 0
answers question: http://stackoverflow.com/q/25375950
has comment: http://stackoverflow.com/comment/50732423
has comment: http://stackoverflow.com/comment/40282539
has comment: http://stackoverflow.com/comment/52695664
has comment: http://stackoverflow.com/comment/40282550
has comment: http://stackoverflow.com/comment/40290520
has body: Lets start with what the two commands do. echo $JAVA_HOME This outputs the value of the JAVA_HOME environment variable. By convention, this environment variable is set (typically in a shell "rc" file) to the base directory of a JRE or JDK installation. However, none of the Oracle or OpenJDK core java tools depend on this. You set JAVA_HOME for the benefit of 3rd-party tools, to tell them which of possibly many JRE or JDK installations on the system to use. So running echo $JAVA_HOME will typically give the directory for a JRE or JDK. But it might be unset ... or point to missing directory. java -version This runs the java command and tells it to output its own version information. Unlike the previous, if your shell can find a (real) java command, the information it outputs is definitive. But which JRE / JDK does will the java command come from? Well that is determined by the shell, and how it (in general) finds commands. For all mainstream Unix / Linux / BSD shells, this is controlled by the PATH environment variable. The PATH variable defines a command search path; i.e. a list of directories where the shell looks for commands. So if PATH is /usr/bin:/bin:/usr/local/bin:/home/joeuser/bin:/usr/java/jre-x.y.z/bin then the shell will look for java in each of those directories in turn. The first one java command that it finds will be the one that is executed. You can find out which one it is by running this command. which java But that is not the end of it, because if you are using an OpenJDK Java installation on a typical Linux system, the java command in /usr/bin is actually the first in a chain of symlinks that is managed by the alternatives command. The actual executable is at the other end of the chain. (The alternatives system is a way to implement a switchable system-wide default for a command or set of commands. Read the manual entry for more details. But note that Oracle Java installers (or RPMs) for Linux don't "grok" the Linux alternatives system ... one of m…

ms-word
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/25274196
tags question: http://stackoverflow.com/q/25369874

minimum
tags question: http://stackoverflow.com/q/25231597
tag name: minimum
type: Tag

http://stackoverflow.com/comment/39316930
comment on: http://stackoverflow.com/q/25237973
score: 1
type: Comment
type: QuestionComment
has text: All jvm generated exceptions are mapped to a specific message which is consistent across all applications. Changing the message in one application can cause the consuming application to display incorrect message for known exception types. This is the reason why the message along with the actual cause(Throwable) can be set only during construction of Exception. May be this reasoning doesnt have a good example but this is my thought.

http://stackoverflow.com/comment/39349274
type: QuestionComment
comment on: http://stackoverflow.com/q/25255310
has text: Have you tried running your application on a machine that doesn't have eclipse?
score: 0
type: Comment

http://stackoverflow.com/a/25262399
has body: The problem is with else part of your inner for-loop. boolean isVowel(char c){ String vowels = "aeiouAEIOU"; for(int index = 0; index &lt; vowels.length(); index += 1) if(vowels.charAt(index) == c) return true; return false; } Now after you get the currentChar just try this if(isVowel(currentChar)) vowelCount++; else constCount++;
answers question: http://stackoverflow.com/q/25262270
type: Answer
score: 0

http://stackoverflow.com/q/25254817
has body: i am trying to build a single executable jar file with dependencies using maven shade plug in. in my pom.xml, i have added a dependency on a package which i have locally complied (mvn install) which is also a springframework based package. but i am getting following errors when i run my application. Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [applicationContext.xml] while spending half of today googling for answers, i've found out that different springframework modules' manifest files can overwrite each other, and hence i have to use AppendingTransformer so that they can be appended instead of being overwritten. so i have added those lines, but it is still failing. what could be wrong? here is my plug-in definition. org.apache.maven.plugins maven-shade-plugin 2.1 package shade my-spring-app <shadedArtifactAttached>true</shadedArtifactAttached> jar-with-dependencies com.mycomp.App META-INF/spring.handlers META-INF/spring.schemas META-INF/spring.tooling </plugin> UPDATE here's my applicationContext.xml ( partial) <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframe…
has answer: http://stackoverflow.com/a/25255690
tagged with: maven
tagged with: spring
tagged with: maven-shade-plugin
has answer: http://stackoverflow.com/a/25272065
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25255690
answer count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25316633
tagged with: jar
has answer: http://stackoverflow.com/a/25316633
type: Question
has title: Unable to locate Spring NamespaceHandler for XML schema namespace springframework context

http://stackoverflow.com/comment/39324323
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25237940
type: AnswerComment
has text: Case with the `@Inheritance` => No identifier specified for entity : Country. Case with the `@MappedSuperClass` => java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract be.model.AbstractCatalog

http://stackoverflow.com/comment/39388011
type: AnswerComment
has text: Oh wow. Well, that fixed it. Figured it was something I overlooked.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25276535

http://stackoverflow.com/comment/39591200
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25386147
has text: You'd better explain what are you trying to achieve.

http://stackoverflow.com/q/25363748
has body: I've been trying to customize the tab bar of my app. I've got nearly everything working except for the part that the default blue thin line shows up above my custom drawable for the tabs. I will attach a screenshot and the xml styles. styles.xml <?xml version="1.0" encoding="utf-8"?> drawable/tab_indicator_myactionbar.xml <?xml version="1.0" encoding="utf-8"?> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_myactionbar" /> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_focused_unselected_myactionbar" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_focused_selected_myactionbar" /> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_myactionbar" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_myactionbar" /> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_myactionbar" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_myactionbar" />
has comment: http://stackoverflow.com/comment/39548451
tagged with: http://stackoverflow.com/tag/xml
score: 0
answer count: 0
tagged with: java
has title: How to get rid of default bar under tab
has comment: http://stackoverflow.com/comment/39549324
type: Question
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/25353063
score: 2
has body: Look in resource limits (setrlimit if you are on POSIX system) as opposed to trying to find the malicious code. You can limit number of processes, memory, open files, cputime and others. I would suggest you to limit basically everything. And run in chroot jail (even an empty one if you link statically).
type: Answer
answers question: http://stackoverflow.com/q/25352557
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/25312269
answers question: http://stackoverflow.com/q/25312168
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39454430
type: Answer
accepted answer of: http://stackoverflow.com/q/25312168
has comment: http://stackoverflow.com/comment/39454793
downvote count: 0
has body: The problem probably is the line webView.loadURL("searchURL");. By doing that it actually tries to load the URL searchURL and not the URL http://www.stackoverflow.com you saved in the variable searchURL. So just remove the "s: webView.loadURL(searchURL); // searchURL = "http://www.stackoverflow.com" Edit: To not launch chrome, simply add the following line: webview.setWebViewClient(new WebViewClient()); Also see this question for details.
has comment: http://stackoverflow.com/comment/39456268
score: 1
has comment: http://stackoverflow.com/comment/39455177
upvote count: 1

http://stackoverflow.com/a/25376959
score: 2
upvote count: 2
downvote count: 0
has body: The compilation error went away once I added the following jar in the build path: hadoop-common-2.3.0-cdh5.1.0.jar so there was some internal dependency that was missing causing this error.
type: Answer
answers question: http://stackoverflow.com/q/25355592

http://stackoverflow.com/comment/39574872
score: 0
has text: If you seem to be speaking of SQlLite ,I suppose not. A simple key-pair valueset demands a simpler and easier storage for which this seemed the right solution. Had the structure been more complex then yes.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25377385

http://stackoverflow.com/a/25366555
type: Answer
answers question: http://stackoverflow.com/q/25351435
score: 0
has comment: http://stackoverflow.com/comment/39553855
has body: Go to Run -> Debug Configurations Find your debug configuration under Java Application and click on debug(right bottom corner) if you need to add arguments then click on Arguments tab and under Program Arguments add your input parameters If you want to import your launch configuration in eclipse then: File --> Import --> Launch Configurations --> select your launch configuration from disk
has comment: http://stackoverflow.com/comment/39553992

http://stackoverflow.com/q/25354100
answer count: 0
upvote count: 2
tagged with: taglib
type: UnansweredQuestion
tagged with: annotations
tagged with: custom-tags
downvote count: 0
score: 2
has title: Retrieve an annotated field from a class in the view
tagged with: java
has body: In my current spring project, the atributes from my entity classes have annotations to indicate which type of form control should be used for data input, like this: @Column(name = "login", unique=true) @Order(value=1) @Input(name="login") private String login; @Column(name = "senha") @Order(value=2) @Input(type="password", name="senha") private String senha; @Column(name="nome") @Order(value=3) @Input(name="nome") private String nome; @Column(name="sobrenome") @Order(value=4) @Input(name="sobrenome") private String sobrenome; @Column(name="email") @Order(value=5) @Input(name="email") private String email; And I have custom tags which should read the atributes of the annotations and add to the page the correct tag, like that: public class InputTag extends TagSupport { /** * */ private static final long serialVersionUID = 1L; public void doTag() throws IOException, NoSuchFieldException, SecurityException { JspWriter out = pageContext.getOut(); String name = this.getName(); String type = this.getType(); String pattern = this.getPattern(); if(type == null) { if(pattern == "") { out.println("<form:input path=\""+name+"\" class=\"form-control\"/>"); } else { out.println("<form:input path=\""+name+"\" class=\"form-control valida\" pattern=\""+pattern+"\"/>"); } } else { if(pattern == "") { out.println("<form:input path=\""+name+"\" type=\""+type+"\" class=\"form-control\"/>"); } else { out.println("<form:input path=\""+name+"\" type=\""+type+"\" class=\"form-control valida\" pattern=\""+pattern+"\"/>"); } } } ... } the getter methods from the tag class have this format: private String getName() throws NoSuchFieldException, SecurityException { Field field = null; Annotation annotation = field.getAnnotation(Input.class); Input inputAnnotation = (Input) annotation; String name = inputAnnotation.name(); return name; } What I need right now it's a way of store in the variable field the field I want add to he page. I know the method for do this if I was inside the entity class (…
favorite count: 0
type: Question
tagged with: jstl

http://stackoverflow.com/comment/39549765
type: Comment
has text: @CaptainGiraffe will that be able run the method every X amount of hours?
comment on: http://stackoverflow.com/q/25364437
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39355431
type: AnswerComment
has text: it is the same as previous one 08-12 02:45:26.045: W/ResourceType(515): Failure getting entry for 0x7f040038 (t=3 e=56) in package 0 (error -75) 08-12 02:45:26.045: D/AndroidRuntime(515): Shutting down VM 08-12 02:45:26.045: W/dalvikvm(515): threadid=1: thread exiting with uncaught exception (group=0x40015560) 08-12 02:45:26.055: E/AndroidRuntime(515): FATAL EXCEPTION: main 08-12 02:45:26.055: E/AndroidRuntime(515): android.content.res.Resources$NotFoundException: String resource ID #0x7f040038 thanks for your help man. really appreciate it. im gonna be back after a while. 3 am here :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25258219

http://stackoverflow.com/a/25319181
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25304149
upvote count: 1
has body: If you need access to the underlying actor, you need to use TestActorRef from akka-testkit. import akka.testkit.TestActorRef val actorRef = TestActorRef[MyActor] val actor = actorRef.underlyingActor http://doc.akka.io/docs/akka/2.3.5/scala/testing.html#Obtaining_a_Reference_to_an_Actor This should be used only in your tests and accessing an actor directly in production code is extremely dangerous and should not be done.

http://stackoverflow.com/q/25306124
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39447198
has comment: http://stackoverflow.com/comment/39443529
type: Question
has comment: http://stackoverflow.com/comment/39449290
has answer: http://stackoverflow.com/a/25309058
tagged with: encoding
tagged with: network-programming
tagged with: packet
tagged with: sockets
has body: My requirement is to encode the string in the following format to send it over the java socket Telegram is prefixed with a four byte length field arranged in network byte order (big-endian). +-------------------------------- ... ------+ Byte | 0 | 1 | 2 | 3 | 4 | 5 | | x | +-------------------------------- ... ------+ Field | -- Data Length -- | Data | +-------------------------------- ... ------+ For example, if the number of bytes in the telegram is 300 (0x012C), the length field is populated as follows: +-------------------------------- ... ------+ | 00 | 00 | 01 | 2C | Data (300 bytes) | +-------------------------------- ... ------+ how to I convert my java String in to this format? eg: String request = "\Start\&lt;/request>" to what ever the format mentioned above I tried request.getBytes("UTF8") but not compatible, its crashing (server is written in .NET). for me the server is a blackbox, <Code> final Socket SOCKET = new Socket(hostName, portNumber); Writer out = new OutputStreamWriter(SOCKET.getOutputStream(), "UTF8"); StringBuffer buffer = new StringBuffer(); try { FileInputStream fis = new FileInputStream("c:/request.txt"); InputStreamReader isr = new InputStreamReader(fis, "UTF8"); Reader in = new BufferedReader(isr); int ch; while ((ch = in.read()) &gt; -1) { buffer.append((char) ch); } in.close(); } catch (IOException e) { e.printStackTrace(); } ; String r = buffer.toString(); char[] c = r.toCharArray(); out.write(c); out.flush(); new Thread(new Runnable() { public void run() { while (true) { try { Thread.sleep(1000); while (SOCKET.getInputStream().available() != -1) { System.out.println(SOCKET.getInputStream().read()); } } catch (Exception e) { e.printStackTrace(); } } } }).start();
has title: Big endian encoding in java socket from string
has comment: http://stackoverflow.com/comment/39447948
has comment: http://stackoverflow.com/comment/39442871
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25309058
has comment: http://stackoverflow.com/comment/39447083
has comment: http://stackoverflow.com/comment/39444542

http://stackoverflow.com/comment/39575505
has text: @R9J can you provide a sample.
comment on: http://stackoverflow.com/a/25377745
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25246346
tagged with: sockets
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/25246592
accepted answer: http://stackoverflow.com/a/25246592
linked to: http://stackoverflow.com/q/4009157
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39346883
has title: How to sent a result when query through socket?
answer count: 1
has comment: http://stackoverflow.com/comment/39334716
type: Question
has body: I have code about query database through socket but i can not how to receive result, anybody can help me. Here is my code: Server private void server() throws IOException, SQLException { try { ServerSocket server = new ServerSocket(1994); System.out.println("Server is ready..."); socket = server.accept(); DataInputStream in = new DataInputStream(socket.getInputStream()); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); String query = in.readUTF(); pst = conn.prepareStatement(query); rs = pst.executeQuery(); while(rs.next()) { String ID = rs.getString("ID"); out.writeUTF(ID); String Name= rs.getString("Name"); out.writeUTF(Name); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } socket.close(); } Client public class Client { private void connect() throws ClassNotFoundException { ResultSet rs = null; try { Socket socket = new Socket("localhost", 1994); DataInputStream in = new DataInputStream(socket.getInputStream()); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); out.writeUTF("Select * from sinhvientest"); String ID = null; String Name = null; String s; while(!(s = in.readUTF()).equals(null)) { ID = in.readUTF(); System.out.print(ID + " "); Name = in.readUTF(); System.out.println(Name); } } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Connect to database is good, query from database is good, I want send result to clent but i do not how to. It sent only one row. Anyone can help me? Thanks so much!

http://stackoverflow.com/comment/39496940
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25334332
type: QuestionComment
has text: No maybe I'll try that.

http://stackoverflow.com/comment/39376794
type: AnswerComment
has text: Yeah I get the basic concept of them but you're probably right... The environment variables are probably the issue, because XP cannot load the Java 8 installer, so I had to extract the installer contents and add the environment variables manually. Which is where I could've went wrong. For now, I just downloaded the Java 7 JDK. Thanks for the advice.
type: Comment
comment on: http://stackoverflow.com/a/25252799
score: 0

cloudera-cdh
tag name: cloudera-cdh
type: Tag
tags question: http://stackoverflow.com/q/25355592

http://stackoverflow.com/a/25321758
has comment: http://stackoverflow.com/comment/39475323
type: AcceptedAnswer
downvote count: 0
has body: I currently have Scribe with Flickr OAuth working, and in comparing what you have, I noticed several issues: 1) frob is used in the old authentication flow, not used in OAuth. In the OAuth flow, you will need to look for "oauth_verifier" in the callback params. //change String code = request.getParameter("frob"); //to String code = request.getParameter(OAuthConstants.VERIFIER); //oauth_verifier 2) you should use the original requestToken from OAuthAuth to get your accessToken, instead you are getting a new requestToken public class FlickrAuth extends HttpServlet { ... //after you get the initial requestToken, save it (e.g. session, database,..) Token requestToken = service.getRequestToken(); request.getSession().setAttribute("some key", requestToken); public class FlickrCallback extends HttpServlet { ... //later you will need that original requestToken Token savedRequestToken = request.getSession().getAttribute("some key"); Verifier verifier = new Verifier(code); //from request param oauth_verifier Token accessToken = service.getAccessToken(savedRequestToken, verifier);
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25317682
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25317682

http://stackoverflow.com/a/25317080
has body: This code should do what you Need: package javaapplication6; import java.util.Scanner; import javax.swing.JOptionPane; public class JavaApplication6 { Scanner input = new Scanner(System.in); System.out.print("Enter the number of lines :"); int num = input.nextInt(); String output = ""; int width= num*2-1+num*2; for(int i = 1; i &lt;= num; i++){ System.out.println(width/2-(i-1)*2); for (int j = 0;j&lt;width/2-(i-1)*2;j++){ System.out.print(" "); } output = i != 1 ? i + " " + output + " " + i : "1"; System.out.println(output); } } }
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25316863
answers question: http://stackoverflow.com/q/25316863
type: Answer

for-loop
tags question: http://stackoverflow.com/q/25316590
tags question: http://stackoverflow.com/q/25307776
tags question: http://stackoverflow.com/q/25331323
tags question: http://stackoverflow.com/q/25247701
tags question: http://stackoverflow.com/q/25362990
tags question: http://stackoverflow.com/q/25354505
tags question: http://stackoverflow.com/q/25341144
type: Tag
tags question: http://stackoverflow.com/q/25277256
tags question: http://stackoverflow.com/q/25316863
tags question: http://stackoverflow.com/q/25324132
tags question: http://stackoverflow.com/q/25352995
tags question: http://stackoverflow.com/q/25345748
tags question: http://stackoverflow.com/q/25265781
tags question: http://stackoverflow.com/q/25276638
tags question: http://stackoverflow.com/q/25237709
tags question: http://stackoverflow.com/q/25265567
tag name: for-loop

http://stackoverflow.com/q/25275000
has body: I'm developing an android application and I cannot remove the title bar permanently. A solution posted here: How to hide the title bar for an Activity in XML with existing custom theme (the 600 upvoted one, the others didn't work as described below) worked in general, but it maintained the title bar for a brief millisecond when initially launching the app. I've tried various solutions throughout stackoverflow and other sites modifying the android theme in the manifest xml and style file(s). However, all of these solutions have all crashed the application before it began. The message in LogCat being that I must use an AppCompact theme. My main activity extends the ActionBarActivity class, and I have tried switching it to just Activity while also removing the : if (savedInstanceState == null) {getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } that is generated. However, when I do so, all of the views on the main activity disappear and it becomes completely white with nothing else. Is there a way to completely remove the actionbar while extending ActionBarActivity? If not, how can I switch to extending Activity or some other class while maintaining no other errors?
linked to: http://stackoverflow.com/q/2591036
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39385485
has title: Removing the Android Title Bar
favorite count: 0
type: Question
tagged with: android-titlebar
answer count: 2
type: UnansweredQuestion
tagged with: android
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/39285298
has answer: http://stackoverflow.com/a/25275076
has comment: http://stackoverflow.com/comment/39385570

http://stackoverflow.com/comment/39629134
score: 0
type: Comment
has text: I wanted the new record to be inserted into one table, but make sure that auto increment would give it an id from the common pool. Nevermind anymore, I picked Juxhin solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/25406332

http://stackoverflow.com/comment/39506013
type: QuestionComment
score: 0
has text: on the org.json.JSONObject I can use an iterator to get all the names. I want something like that and on gson.
comment on: http://stackoverflow.com/q/25339735
type: Comment

http://stackoverflow.com/a/25293072
downvote count: 0
answers question: http://stackoverflow.com/q/25292781
type: Answer
score: 2
has body: You can't define two resources of the same type with the same name with the same qualifiers. Setting a color in XML using @color/yellow is really just saying "find a color resource called 'yellow'". @color doesn't define a file name- it is declaring the resource type. Similarly, trying to use @second_color/yellow won't tell Android to look for a color named yellow in a file called second_color.xml. When the build tools generate R, they will combine all of the &lt;color&gt; entries for a given configuration together. If you have a color named "yellow" defined in two separate files that still both reside in your values/ directory, you will have a problem because there can only be one color resource named "yellow." You can define two yellow colors if they are in values/ folders with different qualifiers. For example, you could put one yellow in values-fr/ and a different one in values-en, and the first will be used for French speaking countries while the latter will be used for English speaking countries. If you do this, you still just reference the color with @color/yellow, but the system takes care of selecting the correct one for you. If you just want two different shades of yellow for the same application in the same configuration, you should give them different names.
upvote count: 2

http://stackoverflow.com/q/25296081
favorite count: 0
type: Question
tagged with: android
answer count: 1
has body: I searched the topic for several days, but finally confused. The idea is to create own alarm app with some special tricks. Firstly, I need clock hands. For creating custom clock, I used own class, which extends View. Hour and minute hands are PNG images. They should be located in the center of the screen, but they dont. Actually, I can't even see them. And that is the question. Here is the Clock class import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Point; import android.graphics.drawable.Drawable; //import android.os.Handler; import android.text.format.Time; import android.util.AttributeSet; import android.view.Display; import android.view.View; import android.view.WindowManager; @SuppressLint("NewApi") public class Clock extends View { public Clock(Context context) { super(context); // TODO Auto-generated constructor stub } private Drawable mHourHand; private Drawable mMinuteHand; private boolean mAttached; static private float mMinutes; static private float mHour; private boolean mChanged; Context mContext; private boolean mSeconds; // Gettes &amp; setters. These clock must present alarm time which user sets in the next view protected float getmMinutes() { return mMinutes; } protected static void setmMinutes(float mMinutes) { Clock.mMinutes = mMinutes; } protected float getmHour() { return mHour; } protected static void setmHour(float mHour) { Clock.mHour = mHour; } private Point size; // ctors public Clock(Context context, AttributeSet attrs) { this(context, attrs, 0); } public Clock(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); Resources r = context.getResources(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnalogClock, defStyle, 0); mContext=context; mHourHand = r.getDrawable(R.d…
downvote count: 0
tagged with: clock
upvote count: 1
accepted answer: http://stackoverflow.com/a/25296278
has answer: http://stackoverflow.com/a/25296278
type: AnsweredQuestion
has title: Scale and align in custom android AnalogClock hands
linked to: http://stackoverflow.com/q/25315717
tagged with: java
score: 1
tagged with: scaling

http://stackoverflow.com/q/25332171
has answer: http://stackoverflow.com/a/25332352
tagged with: parse-platform
has title: Working with fragments - NullPointerException
possible better answer: http://stackoverflow.com/a/25332299
tagged with: android
accepted answer: http://stackoverflow.com/a/25332573
has answer: http://stackoverflow.com/a/25332573
has answer: http://stackoverflow.com/a/25332299
type: AnsweredQuestion
has body: I received a null pointer exception error on my activity that holds various fragments. In that activity a list of users would be populated to the current users through parse based around various criteria like gender, minimum age, etc. Below is the logcat message I unexpectedly received when launching my application. 08-15 17:42:28.863: E/AndroidRuntime(4974): FATAL EXCEPTION: main 08-15 17:42:28.863: E/AndroidRuntime(4974): Process: com.dooba.beta, PID: 4974 08-15 17:42:28.863: E/AndroidRuntime(4974): java.lang.NullPointerException 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.dooba.beta.Fragment1$1.done(Fragment1.java:108) 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.parse.FindCallback.internalDone(FindCallback.java:45) 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.parse.FindCallback.internalDone(FindCallback.java:1) 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.parse.Parse$6$1.run(Parse.java:888) 08-15 17:42:28.863: E/AndroidRuntime(4974): at android.os.Handler.handleCallback(Handler.java:733) 08-15 17:42:28.863: E/AndroidRuntime(4974): at android.os.Handler.dispatchMessage(Handler.java:95) 08-15 17:42:28.863: E/AndroidRuntime(4974): at android.os.Looper.loop(Looper.java:136) 08-15 17:42:28.863: E/AndroidRuntime(4974): at android.app.ActivityThread.main(ActivityThread.java:5017) 08-15 17:42:28.863: E/AndroidRuntime(4974): at java.lang.reflect.Method.invokeNative(Native Method) 08-15 17:42:28.863: E/AndroidRuntime(4974): at java.lang.reflect.Method.invoke(Method.java:515) 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 08-15 17:42:28.863: E/AndroidRuntime(4974): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 08-15 17:42:28.863: E/AndroidRuntime(4974): at dalvik.system.NativeStart.main(Native Method) Below is the activity code that holds the fragment where the error occured public class usermatch extends FragmentActivity { private PageAdapter mPagerAd…
answer count: 3
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/39492150
score: 1
tagged with: java
downvote count: 0
upvote count: 1
tagged with: android-activity
favorite count: 0
type: Question

http://stackoverflow.com/comment/39527220
type: Comment
has text: Thanks for your suggestion and support. I added many of the things that you have suggested, but for some reason the image is not being displayed in the imageView. I have updated my initial code under update 2 of my post. Thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/25347191
score: 0

http://stackoverflow.com/comment/39570290
type: QuestionComment
comment on: http://stackoverflow.com/q/25374966
has text: Try not to use `BufferedReader` for this, trying reading each character from the `InputStream` instead
score: 0
type: Comment

http://stackoverflow.com/q/25356014
tagged with: combinatorics
tagged with: combinations
type: AnsweredQuestion
has title: Calculate C(n, k) combinations for big numbers using modInverse
accepted answer: http://stackoverflow.com/a/25356178
tagged with: algorithm
has answer: http://stackoverflow.com/a/25356178
has comment: http://stackoverflow.com/comment/76498027
score: 2
upvote count: 2
tagged with: java
answer count: 1
downvote count: 0
tagged with: modular-arithmetic
has body: I want to calculate combinations C(n, k) where n and k could be very large. I tried to do so by using modular inverse as following, but it's not giving correct output even for small numbers. Can anybody tell me where I'm wrong? import java.math.BigInteger; public class Test { public static int[] factorials = new int[100001]; public static int mod = 1000000007; public static BigInteger MOD = BigInteger.valueOf(1000000007); public static void calculateFactorials() { long f = 1; for (int i = 1; i &lt; factorials.length; i++) { f = (f * i) % mod; factorials[i] = (int) f; } } // Choose(n, k) = n! / (k! * (n-k)!) public static long nCk(int n, int k) { if (n &lt; k) { return 0; } long a = BigInteger.valueOf(k).modInverse(MOD).longValue(); long b = BigInteger.valueOf(n - k).modInverse(MOD).longValue(); // Left to right associativity between * and % return factorials[n] * a % mod * b % mod; } public static void main(String[] args) { calculateFactorials(); System.out.println(nCk(5, 2)); } }
favorite count: 0
type: Question

http://stackoverflow.com/comment/39475614
type: Comment
comment on: http://stackoverflow.com/a/25323589
type: AnswerComment
score: 0
has text: @Christophe Yeah, I was going by the calling conventions that are usually used on Windows. I'm well aware of the whole clusterproblem with different calling and evaluation conventions. So were the designers of Java and C#, it seems :D

http://stackoverflow.com/q/25368535
tagged with: spring-security
favorite count: 0
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
has body: The resource is under src/main/resources/static/css or src/main/resources/static/js, I'm using spring boot, and the class of security is: @Configuration @EnableWebMvcSecurity @EnableGlobalAuthentication public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // http.authorizeRequests().antMatchers("/", "/index", "/quizStart") // .permitAll().anyRequest().authenticated(); // http.formLogin().loginPage("/login").permitAll().and().logout() // .permitAll(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("test").password("test") .roles("USER"); } } It works well (resources can be loaded) when I access "/index" from browser, however, if I uncomment the four lines in the class, resources can not be loaded, the four lines means: http.authorizeRequests().antMatchers("/", "/index", "/quizStart") .permitAll().anyRequest().authenticated(); http.formLogin().loginPage("/login").permitAll().and().logout() .permitAll(); Could anyone help with this ? Thanks in advance.
score: 50
has answer: http://stackoverflow.com/a/49380959
tagged with: java
has answer: http://stackoverflow.com/a/38942664
possible better answer: http://stackoverflow.com/a/38942664
has answer: http://stackoverflow.com/a/72690791
accepted answer: http://stackoverflow.com/a/25368637
has answer: http://stackoverflow.com/a/60624289
tagged with: css
has answer: http://stackoverflow.com/a/44802025
answer count: 8
has answer: http://stackoverflow.com/a/43747769
has answer: http://stackoverflow.com/a/35728046
downvote count: 0
has title: Spring security does not allow CSS or JS resources to be loaded
upvote count: 50
has answer: http://stackoverflow.com/a/25368637
tagged with: spring

http://stackoverflow.com/comment/39482944
has text: You have to do some thing in `onPuase` mehod, just calling it's super wont pause the game for you! for example save the state of the game and stop it from continuing so when user came back, he does not loose anything.
comment on: http://stackoverflow.com/q/25327542
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39457297
comment on: http://stackoverflow.com/a/25305018
type: Comment
type: AnswerComment
has text: I know I could pass it with `@DataProvider`, but just wanted to be sure I can't use both. Thanks for the response.
score: 0

http://stackoverflow.com/a/25244627
has comment: http://stackoverflow.com/comment/39354450
has comment: http://stackoverflow.com/comment/39332634
type: Answer
has comment: http://stackoverflow.com/comment/39351589
has comment: http://stackoverflow.com/comment/39329135
has comment: http://stackoverflow.com/comment/39331344
score: 0
has comment: http://stackoverflow.com/comment/39360005
has comment: http://stackoverflow.com/comment/39328860
answers question: http://stackoverflow.com/q/25244554
has body: You could stay with your loop and use StringUtils.isNumeric()

http://stackoverflow.com/q/25389031
type: Question
possible better answer: http://stackoverflow.com/a/25390863
answer count: 2
has answer: http://stackoverflow.com/a/25392006
has title: Using Map in Hibernate is not working
has body: I am trying to create a simple program by using java.util.Map. I have created a Customer entity class with a map of Order classes. Here are my Java classes: Customer.java @Entity public class Customer { @Id @GeneratedValue private Integer id; @OneToMany(mappedBy = "customer") @MapKey(name = "orderNumber") private Map&lt;String, Order&gt; orders; } Order.java @Entity @Table(name="TB_ORDER") public class Order { @Id @GeneratedValue private Integer id; private String orderNumber; @ManyToOne private Customer customer; } Here is my program that tries to save a customer with some orders and then I am trying to display the saved data: public class AppTest { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); saveCustomer(session); session = HibernateUtil.getSessionFactory().getCurrentSession(); showCustomer(session); HibernateUtil.getSessionFactory().close(); } private static void showCustomer(Session session) { session.getTransaction().begin(); List&lt;Customer&gt; list = session.createQuery("from Customer").list(); for (Customer customer : list) { System.out.println("customer id : "+customer.getId()+ ", customer orders : "+customer.getOrders()); } session.getTransaction().commit(); } private static void saveCustomer(Session session) { session.getTransaction().begin(); Customer customer = new Customer(); Order order = new Order(); order.setCustomer(customer); order.setOrderNumber("100"); Map&lt;String, Order&gt; map = new HashMap(); map.put("100", order); customer.setOrders(map); session.save(customer); session.save(order); session.getTransaction().commit(); } } After running the program, Hibernate generated below DDL &amp; DML commands: Hibernate: create table Customer (id number(10,0) not null, primary key (id)) Hibernate: create table TB_ORDER (id number(10,0) not null, orderNumber varchar2(255 char), customer_id number(10,0), primary key (id)) Hibernate: alter table TB_ORDER add constraint FK_qr7tjivmclv5tr…
accepted answer: http://stackoverflow.com/a/25392006
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: hibernate
favorite count: 0
has answer: http://stackoverflow.com/a/25390863

http://stackoverflow.com/comment/39391293
comment on: http://stackoverflow.com/a/25270819
type: AnswerComment
has text: Sorry to dissappoint you. There is no technical reason. Since the day of inception, the first version, the author had clearly added comment //alias against the code. ARROW_LEFT, ARROW_RIGHT, ARROW_UP and ARROW_DOWN are aliases for LEFT, RIGHT, UP and DOWN respectively. https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/Keys.java?name=selenium-2.0-beta-2
score: 0
type: Comment

http://stackoverflow.com/a/25316698
downvote count: 0
has comment: http://stackoverflow.com/comment/39462622
answers question: http://stackoverflow.com/q/25316605
type: Answer
score: 5
upvote count: 5
has body: Two of your constants are off, otherwise your code is fine. Jupiter's mass looks low compared to the rest of the planets. This page lists it as 1.90e27 kg, not 1.90e24 kg - you're off by a factor of 1,000. The gravitational constant is off by a factor of 10 because you used 10e-11 instead of 1e-11 for the exponential part of the constant. You can use one double literal for the gravitational constant if you'd like. 6.67E-11

routes
type: Tag
tags question: http://stackoverflow.com/q/25328497
tag name: routes

http://stackoverflow.com/comment/39546257
has text: @ErikMadsen it's not a matter of "thought police", it's a matter of "use exceptions for exceptional conditions" - this answer presents it as if there are two alternatives: Be an idiot and don't handle exceptions at all or use exceptions for flow control where in fact there are solutions other than that. What if the OP is serializing into a file called "Top 5 MyObjects" and they are always reading 5 items? What if they are serializing an ArrayList and they don't really care about space complexity _that_ much? What if serialization isn't even the correct approach here?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25362559

http://stackoverflow.com/q/25312505
has comment: http://stackoverflow.com/comment/39455728
type: Question
has comment: http://stackoverflow.com/comment/39455035
type: AnsweredQuestion
score: 3
has title: Set RegEx in Java to be non-greedy by default
has body: I have Strings like the following: "parameter: param0=true, param1=401230 param2=asset client: desktop" "parameter: param0=false, param1=15230 user: user213 client: desktop" "parameter: param0=false, param1=51235 param2=asset result: ERROR" The pattern is parameter:, then the param's, and after the params either client: and/or user: and/or result. I want to match the stuff between parameter: and the first occurrence of either client:, user: or result: So for the 2nd String it should match param0=false, param1=15230. My regex is: parameter:\s+(.*)\s+(result|client|user): But now if I match the 2nd String it captures param0=false, param1=15230 user: user213 (looks like regex is matching greedy) How to fix this? parameter:\s+(.*)\s+(result|client|user)+?: won't fix it With this regex tester I can add the modifier U to the regex to make regex lazy by default, is this possible in Java too?
has comment: http://stackoverflow.com/comment/39455047
has answer: http://stackoverflow.com/a/25312647
possible better answer: http://stackoverflow.com/a/25312647
tagged with: regex
has answer: http://stackoverflow.com/a/25312574
accepted answer: http://stackoverflow.com/a/25312574
answer count: 2
upvote count: 3
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39455763
linked to: http://stackoverflow.com/q/22937618
tagged with: string
favorite count: 0

http://stackoverflow.com/a/36920281
answers question: http://stackoverflow.com/q/25346512
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/71604295
has comment: http://stackoverflow.com/comment/94335357
has comment: http://stackoverflow.com/comment/94656862
score: 1
type: Answer
has body: keep the data inside [ ] like [{"id_user":"10","level":"medium","text":"hello 10"} {"id_user":"20","level":"medium","text":"hello 20"} {"id_user":"30","level":"medium","text":"hello 30"}] inside the file so that it becomes a list then you can use JSONArray . the way I wrote is as follows public class JSONReadFromFile { @SuppressWarnings("unchecked") public static void main(String[] args) { JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("\\D:\\JSON\\file3.txt")); JSONArray jsonArray = (JSONArray) obj; int length = jsonArray.size(); LinkedList author = new LinkedList(); for (int i =0; i&lt; length; i++) { JSONObject jsonObject = (JSONObject) jsonArray.get(i); Set s = jsonObject.entrySet(); Iterator iter = s.iterator(); HashMap hm = new HashMap(); while(iter.hasNext()){ Map.Entry me = (Map.Entry) iter.next(); hm.put(me.getKey(), me.getValue()); } author.add(hm); } for(int i=0;i&lt;author.size();i++){ HashMap hm = (HashMap) author.get(i); Set s = hm.entrySet(); Iterator iter = s.iterator(); while(iter.hasNext()){ Map.Entry me = (Map.Entry) iter.next(); System.out.println(me.getKey() + "---" + me.getValue()); } } catch (Exception e) { e.printStackTrace(); } } } The output I get is text---hello 10 id_user---10 level---medium text---hello 20 id_user---20 level---medium text---hello 30 id_user---30 level---medium

http://stackoverflow.com/q/25378231
tagged with: jtable
has comment: http://stackoverflow.com/comment/39581441
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: swing
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25378364
tagged with: imageicon
type: Question
has answer: http://stackoverflow.com/a/25378364
has body: I trying to add image using ImageIcon class to jTable cell , but i get in the cell sun.awt.image.ToolkitImage@196a4632 where it supposed to display image in the cell the code i tried : JTable jTable; String[] columns={"Page No","Chapter","Image"}; Object[][] rows={{1,4,null},{2,7,null}}} public Tab_ImgIcn(){ ImageIcon icon=new ImageIcon(getClass().getResource("exit.png")); jTable= new JTable(rows, columns); jTable.setValueAt(icon.getImage(), 0,3); JScrollPane jps = new JScrollPane(jTable); frame.add(jps); }
tagged with: java
has title: Can't add image using ImageIcon to jTable cell

http://stackoverflow.com/q/25275145
tagged with: android
has comment: http://stackoverflow.com/comment/39386030
has body: I would like to know how can I make my app available at the share screen to receive shared information/content: How may I program this (in Java, being NetBeans or Oracle IDE) ((IF its possible in App Inventor 2 would be pretty much better!) Probably as I think i'll be needing a function like: OnReceiveSharedContent() and another statement to make it visible in the screen.
has title: How can I add my app in the list of "SHARE" in android? (and receive the shared info)
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39385820
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/13596882
type: UnansweredQuestion

http://stackoverflow.com/q/25250802
accepted answer: http://stackoverflow.com/a/25251603
type: Question
has answer: http://stackoverflow.com/a/25251603
has comment: http://stackoverflow.com/comment/39340717
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39341049
tagged with: swing
has body: I am new to Java and OOP at all. I'm trying to create a simple calculator using Java Swing. I want the user to be not able to enter zero after the first one if there is no dot added. I've been brainstorming for a lot of time and I couldn't find a solution :( Right now if there is only one number entered (different from 0) you can't enter 0. Works in every other case. Here is part of my code: public class Calculator extends JFrame implements ActionListener { boolean hasDot = false; boolean hasNull = false; JButton button0; JButton buttonDot; JTextArea text; public Calculator(){ //Constructor comes here button0 = new JButton("0"); buttonDot = new JButton("."); text = new JTextArea(1, 20); } public void actionPerformed(ActionEvent e) { if (e.getSource() == button0) { if (text.getText().length() &gt; 0) hasNull = true; if (hasNull == false) { text.append("0"); hasNull = true; } if (hasNull == true &amp;&amp; hasDot == true) { hasNull = false; text.append("0"); } if (text.getText().length() &gt; 1 &amp;&amp; hasDot == false) text.append("0"); } if (e.getSource() == buttonDot &amp;&amp; (hasDot == false) &amp;&amp; text.getText().length() != 0) { text.append("."); hasDot = true; hasNull = false; } } }
answer count: 1
has title: Java: Simple Calculator(data validation)
has comment: http://stackoverflow.com/comment/39341524

http://stackoverflow.com/comment/39540528
type: Comment
type: QuestionComment
has text: Could you also post your html page? Mayby something isn't submitted...
comment on: http://stackoverflow.com/q/25359512
score: 0

http://stackoverflow.com/q/25265096
has comment: http://stackoverflow.com/comment/39367086
tagged with: slf4j
answer count: 0
tagged with: jsf
score: 0
tagged with: java
has title: slf4j apache tomcat eclipse
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39367407
type: Question
has body: hello I am currently building a java EE app with eclipse and I am trying to add slf4j to a servlet but nothing works as it should. I literally put the logback.xml file in every directory of my project but and edited so the messages at the console are customized and not the defaults ones but the console output is always the same. Is it related that I use the apache-tomcat server ? Else can you tell me in which directory should I put the logback.xml file? Also should I add the log4j.properties file somewhere? In some tutorials it doesn't exists whereas on other it does. here's the directory of my project I have this servlet that writes to the logger: @WebServlet("/checkConnection") public class checkConnection extends HttpServlet { private static final long serialVersionUID = 1L; static final Logger LOG = LoggerFactory.getLogger(RegBean.class); public checkConnection() { LOG.trace("Hello World!"); LOG.debug("How are you today?"); LOG.info("I am fine."); LOG.warn("I love programming."); LOG.error("I am programming."); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } } here's the logback.xml file <?xml version="1.0" encoding="UTF-8"?> [%thread] %-5level %logger{5} - %msg%n <appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" /> and here is the console output: Αυγ 12, 2014 4:23:56 ΜΜ servlets.checkConnection <init> INFO: I am fine. Αυγ 12, 2014 4:23:56 ΜΜ servlets.checkConnection <init> WARNING: I love programming. Αυγ 12, 2014 4:23:56 ΜΜ servlets.checkConnection <init> SEVERE: I am programming. According to the configuration file the output shouldn't include the date, right? So I think that logger hasn't identified the configuration file.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39367193

http://stackoverflow.com/a/25373786
has comment: http://stackoverflow.com/comment/39605103
has comment: http://stackoverflow.com/comment/39606529
downvote count: 0
has comment: http://stackoverflow.com/comment/39568150
has comment: http://stackoverflow.com/comment/39568195
has comment: http://stackoverflow.com/comment/39571048
answers question: http://stackoverflow.com/q/25373449
has comment: http://stackoverflow.com/comment/39571070
type: Answer
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/39568681
has body: Start by creating a concept of a "shape", which knows how to paint it self, at a specified location and with a specified color Change your CanvasDrawArea to allow it to accept different instances of this "shape" and repaint itself. Create your JComboBox and place it within the same container as the CanvasDrawArea, but not within it. When the user changes the selection, tell the instance of the CanvasDrawArea to change the shape accordingly... The core concept is, the CanvasDrawArea is responsible for drawing the shape, that's it. You allow the shape to be changed by some means, via a series of setters and getters, which provides flexibility, but doesn't tie you into a given mechanism (so that the only to change the shape is by triggering an ActionEvent), but allows you to change the way in which the shape changing mechanism works (such as via a random selection, radio buttons or list for example) For example... class CanvasDrawArea extends JPanel { //... private MyShape shape; //.. public void setShape(MyShape shape) { this.shape = shape; repaint(); } public MyShape getShape() { return shape; } //... public void paintComponent(Graphics rect) { super.paintComponent(rect); MyShape shape = getShape(); if (shape != null) { shape.paint(rect); } } } Don't update the state of your component (or any other component) from within any paint method, for example; setBackground(CANVAS_BACKGROUND); is a really bad idea. This will schedule another repaint which could cause the repaint manager to repeatedly repaint your component, consuming your CPU. Instead you should have been setting this values before hand, perhaps in the constructor... Start by defining the concept of a "shape" and define it's requirements, for example... public interface MyShape { public void setLocation(int x, int y); public void setSize(int width, int height); public void setColor(Color color); public int getX(); public int getY(); public int getWidth(); public int getHeight(); public Color getColor(); publi…

http://stackoverflow.com/q/25372162
score: 2
has title: Why the compiler can't capture the wildcard in this case
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39565224
has body: I am reading an wildcard example in wildcard capture and helper methods in The Java tutorial. I don't understand why the compiler produces a capture error when compiled: import java.util.List; public class WildcardError{ void foo(List&lt;?&gt; i){ i.set(0, i.get(0)); } } Why does the compiler processes the iinput as being of type object?
duplicate of: http://stackoverflow.com/q/12043874
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39565163
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39565111
downvote count: 0
has comment: http://stackoverflow.com/comment/39565317
linked to: http://stackoverflow.com/q/12043874

http://stackoverflow.com/comment/39439303
has text: @ajb I won't debate this with you. C# implements something that is similar, which is like "everything in this jar can see internal methods on everything else in this jar." That's good enough for me.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25296842
type: AnswerComment

http://stackoverflow.com/comment/39422360
has text: @Error That also works. Like I said, it seems like a 32 bit versus 64 bit issue. When I run these batch files a java.exe process is created, but when I run by double clicking a java.exe *32 process is created and it doesn't work. Is there a way to export a 32 bit compatible .jar? Alternately maybe it's a library issue? I'm using the Java Swing gui library, so maybe that's working with the JDK but not with the JRE? Still trying to understand this all.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25294533
score: 0

http://stackoverflow.com/a/25299144
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39460793
has comment: http://stackoverflow.com/comment/39461104
accepted answer of: http://stackoverflow.com/q/25298962
answers question: http://stackoverflow.com/q/25298962
type: Answer
has body: Yes. Image click listener: ImageView img = (ImageView) findViewById(R.id.myImageId); img.setOnClickListener(new OnClickListener() { public void onClick(View v) { WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); try { Bitmap bitmap=((BitmapDrawable)img.getDrawable()).getBitmap(); if(bitmap!=null) myWallpaperManager.setBitmap(bitmap); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); I think something like below would work in your code: gallery.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { selectedImagePosition = pos; if (selectedImagePosition &gt; 0 &amp;&amp; selectedImagePosition &lt; drawables.size() - 1) { leftArrowImageView.setImageDrawable(getResources().getDrawable(R.drawable.arrow_left_enabled)); rightArrowImageView.setImageDrawable(getResources().getDrawable(R.drawable.arrow_right_enabled)); } else if (selectedImagePosition == 0) { leftArrowImageView.setImageDrawable(getResources().getDrawable(R.drawable.arrow_left_disabled)); } else if (selectedImagePosition == drawables.size() - 1) { rightArrowImageView.setImageDrawable(getResources().getDrawable(R.drawable.arrow_right_disabled)); } changeBorderForSelectedImage(selectedImagePosition); setSelectedImage(selectedImagePosition); selectedImageView .setOnClickListener(new OnClickListener() { public void onClick(View v) { WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); try { Bitmap bitmap=((BitmapDrawable)selectedImageView .getDrawable()).getBitmap(); if(bitmap!=null) myWallpaperManager.setBitmap(bitmap); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } or something like below : gallery.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { …
score: 0

http://stackoverflow.com/a/25263424
has body: Jackpot - nothing in your title is a problem! First, you probably aren't actually using BouncyCastle. Sun/Oracle Java 7 and 8 now includes an EC provider (earlier versions did not) and the one-arg form of getInstance uses the first available provider, which is normally SunEC unless you or someone has altered the provider list. TO VERIFY A SIGNATURE: pass the same data to the verifying Signature.update() as you passed to the signing Signature.update(). Exactly the same, byte for byte. Pass the signature value only to Signature.verify(). Putting PrivateKey.toString() in the data is silly; this value is specific to the running Java process, so you'll have to send it to the receiving process (if different, as it normally should be) where it is useless and a waste of space. TO USE A STATIC KEY: do just that. Create a keypair and store it someplace, then read it in and use it. The easiest secure (password protected) store is a Java KeyStore (JKS) file, but that requires a certificate chain (perhaps a dummy one) which is a nuisance to code yourself; fortunately the keytool utility with -genkeypair generates a keypair with a dummy selfsigned certificate, and for -keyalg ec -keysize 256 it uses the (very popular) secp256r1 curve. Also specify -alias name of your choice, -keystore filename, any names you like for the dummy cert, and passwords. To use a keypair from a JKS file: use java.security.KeyStore.getInstance("JKS") to create a store object and pass .load(InputStream,char[]) a FileInputStream on the file, and the password. use .getKey(String alias,char[] password) and cast to get the PrivateKey. Use for signing. use .getCertificateChain(String alias)[0].getPublicKey() to get the PublicKey from the first (only) cert. Use for verifying.
answers question: http://stackoverflow.com/q/25261823
accepted answer of: http://stackoverflow.com/q/25261823
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/39402036
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25304934
accepted answer: http://stackoverflow.com/a/25305052
has body: I'm in difficult situation in which I need to (because of the bug) synchronize two threads, but I'm not creator of those two threads (it's part of software I'm using). There are two threads in my application working with "same" data, but each thread has it's own copy of the data. What I want to achieve is, that one thread will do nothing (I can modify executed code) when it find (somehow) that another thread did the work already (I do not want to do that work again). I have an identifier in data, that I can use to "mark" the work as done. Where? Which object instance use for that? That's my question. I'm looking for some hints/ideas. Pure Java is preferred in worst case I can use some library.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25305052
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25305519
tagged with: multithreading
has answer: http://stackoverflow.com/a/25305519
has comment: http://stackoverflow.com/comment/39441052
has title: How to synchronize two thread that are not mine
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39441150

http://stackoverflow.com/a/25240655
score: 0
has comment: http://stackoverflow.com/comment/39322712
answers question: http://stackoverflow.com/q/25240345
has body: Not exactly sure what you are hinting by the build-number, Are you referring a single instance of build? or the version of project? If it's the version of project, you can simply, define a maven property as &lt;properties&gt; &lt;project.buildNumber&gt;4.5.64452&lt;/project.buildNumber&gt; &lt;!-- any name can be given here --&gt; &lt;/properties&gt; and use it as {project.buildNumber} where you need it in the pom.xml. If you intend to automate the process of copying files to a specific directory on each build, have a look at the Assembly Plugin. Not aware of any workaround or plugin that creates directory as you need. But some pointers worth exploring and hope you find it useful - What is maven snapshot? See if you can re-use the timestamp somehow. - One tutorial explaining this.
type: Answer

http://stackoverflow.com/a/25321017
accepted answer of: http://stackoverflow.com/q/25320934
type: Answer
answers question: http://stackoverflow.com/q/25320934
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: Try changing this this final AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Help :"); alertDialog.setMessage("Welcome to AndroidHive.info"); alertDialog.setButton(1,"OK", new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { // TODO Auto-generated method stub alertDialog.cancel(); } }); alertDialog.show(); To final AlertDialog alertDialog = new AlertDialog.Builder(this) .setTitle("Help :") .setMessage("Welcome to AndroidHive.info") .setNegativeButton("OK", new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { // TODO Auto-generated method stub alertDialog.cancel(); } }) .create(); alertDialog.show();

http://stackoverflow.com/comment/39379497
score: 0
type: Comment
type: AnswerComment
has text: @TavianBarnes oops, yes, you're right - the `rem == 0` case is (potentially) tail recursive but the odd case isn't.
comment on: http://stackoverflow.com/a/25268979

http://stackoverflow.com/q/25359818
type: Question
possible better answer: http://stackoverflow.com/a/25360383
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/25360383
score: 1
has title: Array / Vector as method argument
tagged with: java
has comment: http://stackoverflow.com/comment/39541287
has comment: http://stackoverflow.com/comment/39541271
has comment: http://stackoverflow.com/comment/39541232
has answer: http://stackoverflow.com/a/25360099
answer count: 4
has body: I have always read that we should use Vector everywhere in Java and that there are no performance issues, which is certainly true. I'm writing a method to calculate the MSE (Mean Squared Error) and noticed that it was very slow - I basically was passing the Vector of values. When I switched to Array, it was 10 times faster but I don't understand why. I have written a simple test: public static void main(String[] args) throws IOException { Vector &lt;Integer&gt; testV = new Vector&lt;Integer&gt;(); Integer[] testA = new Integer[1000000]; for(int i=0;i&lt;1000000;i++){ testV.add(i); testA[i]=i; } Long startTime = System.currentTimeMillis(); for(int i=0;i&lt;500;i++){ double testVal = testArray(testA, 0, 1000000); } System.out.println(String.format("Array total time %s ",System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); for(int i=0;i&lt;500;i++){ double testVal = testVector(testV, 0, 1000000); } System.out.println(String.format("Vector total time %s ",System.currentTimeMillis() - startTime)); } Which calls the following methods: public static double testVector(Vector&lt;Integer&gt; data, int start, int stop){ double toto = 0.0; for(int i=start ; i&lt;stop ; i++){ toto += data.get(i); } return toto / data.size(); } public static double testArray(Integer[] data, int start, int stop){ double toto = 0.0; for(int i=start ; i&lt;stop ; i++){ toto += data[i]; } return toto / data.length; } The array one is indeed 10 times faster. Here is the output: Array total time 854 Vector total time 9840 Can somebody explain me why ? I have searched for quite a while, but cannot figure it out. The vector method appears to be making a local copy of the vector, but I always thought that objects where passed by reference in Java.
has comment: http://stackoverflow.com/comment/39541189
has comment: http://stackoverflow.com/comment/39541207
accepted answer: http://stackoverflow.com/a/25359879
tagged with: vector
upvote count: 2
has answer: http://stackoverflow.com/a/25359879
has comment: http://stackoverflow.com/comment/39543764
linked to: http://stackoverflow.com/q/1386275
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25434330

http://stackoverflow.com/comment/39507432
comment on: http://stackoverflow.com/a/25340418
score: 0
type: Comment
type: AnswerComment
has text: I can't believe I did not see that, I have read that at least 3 times... Thank you so much! Even if I have to admit I feel really dumb right now.

http://stackoverflow.com/q/25377221
tagged with: jython
upvote count: 0
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39575435
favorite count: 0
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25379199
score: -2
has answer: http://stackoverflow.com/a/25379199
tagged with: jira
type: AnsweredQuestion
has body: This is my post function. I am working on jython scripting suite. from java.util import Calendar from java.util import Date import com.atlassian.jira.component.ComponentAccessor from com.atlassian.jira import ComponentManager from com.atlassian.jira.issue import Issue from java.sql import Timestamp import java import time ts = long(time.time()) issue.setDueDate(java.sql.Timestamp(ts)) issue.store() and this is what i am getting error Issue workflow initialization error: unable to find Issue created with workflowId '10694'. Did the IssueCreateFunction run successfully on workflow.initialize() ?
tagged with: python-jira
has title: I am getting error when set duedate creating issue in jira

http://stackoverflow.com/q/25318298
score: 1
tagged with: java
tagged with: hibernate
answer count: 1
has body: I am trying to teach myself how to utilize Hibernate. I am working on Ubuntu 14.0.4 using Eclipse Luna. I have come across some tutorials showing how to use hibernate itself but not really a definitive one for how to actually set it up and use it within a project in eclipse. I am hoping that someone can shed some light on that. As of now I have downloaded hibernate_release_4.3.6 from the official website and I have installed JBoss in eclipse. I was hoping that JBoss would just install the hibernate stuff for me (and maybe it did) but I am still no closer to using it or importing it into a project. Any guidance on this would be useful.
downvote count: 0
tagged with: eclipse
favorite count: 0
type: Question
has title: How to setup Hibernate with Eclipse (Luna) on Ubuntu
tagged with: jboss
tagged with: ubuntu
has answer: http://stackoverflow.com/a/25318453
accepted answer: http://stackoverflow.com/a/25318453
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/q/25259651
tagged with: java
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25259714
has body: I have two if statements in my code, but when both are true, it only only makes the second if. How should I write it? String s1 = editTextl.getText().toString(); double d = 0; if (s1.contains("H")) { d = + H; //H is double with value of 1 } if (s1.contains("O")) { d = + O; //O is double with value of 16 } TextView.setText(" " + getString(R.string.vysledek) + " " + d); When I type HO in EditText, TextView should return value of 17, but it returns only 16. Why?
has comment: http://stackoverflow.com/comment/39357188
type: Question
has answer: http://stackoverflow.com/a/25259741
accepted answer: http://stackoverflow.com/a/25259692
answer count: 5
upvote count: 1
has answer: http://stackoverflow.com/a/25259692
possible better answer: http://stackoverflow.com/a/25259697
has answer: http://stackoverflow.com/a/25259697
has answer: http://stackoverflow.com/a/25259756
has title: Two if statements, only one works
type: AnsweredQuestion
score: 0
tagged with: android

jce
tags question: http://stackoverflow.com/q/25320705
type: Tag
tags question: http://stackoverflow.com/q/25382733
tag name: jce

http://stackoverflow.com/q/25355355
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39532936
has body: I have an activity that has 3 fragments where each pulls a collection of information for a user on each page. I have set it up in a way where there is only 2 users in the list, the third fragment would redirect itself to the second one, and if there is only 1 user than the second fragment would redirect itself upon swipe to the first one. Below is the code i use to switch between fragments: Fragment mFragment = new Fragment1(); getFragmentManager().beginTransaction() .replace(R.id.Fragment1, mFragment ).commit(); Below is the complete code public class Fragment2 extends Fragment { private String currentUserId; private ArrayAdapter<String> namesArrayAdapter; private ArrayList<String> names; private ListView usersListView; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setConversationsList(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment2_layout, container, false); return view; } private void setConversationsList() { currentUserId = ParseUser.getCurrentUser().getObjectId(); names = new ArrayList<String>(); // String userActivitySelectionName = null; ParseQuery<ParseUser> query = ParseUser.getQuery(); // query.whereEqualTo("ActivityName",userActivitySelectionName); query.whereNotEqualTo("objectId", ParseUser.getCurrentUser().getObjectId()); // users with Gender…
answer count: 0
tagged with: android-fragments
score: 0
tagged with: java
has title: Issues switching between fragments
has comment: http://stackoverflow.com/comment/39532964
type: Question
tagged with: android-layout
tagged with: parse-platform

http://stackoverflow.com/q/25279741
has body: Unable to set java heap space using -Xmx to 2GB or more even though the RAM size is 16GB. I encounter an error saying " Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit" This is seen while starting a Jenkins server on my Win2008 x64 machine. Please let me know if I could change any system parameter which will allow me to allocate more memory. Thanks
has answer: http://stackoverflow.com/a/25279841
tagged with: jvm
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25279793
tagged with: java
has comment: http://stackoverflow.com/comment/39393939
accepted answer: http://stackoverflow.com/a/25280325
has answer: http://stackoverflow.com/a/25280031
answer count: 4
tagged with: jvm-arguments
has comment: http://stackoverflow.com/comment/39393713
has answer: http://stackoverflow.com/a/25280325
has comment: http://stackoverflow.com/comment/39393534
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39393457
has title: Unable to set java heap space > 2GB on Win2008 64bit
tagged with: jenkins
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25279793
downvote count: 0
has comment: http://stackoverflow.com/comment/39393903

http://stackoverflow.com/comment/39554569
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25366838
has text: Seems like a legal usage of reflection. In fact, many frameworks that map classes to database tables writing objects into them simply use reflection for that.
type: Comment

http://stackoverflow.com/comment/39571340
has text: See the answers here: http://stackoverflow.com/questions/3035831/solr-lucene-scorer
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25361900
type: Comment

http://stackoverflow.com/q/25231346
has body: I have been experimenting with Pig to access HBase with the HBaseStorage class. I am finding strange behavior with the means HBaseStorage employs to match columns. Consider the following example: test = load 'hbase://resultstable' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('foo:fail','-loadKey false') as (testresults:map[]); It is certain that the column family 'foo' and the column name 'fail' exist and that records exist in this column. The query returns no records. However the following query returns records: test = load 'hbase://resultstable' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('foo:fail*','-loadKey false') as (testresults:map[]); Note the difference between the two examples in that the latter uses 'foo:fail*' as a parameter. My guess is that there is a null terminator being stored in the column name and the binary exact match comparison fails because in the first example the null terminator is not explicitly passed (it shouldn't be in my opinion). The column 'foo:fail' was created using standard HBase libraries via a java string containing the column name being passed to the appropriate HBase java API call. Is this expected behavior? All the documentation (including the O'Reilly book) do not allude that it is. Pig version is 0.13.0. HBase version is 0.94.10.
answer count: 1
type: Question
tagged with: hadoop
tagged with: hbase
has title: Using Pig to Access HBASE with HBaseStorage
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25244729
tagged with: apache-pig
has answer: http://stackoverflow.com/a/25244729
tagged with: java

http://stackoverflow.com/comment/39404734
has text: javax.print package is not a part of android api
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25285680

http://stackoverflow.com/comment/39411117
score: 0
comment on: http://stackoverflow.com/q/25289107
type: QuestionComment
has text: Now are you trying to drop the data in the database and re-create it or are you wishing to actually rename it all together?
type: Comment

http://stackoverflow.com/comment/47436136
has text: So any exception in constructor leads to "could not instantiate class" error. right?
comment on: http://stackoverflow.com/a/25322625
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39349503
comment on: http://stackoverflow.com/a/25255429
type: AnswerComment
score: 0
has text: @user3896367 it happened when you are changing activities or restarting the activity. To learn more go here http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
type: Comment

http://stackoverflow.com/q/25353124
upvote count: 1
answer count: 1
favorite count: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25353215
has title: Efficiently re-arrange a List<Object> after removing X objects
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25353215
downvote count: 0
has body: After working on a small database project I've stumbled across an issue. I have a Student object who's ID is dependent on the JTable row number (thus nothing not 'synced' with the List&lt;Student&gt; students that I have stored) . After removing multiple Student objects I'd notice that the list.get(int index) would not be the same as JTable#getRow(int row). After doing a bit of personal work I came up with the following. public class ListIDTest { public static void main(String[] args) { List&lt;Object&gt; objects = new ArrayList&lt;&gt;(); objects.add(new Object("First", 1)); objects.add(new Object("Second", 2)); objects.add(new Object("Third", 3)); String temp = JOptionPane.showInputDialog(null, "ID", "Remove", JOptionPane.INFORMATION_MESSAGE); objects.remove(Integer.parseInt(temp) - 1); for(Object o : objects){ System.out.println("Object name: " + o.getName()); System.out.println("Object ID: " + o.getId()); } } } Case one: Input: 3 Output: Object name: First Object ID: 1 Object name: Second Object ID: 2 Case two: Input: 2 Output: Object name: First Object ID: 1 Object name: Third Object ID: 3 The issue in case 2 is that the database will now print the two Students with S. ID 1 &amp; 2, instead of 1 &amp; 3 (As the list index is) . I would like to keep the JTable to print S.ID in incremented order and not jump, instead I should re-arrange the list in an efficient manner to now change the List index back to the same as the S.ID in the JTable. I could obviously declare a new List&lt;Student&gt; temp and add the current list to it and then save the collection, however I don't think that's an efficient way to do it if I have say 200-300 Students~. Any suggestions?
score: 1

http://stackoverflow.com/a/25780195
answers question: http://stackoverflow.com/q/25364802
has comment: http://stackoverflow.com/comment/40328261
type: Answer
score: 0
has body: Can you please check if this can solve your problem. If yours is a permission issue, then this works. public static void main(String[] args) { //set user group information UserGroupInformation ugi = UserGroupInformation.createRemoteUser("hdfs"); //set privilege exception ugi.doAs(new PrivilegedExceptionAction&lt;Void&gt;() { public Void run() throws Exception { //create configuration object Configuration config = new Configuration(); config.set("fs.defaultFS", "hdfs://ip:port/"); config.set("hadoop.job.ugi", "hdfs"); FileSystem dfs = FileSystem.get(config); . .

http://stackoverflow.com/comment/39527567
type: Comment
type: QuestionComment
score: 0
has text: Yes, that's a glaringly obvious copy/paste error. Thanks. I'll fix it.
comment on: http://stackoverflow.com/q/25351666

http://stackoverflow.com/a/25233505
accepted answer of: http://stackoverflow.com/q/25232782
has comment: http://stackoverflow.com/comment/39309240
has comment: http://stackoverflow.com/comment/39309138
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25232782
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39309026
has comment: http://stackoverflow.com/comment/39309335
has body: You should check out https://github.com/greenrobot/EventBus Examples can be found here: http://awalkingcity.com/blog/2013/02/26/productive-android-eventbus/ Basically lets you do stuff like: @Override public void onConnected(Bundle bundle) { mIntentService = new Intent(this, LocationService.class); // could be any object EventBus.getDefault().postSticky(database); ... mPendingIntent = PendingIntent.getService(this, 1, mIntentService, 0); } And whenever you need the object public class LocationService extends IntentService { ... public LocationService(StartActivity startActivity, DatabaseSQLite db, HomeFragment homeFragment) { super("Fused Location Service"); ... } @Override public int onStartCommand(Intent intent, int flags, int startId) { // could also be in Broadcast Receiver etc.. db = EventBus.getDefault().getStickyEvent(DatabaseSQLite.class); ... return START_REDELIVER_INTENT; } } Not only is it simpler, this link also shows that it outperforms other methods: http://www.stevenmarkford.com/passing-objects-between-android-activities/
has comment: http://stackoverflow.com/comment/39309189
has comment: http://stackoverflow.com/comment/39309647
has comment: http://stackoverflow.com/comment/39308968
has comment: http://stackoverflow.com/comment/39309417
has comment: http://stackoverflow.com/comment/39308658
type: Answer
has comment: http://stackoverflow.com/comment/39308984

http://stackoverflow.com/comment/39384987
score: 0
type: Comment
has text: @mimi it is not working?? So you want it to first fade_out and then fade_in then change activity.. Am I right?
type: AnswerComment
comment on: http://stackoverflow.com/a/25274434

http://stackoverflow.com/a/25341275
answers question: http://stackoverflow.com/q/25338985
has body: The GridData has to be applied to the Texts, no their parent. So you'll have to "touch" them: public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(2, false)); new Label(shell, SWT.NONE).setText("name"); Text name = new Text(shell, SWT.BORDER); name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(shell, SWT.NONE).setText("memory"); Text memory = new Text(shell, SWT.BORDER); memory.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(shell, SWT.NONE).setText("processors"); Text processors = new Text(shell, SWT.BORDER); processors.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } Looks like this: UPDATE Ok, thought about your requirement again, and came up with another solution. In this solution you don't have to have a reference to the actual Text objects, but you'll search for them instead: public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(2, false)); new Label(shell, SWT.NONE).setText("name"); new Text(shell, SWT.BORDER); new Label(shell, SWT.NONE).setText("memory"); new Text(shell, SWT.BORDER); new Label(shell, SWT.NONE).setText("processors"); new Text(shell, SWT.BORDER); applyGridData(shell); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } private static void applyGridData(Control parent) { if(parent instanceof Text) { parent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); } else if(parent instanceof Composite) { Composite comp = (Composite) parent; for(Control control : comp.getChildren()) applyGridData(control); } } Basically,…
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39551885
has text: I've edited the code claryfing I'm getting managed entities, sorry for being not clear.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25365271
type: Comment

http://stackoverflow.com/comment/39456444
score: 0
comment on: http://stackoverflow.com/q/25313214
type: QuestionComment
has text: No no no buddy. I need get the FINAL output buffer of page to make translation and minify the page. See example in PHP code.
type: Comment

http://stackoverflow.com/q/25344676
tagged with: java
has answer: http://stackoverflow.com/a/25344996
has body: I am new to Java and Eclipse. Somehow, my ui is not showing up the right way. Instead of seeing my frame, with the x to close at the top right, etc, and all the controls, I see a frame with no border. See here: http://s7.postimg.org/miprf5ul7/Noooooooooooo.png Here's my code: https://www.dropbox.com/s/74mltgsxcs9vjnf/PDF%20Monster.zip I've spent countless hours working on this. Please help me restore my UI, I'm desperate. Thank you,
tagged with: eclipse
has title: Eclipse -> Java -> GUI Builder -> Can't get my UI to show properly in design mode
type: Question
tagged with: gui-builder
has comment: http://stackoverflow.com/comment/39514580
answer count: 1
has comment: http://stackoverflow.com/comment/39514508
has comment: http://stackoverflow.com/comment/39514571
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25344996

http://stackoverflow.com/q/25250248
has comment: http://stackoverflow.com/comment/39339506
has body: I am newly learning Java Event handling. I wrote a code but it shows an error while I try to call a Constructor of class MyGUI from the main method. Please have a look and explain the following error to me. Error: No enclosing instance of type MyGUI is accessible. Must qualify the allocation with an enclosing instance of type MyGUI (e.g. x.new A() where x is an instance of MyGUI). My code: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class MyGUI extends JPanel { JButton button; JTextField textField; JRadioButton radioButton; MyGUI(){ add(new JButton("Button")); add(new JTextField(10)); add(new JRadioButton("RadioButton")); } class MyHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==button) { JOptionPane.showMessageDialog(null, "Button has been clicked"); } else if(e.getSource()==textField) { JOptionPane.showMessageDialog(null, "TextField has been clicked"); } else if(e.getSource()==radioButton) { JOptionPane.showMessageDialog(null, "RadioButton has been clicked"); } } } public static void main(String[]args) { MyGUI gui=new MyGUI(); MyHandler handler=new MyHandler(); //Error Shows on this statement gui.button.addActionListener(handler); JFrame frame=new JFrame("Its a frame"); frame.add(gui); frame.setVisible(true); frame.setSize(500,500); frame.setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
has comment: http://stackoverflow.com/comment/39339593
has comment: http://stackoverflow.com/comment/39339717
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/59243101
tagged with: java
has title: An error regarding Exception Handling in JAVA
has comment: http://stackoverflow.com/comment/39339576
score: -1
has comment: http://stackoverflow.com/comment/39339499
upvote count: 0
has comment: http://stackoverflow.com/comment/39339518
answer count: 1
has answer: http://stackoverflow.com/a/25250328
has comment: http://stackoverflow.com/comment/39339543
downvote count: 1
linked to: http://stackoverflow.com/q/9560600
favorite count: 0
type: Question

http://stackoverflow.com/comment/39398432
score: 0
type: Comment
has text: Java doesn't use C style ('\0' char terminated) strings or byte sequences.
type: AnswerComment
comment on: http://stackoverflow.com/a/25282311

http://stackoverflow.com/comment/39372809
has text: "The second problem is even before I click the button, the Toast shows up. I assumed when I called wait(), all code would wait until I clicked the button, where notify() would be called and the code would be continued. But what happens instead is that the Toast is seemingly ignoring the wait() and running anyways." this is because you have 3 threads in the code, one UI thread that continue the execution and 2 different threads you created, UI thread jumps from creation of threads and continue so it faces your toast !!!
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25267571
type: Comment

http://stackoverflow.com/a/25309339
answers question: http://stackoverflow.com/q/25301913
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39456010
has body: Yes. In this situation, if the queue becomes full, the calling thread will block (in your situation, the main thread). So this is a bad design. The produced data coming from a field of an Activity doesn't force you to use it on the main thread. I suggest you use some Handler for your producer running on its own thread which will allow you to make the processing (and eventually waiting on the queue) outside of the main thread. This is also good for communicating with your Service since you can use Handlers to communicate with a Service (see Android Services' guide). Finally, if applying the produced data can be passed directly to an Handler using either Handler.post(Runnable) or Handler.send(Message)
accepted answer of: http://stackoverflow.com/q/25301913
score: 1
type: Answer

http://stackoverflow.com/q/25371274
answer count: 4
favorite count: 0
type: Question
upvote count: 5
has body: I'm trying to update a row in my database. Here is the code I am trying to use to update: public void addFBComments(int id){ SQLiteDatabase db = this.getWritableDatabase(); String query = "UPDATE " + TABLE_FB_FEED + " SET " + COL_FB_COMMENTS+"="+"HELLO" + " WHERE " + COL_FB_ID+"="+id; db.execSQL(query); } When I run the command, it throws this error: 08-18 15:42:10.145: E/AndroidRuntime(10493): FATAL EXCEPTION: Thread-922 08-18 15:42:10.145: E/AndroidRuntime(10493): android.database.sqlite.SQLiteException: no such column: HELLO (code 1): , while compiling: UPDATE fb_feed SET fb_comments= HELLO WHERE _id=3 Here is the TABLE_FB_FEED: private static final String TABLE_FB_FEED_CREATE = "create table " + TABLE_FB_FEED + " (" + COL_FB_ID + " integer primary key autoincrement not null," + COL_FB_MESSAGE + " text," + COL_FB_CAPTION + " text," + COL_FB_POSTER_ID + " text," + COL_FB_POST_ID + " text," + COL_FB_LIKES + " text," + COL_FB_POSTER_NAME + " text," + COL_FB_COMMENTS + " text," // this is the column i want to update + COL_FB_LIKES_NUM + " text," + COL_FB_TIMESTAMP + " text," + COL_FB_PROFILE_PICTURE_URI + " text," + COL_FB_PICTURE_URI + " text," + COL_FB_NAME + " text," + COL_FB_PREVIOUS_PAGE_URI + " text," + COL_FB_NEXT_PAGE_URI + " text," + COL_FB_POST_TYPE + " text," + COL_FB_LINK_NAME + " text," + COL_FB_COMMENTS_NUM + " text," + COL_FB_STORY + " text," + COL_FB_DESCRIPTION + " text," + COL_FB_COMMENTS_BEFORE + " text," + COL_FB_COMMENTS_AFTER + " text," + COL_FB_LIKES_PROFILE_PIC + " text," + COL_FB_COMMENTS_PROFILE_PIC + " text);"; Why is it throwing the query? I thought I was doing everything correctly.
accepted answer: http://stackoverflow.com/a/25371334
possible better answer: http://stackoverflow.com/a/25371331
has answer: http://stackoverflow.com/a/25371310
type: AnsweredQuestion
score: 3
downvote count: 2
has title: "No such column" when running update on SQLite
has answer: http://stackoverflow.com/a/25371307
tagged with: android
tagged with: java
tagged with: sqlite
has answer: http://stackoverflow.com/a/25371334
has answer: http://stackoverflow.com/a/25371331

http://stackoverflow.com/a/25379734
has comment: http://stackoverflow.com/comment/39579014
has body: Your date format is wrong "dd-mm-yyyy". IT should be "dd-MM-yyyy". MM use as month and mm take as minutes. You can use "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" to parse 2014-07-05T00:00:00.000-07:00 String str = "2014-07-05T00:00:00.000-07:00"; DateFormat df=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); System.out.println(df.parse(str)); OutPut: Sat Jul 05 12:30:00 IST 2014 Follow this. You will have answer by your own next time.
type: Answer
has comment: http://stackoverflow.com/comment/39579040
answers question: http://stackoverflow.com/q/25379650
has comment: http://stackoverflow.com/comment/39578889
score: 0

http://stackoverflow.com/q/25265567
has answer: http://stackoverflow.com/a/25266127
has title: Int comparison with array in for loop to get no duplicate value
type: AnsweredQuestion
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25266264
tagged with: java
downvote count: 1
tagged with: android-activity
has body: I am trying to make sure that the answer generated will not be duplicated in a maths app on Android. Here is the code I have: If I initialise an array of person objects with this data private int answer = 0, operator = 0, operand1 = 0, operand2 = 0; private Random random; private int AnswerCounter = 0; private int[] numberList {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; private int[] ans =new int[50]; private String[] operators = {"+", "-", "x", "/"}; Below is the method I used for randomization and double checking the duplicate answers. ans[] doesn't seem to be working... It is probably a really stupid logic problem but I have been pulling my hair out over here not being able to figure this out. When I run the program, the answer still exceed 30 and there are still repeated answer. Thanks for looking :) private void chooseQuestion(){//if answer is repeated, operands and operators should be randomized again. operator = random.nextInt(operators.length); //choose operands operand1 = random.nextInt(numberList.length); operand2 = random.nextInt(numberList.length); //checks for operators if(operator==0){//ADD_OPERATOR answer = operand1+operand2; if(AnswerCounter==0){//first ans while(answer&gt;30){ operand1 = random.nextInt(numberList.length); operand2 = random.nextInt(numberList.length); answer = operand1+operand2; } } else{//from the 2nd ans onwards for (int x=0; x&lt;(AnswerCounter);x++){ while((answer==ans[x])||(answer&gt;30)){ //choose operands operand1 = random.nextInt(numberList.length); operand2 = random.nextInt(numberList.length); answer = operand1+operand2; } } } ans[AnswerCounter] = answer; AnswerCounter++;//increase so that the array num can increase } else if(operator==1){ //SUBTRACT_OPERATOR answer = operand1-operand2; if(AnswerCounter==0){//first ans while((operand2&gt;operand1)||answer&gt;30){//no negative answer allowed, answer cannot be above 30 operand1 = random.nextInt(numberList.length); operand2 = random.nex…
has comment: http://stackoverflow.com/comment/39392093
favorite count: 0
type: Question
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/25266264
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25266127
score: -1
has comment: http://stackoverflow.com/comment/39367664
has comment: http://stackoverflow.com/comment/39367652

http://stackoverflow.com/comment/39521419
has text: it will be the same error for *all* classes inheriting from StatModel.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25348334
score: 0

http://stackoverflow.com/a/25369282
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25360725
has body: Found the reference As per JDBC it seems there is no such limit on the records in a batch insert, Its all governed by the memory available.
answers question: http://stackoverflow.com/q/25360725

http://stackoverflow.com/q/25239461
type: AnsweredQuestion
has body: I am using following program to get file from server: public static void main(String[] argv) throws Exception { Socket sock = new Socket("127.0.0.1", 12345); byte[] mybytearray = new byte[1024]; InputStream is = sock.getInputStream(); FileOutputStream fos = new FileOutputStream("E://cy.jpg"); BufferedOutputStream bos = new BufferedOutputStream(fos); int bytesRead = is.read(mybytearray, 0, mybytearray.length); bos.write(mybytearray, 0, bytesRead); bos.close(); sock.close(); } This is creating the file but only a few contents of the image are being copied. Can someone please explain what is wrong with this code and how to fix it?
possible better answer: http://stackoverflow.com/a/25239955
has answer: http://stackoverflow.com/a/25239598
has comment: http://stackoverflow.com/comment/39319037
has answer: http://stackoverflow.com/a/25239955
score: 0
tagged with: java
has title: Image file not fully copied
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39319022
accepted answer: http://stackoverflow.com/a/25239598

http://stackoverflow.com/comment/39499625
has text: This is begging for an ETL process.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25335813
score: 2

http://stackoverflow.com/q/25249164
has comment: http://stackoverflow.com/comment/39345920
has comment: http://stackoverflow.com/comment/39337477
type: AnsweredQuestion
score: 0
upvote count: 2
has body: I am having this dilemma where I am trying to figure out this matching system using parse. Lets say a user selects male or a female, and then selects that he is looking for a male or a female. I can't just return the opposite decision, because what if a male is looking for a male, or a women looking for a women. My question is as follow: how do I set up a condition through parse that returns the list of users based on the gender that the user is looking for. In other word, I would want to return the opposite sex of the user, unless they are looking for the same sex With support, these are the conditions that I have set so far. ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); query.whereNotEqualTo("objectId", currentUserId); query.whereEqualTo("Gender","female"); Below is the code that allows users to record their information to Parse.com mName = (EditText)findViewById(R.id.etxtname); mAge = (EditText)findViewById(R.id.etxtage); mHeadline = (EditText)findViewById(R.id.etxtheadline); mprofilePicture = (ImageView)findViewById(R.id.profilePicturePreview); male = (RadioButton)findViewById(R.id.rimale); female = (RadioButton)findViewById(R.id.rifemale); lmale = (RadioButton)findViewById(R.id.rlmale); lfemale = (RadioButton)findViewById(R.id.rlfemale); mConfirm = (Button)findViewById(R.id.btnConfirm); mConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String name = mName.getText().toString(); String age = mAge.getText().toString(); String headline = mHeadline.getText().toString(); age = age.trim(); name = name.trim(); headline = headline.trim(); if (age.isEmpty() || name.isEmpty() || headline.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(ProfileCreation.this); builder.setMessage(R.string.signup_error_message) .setTitle(R.string.signup_error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } else { // create the new user! setProgressBarIndet…
tagged with: java
downvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/25254335
tagged with: android-activity
favorite count: 0
type: Question
tagged with: android-layout
tagged with: parse-platform
accepted answer: http://stackoverflow.com/a/25254335
has comment: http://stackoverflow.com/comment/39338692
tagged with: android
has comment: http://stackoverflow.com/comment/39338911
has comment: http://stackoverflow.com/comment/39338463
has title: Working a condition that would match men and women based on their selection

http://stackoverflow.com/q/25380835
tagged with: math
has answer: http://stackoverflow.com/a/25381343
possible better answer: http://stackoverflow.com/a/25381343
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25388473
accepted answer: http://stackoverflow.com/a/25388473
answer count: 2
score: 1
tagged with: java
tagged with: apache
has title: apache.commons.math distributions, get probability greater than 1
has body: I use apache commons math library for MixtureMultivariateNormalDistribution. And it appears that sometimes density() function returns me values that are very much greater than 1. What's it? My mixture coefficients sum to 1 and my covariance matrices of each NormalDistribution are fine (since MixtureMultivariateNormalDistribution constructor doesn't throw any exception when i create the object) and means are fine too. Dimension is 39. And i have 3 normal distribution in a mixture. Is it some bug or what? Did anyone meet this problem? Thanks
downvote count: 0
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39383741
score: 4
type: QuestionComment
has text: That's because they're numbers, they're not `String`s anymore. Just keep them as `String`s.
comment on: http://stackoverflow.com/q/25274046
type: Comment

http://stackoverflow.com/q/25388989
possible better answer: http://stackoverflow.com/a/25389205
answer count: 4
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25390154
has answer: http://stackoverflow.com/a/25390683
tagged with: java
has answer: http://stackoverflow.com/a/25390154
has answer: http://stackoverflow.com/a/25389077
has title: AtomicXXX lazySet for single writer thread
type: Question
tagged with: atomicinteger
has answer: http://stackoverflow.com/a/25389205
tagged with: performance
tagged with: multithreading
has body: I have an application with a single writer thread which does some stuff and updates some metrics e.g. counters etc. The application has a number of other threads which read the stats and do stuff with them. It's not essential that the metrics are up to date but the writer thread needs to be blocked for as little time as possible. I was wondering which of the following would better suit my needs: Option 1 - have a non atomic field that only the writer can update, and an AtomicXXX field which is set using lazySet: class Stats1 { private final AtomicLong someCounterAtomic = new AtomicLong(0); private long someCounter = 0; // writer thread updates the stats using this public void incrementCounter(long counterIncrement) { someCounter += counterIncrement; someCounterAtomic.lazySet(someCounter); } // reader threads call this public long getCounterValue() { return someCounterAtomic.get(); } } Option 2 - Just have an AtomicXXX field which is updated via addAndGet: class Stats2 { private final AtomicLong someCounter = new AtomicLong(0); // writer thread updates the stats using this public void incrementCounter(long counterIncrement) { someCounter.addAndGet(counterIncrement); } // reader threads call this public long getCounterValue() { return someCounter.get(); } } Or would I be better off doing something else? Thanks in advance.

http://stackoverflow.com/comment/39421725
comment on: http://stackoverflow.com/a/25294251
score: 0
type: AnswerComment
has text: Also, if you have the default build.xml under your main project, you can probably just copy it to the Google Play project folder.
type: Comment

http://stackoverflow.com/comment/39382148
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25273084
has text: no I comment for and else in try 3 but again NPE has.is code in try 3 true?
type: Comment

http://stackoverflow.com/a/25259212
answers question: http://stackoverflow.com/q/25259195
has body: Something like this ? statement.executeUpdate(); ResultSet generatedKeys = statement.getGeneratedKeys(); long generatedId= 0L; if (generatedKeys.next()) { generatedId = generatedKeys.getLong(1);// here is your generated Id , }
accepted answer of: http://stackoverflow.com/q/25259195
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39356344
type: Answer
has comment: http://stackoverflow.com/comment/39356676
has comment: http://stackoverflow.com/comment/39356624
has comment: http://stackoverflow.com/comment/39356408
has comment: http://stackoverflow.com/comment/39356808
has comment: http://stackoverflow.com/comment/39356389
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39356294

http://stackoverflow.com/comment/39317637
score: 0
has text: you have to pass start and limit(offset) from front end, and its always return requested no of rows and total rows without limit. you need technical help ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25238306

http://stackoverflow.com/comment/39504557
comment on: http://stackoverflow.com/q/25253861
score: 0
has text: @CarlosJoséDaCosta Which version of JBoss? If 5/6 you should use the resteasy jars that are supplied in the /deployers folder (jax-rs,resteasy-jax-rs and jboss-seam-resteasy)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25355385
favorite count: 0
type: Question
has body: I don't know where to put the business logic in spring mvc because I'm new to it. I have a clue on what to do but because of lack in knowledge in spring mvc, I don't know where to start. I would also like to ask if somebody knows where I can get a good tutorial on this or a complete sample of a spring mvc web application that has a business logic on it? Anyways, the business logic that I was talking about is all about database handling :)
upvote count: 36
has answer: http://stackoverflow.com/a/32326895
possible better answer: http://stackoverflow.com/a/32326895
tagged with: business-logic
has answer: http://stackoverflow.com/a/25355411
accepted answer: http://stackoverflow.com/a/25355411
has title: Where to put business logic in spring mvc framework?
has answer: http://stackoverflow.com/a/25355407
tagged with: spring-mvc
type: AnsweredQuestion
score: 35
answer count: 3
tagged with: java
downvote count: 1

http://stackoverflow.com/a/25266265
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39368943
answers question: http://stackoverflow.com/q/25266228
has body: You have to make the method static if you want to use the method as Calculator.evaluate("5"): public static double evaluate(String expression){ return Double.parseDouble(expression); }
has comment: http://stackoverflow.com/comment/39369044
score: 0
upvote count: 1

http://stackoverflow.com/q/25281697
tagged with: hive
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25281923
has title: Convert 15 char length string to unique long number - using BigInteger longValue()
tagged with: distinct
tagged with: java
answer count: 1
type: Question
tagged with: radix
tagged with: hadoop
has answer: http://stackoverflow.com/a/25281923
linked to: http://stackoverflow.com/q/9309723
has body: I want to convert a string of max length 15 to a unique long number. I am trying to use BigInteger's longValue() function for the same. BigInteger bigInt = new BigInteger("abcdeabcdeabcda".getBytes()); long n = bigInt.longValue(); Can we avoid collision of long value until 15 chars of String? String can contain alphanumeric including special character. The idea not to encrypt the string to long. But to improve the performance of count(distinct) of hive queries. We note that count(distinct) in hive provides good performance if long is used instead of string. We don't want approx. or probablistic count distinct. We want exact count distinct. Thanks in Advance
linked to: http://stackoverflow.com/q/54418
has comment: http://stackoverflow.com/comment/39397299

http://stackoverflow.com/a/25297404
has comment: http://stackoverflow.com/comment/39427352
upvote count: 2
score: 2
downvote count: 0
has body: problem: result = doInBackground(petrolPriceURL); you are implicitly calling the doInbackground method in the onPostExecute which will actually run in your UI thread instead on a different thread thus resulting to Android:NetworkOnMainThreadException. Also it is unnecessary to call doInBackground that it is already executed before onPostExecute when you execute your Asynctask. Just directly use the result parameter of the onPostExecute. sample: @Override protected void onPostExecute(String result) { // Get the data from the RSS stream as a string errorText = (TextView)findViewById(R.id.error); response = (TextView)findViewById(R.id.title); response.setText(result); if(dialog.getProgress() == dialog.getMax()) dialog.dismiss(); }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25297355
accepted answer of: http://stackoverflow.com/q/25297355
type: Answer

http://stackoverflow.com/comment/39390134
comment on: http://stackoverflow.com/q/25267954
has text: You can use reflection on the class along with reflection on the `Field` class itself for that field to remove its `final` modifier. Check out [this question here](http://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection) for the nitty gritty.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25371473
type: Question
has comment: http://stackoverflow.com/comment/39563804
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25371836
score: 3
has answer: http://stackoverflow.com/a/25371836
tagged with: java
has title: Java Map w @NonNull Value Type and @Nullable get() method result?
possible better answer: http://stackoverflow.com/a/26399118
has answer: http://stackoverflow.com/a/51474502
answer count: 4
has comment: http://stackoverflow.com/comment/39564277
tagged with: nullable
tagged with: null
upvote count: 3
tagged with: annotations
downvote count: 0
has answer: http://stackoverflow.com/a/26399118
has answer: http://stackoverflow.com/a/48566851
has body: I have a method returning a custom Map implementation, whose entries consist entirely of non-null keys and values, so I would like to add type annotations in order to indicate that clients may iterate over the Map.Entry's without having to check them for null values: Map&lt;@NonNull String,@NonNull String> The problem is that the Map.get method API specifies that null be returned for any attempt to retrieve a value for a key which isn't present in the Map, and annotating my get method implementation to return a @Nullable String generates a compiler warning that the return type is then incompatible with the @NonNull return specified by the Map. I understand that a Map.get API created today might perhaps return a java.util.Optional result or throw a NoSuchElementException, but, being beholden to the existing Collections API, is it possible to remain compliant with the get method specification and also specify that my Map contains only @NonNull values? Much Thanks.
favorite count: 0

http://stackoverflow.com/q/25245448
has body: Cannot convert functional interface with generic method into lambda expression. Following code is working. It is without lambda expression i.e. using anonymous class. public interface Pro{ public &lt;T&gt; void callee(T t); } public void fun(Pro obj){} public void implement() { fun(new Pro() { @Override public &lt;Integer&gt; void callee(Integer t){} }); } I cannot understand how to use lambda expression instead of anonymous class. After trying it myself I used the hint shown in netbeans. I used the shown bulb to do it. And here is what I got, an ERROR. public void implement() { fun((Integer t) -&gt; { }); } It is showing error. What is the correct lambda expression to be used here? Here is the error : one\LambdaScopeTest.java:18: error: incompatible types: invalid functional descriptor for lambda expression fun((Integer t) -&gt; { ^ method &lt;T&gt;(T)void in interface Pro is generic where T is a type-variable: T extends Object declared in method &lt;T&gt;callee(T) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
has comment: http://stackoverflow.com/comment/39330688
tagged with: lambda
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25245591
tagged with: java
answer count: 1
has title: Cannot convert functional interface with generic method into lambda expression
tagged with: generics
downvote count: 1
has comment: http://stackoverflow.com/comment/39330243
favorite count: 0
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/25245591

http://stackoverflow.com/comment/39320473
has text: **Never call `getGraphics` on a `Component`**. (And if this is not a `Component`, then you once more did not provide enough information - apart from the `statusHandler.render(g)` not being the main unknown part...). Are you using (or trying to use) *active rendering* with an own `BufferStrategy` and such? Otherwise, rendering usually consists of calling `repaint()` and letting Swing to the rest. You won't receive 900 FPS with that, but considering that a monitor has a refresh rate of 60Hz, everything beyond that is useless anyhow...
comment on: http://stackoverflow.com/q/25238426
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25383751
has answer: http://stackoverflow.com/a/25384649
upvote count: 3
has comment: http://stackoverflow.com/comment/39588798
downvote count: 0
has body: I have a JTable with a cellrenderer and my table is non-editable. When i select a cell and copy (ctrl-c) the value, its copying not the shown in the cell, it is copying the value which store in model. How could I copy cell value which shown in table. public class TableDemo { public static void main(String[] args) { Vector&lt;String&gt; values = new Vector&lt;String&gt;(); values.add("Val1"); values.add("Val2"); JTable table = new JTable(new Object[][] { { "key", values }, { "key2", values } }, new String[] { "Col1", "Col2" }); table.getColumnModel().getColumn(1).setCellRenderer(new MyTableCellRenderer()); table.setCellSelectionEnabled(true); JFrame jf = new JFrame(); jf.getContentPane().add(table); jf.setSize(500, 500); jf.setVisible(true); } } class MyTableCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); @SuppressWarnings("unchecked") Vector&lt;String&gt; values = (Vector&lt;String&gt;) value; setText(values.get(row)); return this; } }
tagged with: swing
has comment: http://stackoverflow.com/comment/39587037
tagged with: tablecellrenderer
favorite count: 0
tagged with: jtable
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39587139
has title: JTable copy value from view of cellrenderer
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39586944
accepted answer: http://stackoverflow.com/a/25384649
type: Question

http://stackoverflow.com/q/25389215
type: Question
tagged with: algorithm
has body: I have a huge list of vectors (~100k) (representing words and calculated using random indexing) and have to find given 1 input word the top N closest vectors. The way I'm doing it now is do a complete sort by distance and then extract the top N results but this takes too much time to be usable, as I have to compute 100k distances. Is there a more efficient way to do it? The vectors are already normalized, so I just have to compute the dot product when calculating the distance. The vectors are stored in a a Java HashMap&lt;String, Vector&gt;, where Vector is la4j class for sparse vectors.
tagged with: java
accepted answer: http://stackoverflow.com/a/25389625
has answer: http://stackoverflow.com/a/25391729
has answer: http://stackoverflow.com/a/25389625
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/39597726
tagged with: vector
has comment: http://stackoverflow.com/comment/39601761
type: AnsweredQuestion
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25391729
has comment: http://stackoverflow.com/comment/39597629
has comment: http://stackoverflow.com/comment/39597438
favorite count: 0
has title: Fastest way to take top N closest vectors by cosine distance

http://stackoverflow.com/comment/39417463
type: Comment
type: QuestionComment
has text: It's not a 100% duplicate because it doesn't specify why `Short` is allowed, but `Integer` isn't so I retracted the closevote. Nevertheless very related: http://stackoverflow.com/questions/7014171/widening-and-boxing-java-primitives
comment on: http://stackoverflow.com/q/25292510
score: 0

http://stackoverflow.com/a/25331649
score: 0
has body: I just wanna thank you guys for really helping me out!!! I solved my problem. Here is my solution. JSP with Spring form: &lt;form:form action="parties" method="post"&gt; &lt;input type="hidden" name="day" value="${date.getDayOfYear()+1)}" /&gt; &lt;input type="submit" value="Tomorrow's parties" /&gt; &lt;/form:form&gt; Controller: @RequestMapping("/parties") public String listOfParties(@ModelAttribute("day") String day, Model model) { DateTime date = partyManager.newDay(day); model.addAttribute("parties", partyManager.findAllTodayParties()); model.addAttribute("date", date); return "/parties"; } @RequestMapping(value = "/parties", method = RequestMethod.POST) public String nextDay() { return "redirect:/parties"; } Method newDay(day) in PartyManager class: public DateTime newDay(String day) { int dayNumber = 0; if (StringUtils.isEmpty(day)) { // Check whether the given String is empty dayNumber = new DateTime().getDayOfYear(); } else { dayNumber = Integer.parseInt(day); } int newDayNumber = dayNumber; DateTime newDate = new DateTime().withDayOfYear(newDayNumber); return newDate; }
answers question: http://stackoverflow.com/q/25312637
type: Answer

http://stackoverflow.com/a/25511102
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25365930
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25365930
has body: Seems @PRODUCES and adding charset=utf-8 doesn't work. In the end I created a filter which added charset=utf=8 to the response header before it was sent and registered it as a provider to jersey through the application config class. Now it works and data is being returned perfectly. Why @PRODUCES doesn't work is a mystery. package com.mycompany.misf.filters; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.core.MediaType; public class HeaderResponseFilter implements ContainerResponseFilter { public void filter(ContainerRequestContext request, ContainerResponseContext response) { MediaType type = response.getMediaType(); if (type != null) { String contentType = type.toString(); if (!contentType.contains("charset")) { contentType = contentType + ";charset=utf-8"; response.getHeaders().putSingle("Content-Type", contentType); } } } } Register the filter as a provider. @ApplicationPath("resources") public class RestApplication extends ResourceConfig { public RestApplication() { HashSet&lt;Class&lt;?&gt;&gt; c = new HashSet&lt;Class&lt;?&gt;&gt;(); c.add(PersonsRestService.class); c.add(ProjectsRestService.class); //add this c.add(HeaderResponseFilter.class); Set&lt;Class&lt;?&gt;&gt; classes = Collections.unmodifiableSet(c); registerClasses(classes); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); } }

http://stackoverflow.com/q/25312021
score: 0
tagged with: eclipse-luna
tagged with: java
has body: I am trying to retrieve the full file path from the classes that have been edited. I can retrieve the comments, version number, author and date but can't seem to get the full file path that has been edited when more than one class has been included into the project. I use these to retrieve the Comments and Author: String comments = pc.getPendingChanges().getComment(); System.out.println("Comments: " + comments); String author = pc.getPendingChanges().getAllPendingChanges()[0].getPendingSetOwnerDisplay(); System.out.println("Author: " + author); I use this to retrieve the path: String fileName = pc.getPendingChanges().getAllPendingChanges()[0].getLocalItem(); System.out.println("FileName: " + fileName); but I only get this output: FileName: C:\VS2013\Plugin\PluginTest\HelloWorld.classpath I need to display the full path with the class name eg FileName: C:\VS2013\Plugin\PluginTest\HelloWorld.Test.java Full method displayed below: @Override public PolicyFailure[] evaluate(PolicyContext context) throws PolicyEvaluationCancelledException { final PendingCheckin pc = getPendingCheckin(); final List&lt;PolicyFailure&gt; failures = new ArrayList&lt;PolicyFailure&gt;(); final WorkItemCheckinInfo[] AssociatedWorkItems = pc.getWorkItems().getCheckedWorkItems(); WorkItem AssociatedCodeReview = null; String failureReason = ""; for (int i=0; i&lt;AssociatedWorkItems.length; i++) { AssociatedCodeReview = AssociatedWorkItems[i].getWorkItem(); if (AssociatedCodeReview.getType().getName() == "Code Review") { break; } } if (AssociatedCodeReview != null) { if (AssociatedCodeReview.getFields().getField("System.State").getValue() .toString().equals("Not Approved")) { failureReason = "Code Review Work Item associated but that is not approved by expert"; failures.add(new PolicyFailure(failureReason, this)); } } else { String fileName = pc.getPendingChanges().getAllPendingChanges()[0].getLocalItem(); System.out.println("FileName: " + fileName); String fileName2 = pc.getPendingChanges().getAl…
answer count: 1
has comment: http://stackoverflow.com/comment/39454616
has comment: http://stackoverflow.com/comment/39453898
type: Question
accepted answer: http://stackoverflow.com/a/25409126
has comment: http://stackoverflow.com/comment/39454462
has answer: http://stackoverflow.com/a/25409126
tagged with: tfs
has title: Retrieving the full class path
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39453778
tagged with: filepath
type: AnsweredQuestion

http://stackoverflow.com/comment/39597183
type: QuestionComment
comment on: http://stackoverflow.com/q/25386187
has text: No, because while the data fits into the buffer, it stays in the buffer. The cookie for the new session has to be sent out before any of the data (in the HTTP header), so if the buffer fills up and Wicket/Tomcat starts to write the data to the socket, there's no way to "rewind" and insert another header line. But if the data is small, writing only starts when all processing is finished.
score: 0
type: Comment

http://stackoverflow.com/comment/39415886
has text: Thanks, that puts things into better perspective. How do i know which distribution to use, lets say that i want to make a distribution of my Javafx program, which file do i give them? When i create an artifact in intellij it creates the jar and jnlp, do i give them the jar? Or is there another way of distributing it specifically for that purpose?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25282194

http://stackoverflow.com/a/25381112
type: Answer
has comment: http://stackoverflow.com/comment/39582471
has body: You need to Add the Activity to the Manifest. Every Activity you want to run must be added to the Manifest. add this : &lt;activity android:name="com.testing1234.apptest.MainActivity" /&gt;
has comment: http://stackoverflow.com/comment/39582720
score: 2
has comment: http://stackoverflow.com/comment/39581185
answers question: http://stackoverflow.com/q/25381022
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39582513
has comment: http://stackoverflow.com/comment/39581163

http://stackoverflow.com/q/25242320
has comment: http://stackoverflow.com/comment/39328236
has comment: http://stackoverflow.com/comment/39324791
has comment: http://stackoverflow.com/comment/39325187
upvote count: 1
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39326737
has comment: http://stackoverflow.com/comment/39325360
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39324701
has comment: http://stackoverflow.com/comment/39328388
downvote count: 0
tagged with: httprequest
favorite count: 0
type: Question
has body: My web application based on Spring MVC has a problem. When I'm submitting form with method POST, the controller sometimes executes method GET. It happens completely randomly. Sometimes it works fine and sometimes not. It is running on jboss soa p 5 an using spring framework 3.1.4 (previously was 3.0.1) In front-end i'm submitting from by simply performing: document.submitform.submit(); when I'm logging request method in javascript before form submission, it is always POST. But after analyzing springframework debug log, I see that it receives GET method: 2014-08-11 11:33:52,894 DEBUG [org.springframework.web.servlet.DispatcherServlet] (ajp-172.31.14.7-8109-9) DispatcherServlet with name 'Flow' processing GET request for [/project/mypage/mypage.htm] 2014-08-11 11:33:52,894 DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ajp-172.31.14.7-8109-9) Looking up handler method for path /mypage/mypage.htm 2014-08-11 11:33:52,894 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp-172.31.14.7-8109-9) Returning cached instance of singleton bean 'myController' 2014-08-11 11:33:52,894 DEBUG [org.springframework.web.servlet.DispatcherServlet] (ajp-172.31.14.7-8109-9) Last-Modified value for [/project/mypage/mypage.htm] is: -1 So this is my problem: when the request is sent, the method in the front-end side is ok, but in DispatcherServlet is modified, but request URI is ok. And it is happening completely randomly. What could be the reason of it? As I understand there are another classes where request method could be modified before DispatcherServlet. How can I see which request method I have in ResponseOverrideFilter or in RequestContextListener or in DelegatingFilterProxy? (debug for org.springframework doesn't provide this information. only for DispatcherServlet) I've updated spring version from 3.0 to 3.1, but it didn't solve my problem. Edit1: After performing request Apache access.log says IP - - [11/Aug/…
has title: Spring: request method is modified before getting to DispatcherServlet
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25258153
type: UnansweredQuestion
tagged with: apache
tagged with: ssl
tagged with: tomcat
has title: Is this a false SSL connection between Apache + Tomcat?
has comment: http://stackoverflow.com/comment/39359597
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/25272698
downvote count: 0
tagged with: java
answer count: 1
has body: I was looking over this guide to setup tomcat + apache with SSL: http://www.mulesoft.com/tcat/tomcat-ssl Under section, "When To Use SSL With Tomcat" it says: "...In other words, if you're fronting Tomcat with a web server and using it only as an application server or Tomcat servlet container, in most cases you should let the web server function as a proxy for all SSL requests" Since I already have a webserver set up with SSL, I decided to be lazy. I installed tomcat with default settings, and started it up. In my httpd.conf, I redirected all 80 traffic to 443, and then proxypass and proxypassreverse to ajp://hostname.com:8009. I restarted httpd and it "appears" to redirect to tomcat server over ssl. Is this completely broken or did I actually manage to do what I intended on first go? Any test suggestions are much appreciated. &lt;VirtualHost *:80&gt; ServerName hostname_DNS_alias.com Redirect / https://hostname_DNS_alias.com &lt;/VirtualHost&gt; &lt;VirtualHost *:443&gt; SSLEngine On SSLCertificateFile /etc/pki/tls/certs/thecrt.crt SSLCertificateKeyFile /etc/pki/tls/private/thekey.key SSLCertificateChainFile /etc/pki/tls/certs/CA.crt ServerName hostname_DNS_alias.com DocumentRoot /var/www/html &lt;Proxy *&gt; AddDefaultCharset off Order deny,allow Allow from all &lt;/Proxy&gt; ProxyPass / ajp://hostname.com:8009/ ProxyPassReverse / ajp://hostname.com:8009/ &lt;/VirtualHost&gt;
tagged with: https
favorite count: 0
type: Question

http://stackoverflow.com/comment/39314454
comment on: http://stackoverflow.com/a/25236363
type: AnswerComment
has text: @user3921124 to continue recursive's wissass approach - when you write the line nothing happens. When this line is **ran** then only one single object is being created. Why would you expect more than one object to be created ?
score: 0
type: Comment

http://stackoverflow.com/q/25321597
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/5585779
upvote count: 0
score: -3
answer count: 1
has title: java : cannot convert from String to int
has comment: http://stackoverflow.com/comment/39471725
duplicate of: http://stackoverflow.com/q/5585779
has body: public class NewRoot { public static void main(String[] arguments){ int number = arguments[0]; System.out.println("The square root of" + number + " is " + Math.sqrt(number) ); } } eclipse shows an error saying Type mismatch: cannot convert from String to int even though I put 225 on an argument. What's wrong with my code?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25321611
has comment: http://stackoverflow.com/comment/39471730
tagged with: java
has answer: http://stackoverflow.com/a/25321611
downvote count: 3

http://stackoverflow.com/comment/39315782
comment on: http://stackoverflow.com/a/25234710
has text: Based on my understanding to your code, you would need a reference to the frame in order to make that call...
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25355237
tagged with: spring
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39534533
tagged with: openjpa
tagged with: jpa
has title: build-time weaving with openjpa at using spring created persistence unit
has body: This documentation states: Note: as a prereq to running the enhance task, I copied my persistence.xml file to my /build directory. You might not need to do this, but the persistence.xml has to be in the classpath. This implies to me the task needs to determine through the persistence.xml file what files need enhancing. Currently my runtime weaving does not work. I may need help with that, but i would preferrably like my classes to be pre-enhanced as we will be making heavy use of entity classes. Can pre-enhancement be performed on entity classes assembled in a spring-built Persistence Unit?
type: Question
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39534557

http://stackoverflow.com/q/25341568
tagged with: java
accepted answer: http://stackoverflow.com/a/25343840
answer count: 1
has answer: http://stackoverflow.com/a/25343840
has title: unable to print beyond 975th prime no. using Sieve of eratosthenes
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39509556
upvote count: 0
score: -1
has body: Here the code prints the first N prime no.s I allocated memory for 50000 numbers as i needed first 5000 prime number i.e 5000th prime no. is 48611. But the program prints the prime numbers only upto 975th prime number not beyond that. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class exp { private int size; private boolean[] arr; public exp(int a){ size = a; arr = new boolean[size]; } public void initialize(){ for(int i=2;i&lt;size;++i) arr[i] = true; arr[0] = arr[1] = false; } public void precompute(){ // this function implements sieve technique int i=2; while(i&lt;size){ if(arr[i]){ for(int j=2*i; j&lt;size; j=j+i) arr[j] = false; } i++; } } public String printX(int as){ int counter = 0; String ans="",b = " "; for(int i=0; i&lt;size ; ++i){ if(arr[i]){ ans += String.valueOf(i) + b; counter++; } if(counter == as) break; } return ans; } public static void main(String[] args) throws NumberFormatException, IOException { exp e = new exp(50000); e.initialize(); e.precompute(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); int N; for(int i=0;i&lt;t;++i){ N = Integer.parseInt(br.readLine()); if(N == 1) System.out.println("1"); else System.out.println(e.printX(N)); } } } Trying to print more than 975 prime no.s giving blank line in eclipse. So what is the issue here? IS the issue related to eclipse?
type: AnsweredQuestion

http://stackoverflow.com/q/25381397
accepted answer: http://stackoverflow.com/a/25381820
type: AnsweredQuestion
tagged with: format
has comment: http://stackoverflow.com/comment/39582982
tagged with: java
tagged with: space
has body: in our company we recently changed the used line width from like 80 to 150. Now it is quite annoying that all code is - of course - wrapped after 100 characters, as this was the previous setting. We use save actions to run the format settings and it all works wonderful in the one direction: wrap too large lines. But what I need now: UNWRAP me all lines as I now got enough space available, USE it. Is there a possibility to do that in form of a format setting? I couldn't find any I now got this line (extremly) wrapped as there were not enough space: final List&lt;SomeSuperDuperType&gt; mySuperDuperListOfSuperDuperTypes = CrazyUtils.gimmeSomeCrazyStuffAsList( parameter1, parameter2); Now, with more space available, this code is still correctly formatted as it doesn't exceed the limit. Though I want to actually USE that extra space and make the line now like this (length=133): final List&lt;SomeSuperDuperType&gt; mySuperDuperListOfSuperDuperTypes = CrazyUtils.gimmeSomeCrazyStuffAsList(parameter1, parameter2);
tagged with: eclipse
has title: eclipse use available space line w
has comment: http://stackoverflow.com/comment/39583248
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25381820

http://stackoverflow.com/comment/39340354
comment on: http://stackoverflow.com/q/25250546
score: 0
has text: Okay. What is being outputted? And put a breakpoint inside your `catch` so you can inspect the exception thrown.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25234374
downvote count: 0
answer count: 1
tagged with: nested
upvote count: 1
tagged with: switch-statement
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25234392
has title: Exiting out of nested switch statement to outer switch statement
has answer: http://stackoverflow.com/a/25234392
has body: I've created a menu in Java wherein each option has another menu. I want to know if I can exit from the inner menu back to the main menu. Edit: Added Main Menu options System.out.println("Main Menu"); System.out.println("1. Hourly Employees"); System.out.println("2. Salary Employees"); System.out.println("3. Commission Employees"); System.out.println("4. Weekly Calculations"); System.out.println("5. Exit Program"); while(true){ switch(choice){ case 1: HourlyEmployeeChoice HEC = new HourlyEmployeeChoice(); //HourlyEmployeeChoice is a class with HEmployeeMenu() method HEC.HEmployeeMenu(); break; //case 2-4: to be added later case 5: System.out.println("Goodbye!"); System.exit(0); } } This is my main menu. I only wrote the code for the first option and the option to exit. public void HEmployeeMenu(){ while(true){ //submenu options int hourlyChoice = userChoice.nextInt(); switch(hourlyChoice) { case 1: //code break; case 2: //code break; case 3: //code break; case 4: //exit submenu return; default: System.out.println("Please make a valid selection"); } } } This is the method I put my second switch statement inside. Choosing option 4 (exit submenu) refreshes to the submenu rather than the main menu. I think what's causing this is the while loop I have for the submenu. I don't want to take this option off though, because I want to be able to continue making choices after doing cases 1-3.
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25322651
has title: AsyncTask source code questions
type: AnsweredQuestion
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/39473751
tagged with: android
has answer: http://stackoverflow.com/a/25324012
tagged with: java
accepted answer: http://stackoverflow.com/a/25324012
answer count: 1
downvote count: 1
tagged with: concurrency
has body: I was reading AsyncTask.java and there are few places that I can't understand. What does this code actually do? Judging by the comment it should create the handler, but I can't get how it can do this. The method getLooper() in the Handler class just returns the handler, so there is no way I can see it can initialize a new handler. /** @hide Used to force static handler to be created. */ public static void init() { sHandler.getLooper(); } Why putting postResultIfNotInvoked() in the overriden done() method? How can it be not invoked? If I understand this right, first the call() method of mWorker will be called and then mTaskInvoked is guaranteed to be true. mWorker = new WorkerRunnable&lt;Params, Result&gt;() { public Result call() throws Exception { mTaskInvoked.set(true); //... return postResult(doInBackground(mParams)); } }; mFuture = new FutureTask&lt;Result&gt;(mWorker) { @Override protected void done() { try { postResultIfNotInvoked(get()); } catch (InterruptedException e) { android.util.Log.w(LOG_TAG, e); } catch (ExecutionException e) { throw new RuntimeException("An error occured while executing doInBackground()", e.getCause()); } catch (CancellationException e) { postResultIfNotInvoked(null); } } };
favorite count: 0
type: Question
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/39474107

http://stackoverflow.com/a/25470309
has body: The following is a good tutorial on how to set up selenium webdriver and testNG framework. http://www.toolsqa.com/selenium-webdriver/download-and-install-java/ Hope it helps!
answers question: http://stackoverflow.com/q/25367028
type: Answer
score: 0

http://stackoverflow.com/comment/39800309
type: Comment
type: AnswerComment
score: 0
has text: and please try not to edit/modify your project while running. also try a "fresh" start... i mean stop services and recompile the project.. then run/start all again
comment on: http://stackoverflow.com/a/25441722

http://stackoverflow.com/q/25241852
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: session-timeout
tagged with: session
has title: how to insert data in database before session timeouts within given time limit using java?
has answer: http://stackoverflow.com/a/25242101
has body: If I am mentioning the session timeout in descriptor page 30 Before terminating session I want to do insert operation in database. Is there any possibility for insertion. I have a thought that when user logins the page and I can use trigger to insert the data for 30 minutes. But if anyone else changes to -1 or more than 30 mins without noticing the trigger is running when user logins at that case what can I do for it?
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/39595100
type: Comment
has text: I don't think is bad. In fact, I didn't think what were your intentions for this. That's why I raised a question in the first comment, mainly because this site won't help on the generation of attacks or logical bombs. Anyway, the case these big companies do it doesn't mean you should unless you have a very specific security matter that should be explained in your question. Also, as noted by BackSlash, that won't protect you that much since the main server IP can still be obtained by DNS lookup. You probably want to raise this question as security more than a plain curiosity.
comment on: http://stackoverflow.com/q/25387847
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39566162
comment on: http://stackoverflow.com/a/25372585
type: Comment
score: 0
type: AnswerComment
has text: Yeah did it.. Thanks Kazagha :) setSelected() is the thing...

http://stackoverflow.com/q/25306967
answer count: 3
accepted answer: http://stackoverflow.com/a/25307012
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25307012
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25307011
has title: Return Two Arraylists or Use Two Different Methods
has answer: http://stackoverflow.com/a/25307011
has body: If I have a method public ArrayList&lt;String&gt; necessaryChanges(Set&lt;Object&gt; setToCheck ) { //checks to see whether each element of set is correct by comparing it to something // and if it needs to be changed its added to an arraylist to be returned to the user } I need to return a list with necessary changes which is fine. But I also want to modify setToCheck with the changes. I know you cant return two objects in a method. What I am asking is what is the most efficient way of doing this. I know I can create another method in the main class and call it to change the set, but it seems really inefficient. Is there a better way of doing this. Thanks
tagged with: set
downvote count: 0
upvote count: 1
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25307516
tagged with: performance

http://stackoverflow.com/q/25350934
tagged with: swing
possible better answer: http://stackoverflow.com/a/25351905
has answer: http://stackoverflow.com/a/25351905
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25351192
has title: Java SwingWorker load data from database to List
type: Question
answer count: 2
has body: I have a problem with my MVC application that displays data in a JTable. Everything worked fine, but I decided to add a SwingWorker to retrieve data from the database. My controller calls the model with data from the database. It looks like this. Model.java public class Model { private List&lt;Category&gt; people = new Vector&lt;Category&gt;(); public List&lt;Category&gt; getPeople() { return new ArrayList&lt;Category&gt;(people); } public void load() throws Exception { people.clear(); DAOFactory factory = DAOFactory.getFactory(DAOFactory.MYSQL); CategoryDAO personDAO = factory.getCategoryDAO(); people.addAll(personDAO.getCategory()); } } I add SwingWorker to getCategory class MySQLCategodyDAO.java public class MySQLCategoryDAO extends SwingWorker&lt;Void, Vector&lt;Object&gt;&gt; implements CategoryDAO{ private Job job; private List&lt;Category&gt; cat; public MySQLCategoryDAO(Job job){ this.job = job; } @Override protected Void doInBackground() throws Exception { // TODO Auto-generated method stub if(job == Job.SELECT){ getCategory(); System.out.println("Table selected"); } return null; } @Override() public void done(){ } public List&lt;Category&gt; getCategory() throws SQLException { cat = new ArrayList&lt;Category&gt;(); Connection conn = Database.getInstance().getConnection(); System.out.println(conn); String sql = "select id, name from kategorie"; Statement selectStatement = conn.createStatement(); ResultSet results = selectStatement.executeQuery(sql); while(results.next()) { int id = results.getInt("id"); String name = results.getString("name"); Category category = new Category(id, name); cat.add(category); } results.close(); selectStatement.close(); return cat; } } View just retrieves the data from the model: people = model.getPeople(); for (Category person : people) { tablemodel .addRow(new Object[] { person.getId(), person.getName() }); } The problem comes when you call SwingWorker in class Model.java public void load() throws Exception { people.clear(); D…
accepted answer: http://stackoverflow.com/a/25351192

http://stackoverflow.com/q/25382143
tagged with: static
has comment: http://stackoverflow.com/comment/39583335
has body: I'm working through this Android SQLite tutorial. I've got it working, but in section 9.4 we build a class that extends ContentProvider. If you look under where the UriMatcher is declared and instantiated you'll see a static block of code. static { sURIMatcher.addURI(AUTHORITY, BASE_PATH, TODOS); sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", TODO_ID); } I'm guessing this is here because the UriMatcher is declared static itself. Is that correct? Why can those two lines of code in the static code block not be called in the onCreate method? And finally what is the general purpose of static code blocks like this? Here's a bigger section of the class for some context: public class MyTodoContentProvider extends ContentProvider { // database private TodoDatabaseHelper database; // used for the UriMacher private static final int TODOS = 10; private static final int TODO_ID = 20; private static final String AUTHORITY = "de.vogella.android.todos.contentprovider"; private static final String BASE_PATH = "todos"; public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH); public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/todos"; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/todo"; private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sURIMatcher.addURI(AUTHORITY, BASE_PATH, TODOS); sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", TODO_ID); } @Override public boolean onCreate() { database = new TodoDatabaseHelper(getContext()); return false; }
has answer: http://stackoverflow.com/a/25382228
possible better answer: http://stackoverflow.com/a/25382228
answer count: 3
type: AnsweredQuestion
has title: Android Tutorial contains a static code block, what's the reasoning for this?
score: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25382239
accepted answer: http://stackoverflow.com/a/25382239
has answer: http://stackoverflow.com/a/25382241
type: Question

http://stackoverflow.com/comment/39567914
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25373602
score: 0
has text: @developerwjk I have other custom tags for the other inputs inside the form. In this moment, I am just testing this first tag. But no `<form...> ` is displayed in the HTML source.

http://stackoverflow.com/a/25380632
answers question: http://stackoverflow.com/q/25304538
type: AcceptedAnswer
has body: Got answer from oracle OTN forum , by mr . bouye From the article Bar Chart at Oracle's, you would need to do: ((CategoryAxis)stackChart.getXAxis()).setCategories(FXCollections.&lt;String&gt;observableArrayList(Arrays.asList(austria, brazil, france, italy, usa))); Or more simply: ((CategoryAxis)stackChart.getXAxis()).getCategories().setAll(austria, brazil, france, italy, usa); For me it fixes the issue.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25304538

http://stackoverflow.com/comment/39314866
has text: when would you want to stop it??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25236104

http://stackoverflow.com/comment/39567397
type: QuestionComment
comment on: http://stackoverflow.com/q/25372852
score: 0
has text: It is indeed being clicked.
type: Comment

http://stackoverflow.com/q/25373346
has comment: http://stackoverflow.com/comment/39567600
score: 0
has body: I am running some automated test cases using safari webdriver and i face the issue unreachable browser exception most of the time. And few other times it works but 50% of the time selenium cannot launch the safari browser. Aug 18, 2014 5:35:44 PM org.openqa.selenium.safari.SafariDriverServer start INFO: Server started on port 5608 Aug 18, 2014 5:35:44 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start INFO: Launching Safari Aug 18, 2014 5:35:44 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start INFO: Waiting for SafariDriver to connect Aug 18, 2014 5:36:29 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Shutting down Aug 18, 2014 5:36:29 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Stopping Safari Aug 18, 2014 5:36:29 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Stopping server Aug 18, 2014 5:36:29 PM org.openqa.selenium.safari.SafariDriverServer stop INFO: Stopping server Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Uninstalling extensions Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Shutdown complete Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Shutting down Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Stopping server Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Uninstalling extensions Aug 18, 2014 5:36:30 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop INFO: Shutdown complete 2014-08-18 17:36:33 ERROR myProject:217 - Failed to connect to SafariDriver after 45182 ms Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: '***', ip: '****', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.7.0_25' Should i set some capabilities for the safari webdriver while launching the brow…
has title: Unreachable Browser Exception with Selenium
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39571503
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/39569410
has comment: http://stackoverflow.com/comment/39589378
has comment: http://stackoverflow.com/comment/39593072
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39567724
has comment: http://stackoverflow.com/comment/39569547

http://stackoverflow.com/q/25276477
has comment: http://stackoverflow.com/comment/39387904
tagged with: regex
has comment: http://stackoverflow.com/comment/39388084
has title: Java regular expression matches too much
has comment: http://stackoverflow.com/comment/39388033
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39388079
has comment: http://stackoverflow.com/comment/39388064
has comment: http://stackoverflow.com/comment/39388043
has comment: http://stackoverflow.com/comment/39387935
tagged with: java
has comment: http://stackoverflow.com/comment/39388081
answer count: 1
has comment: http://stackoverflow.com/comment/39387913
has comment: http://stackoverflow.com/comment/39388151
tagged with: parsing
type: Question
has body: So I am writing a chess PGN parser, and I'm having trouble breaking up the file. Here are a few caveats: I am slurping the entire file into a String, so what I have looks like: [Event "Rising Stars vs Experience"] [Site "Amsterdam NED"] [Date "2010.08.22"] [Round "10"] [White "Peter Heine Nielsen"] [Black "Anish Giri"] [Result "1-0"] [ECO "E05"] [WhiteElo "2700"] [BlackElo "2672"] [Annotator "Soltis, Andy"] [PlyCount "113"] [EventDate "2010.08.12"] 1. d4 Nf6 2. c4 e6 3. Nf3 d5 4. g3 Be7 5. Bg2 O-O 6. O-O dxc4 7. Qc2 a6 8. a4 Bd7 9. Qxc4 Bc6 10. Bg5 h6 11. Bxf6 Bxf6 12. Nc3 Bxf3 13. Bxf3 c6 14. Qb3 Ra7 15. Ne4 Bxd4 16. Rfd1 Qb6 17. Qd3 c5 18. e3 Be5 19. Rac1 Nc6 20. Nxc5 Rd8 21. Nd7 Qxb2 22. Qc4 b5 23. axb5 axb5 24. Qxc6 Raxd7 {Diagram [#]} 25. Qxd7 (25. Rxd7 Rxd7 26. Qxd7 Qxc1+) 25... Rxd7 26. Rc8+ (26. Rxd7 Qxc1+) 26... Kh7 27. Rxd7 Kg6 28. h4 Qa3 29. Kg2 Kf6 30. Rb7 Qd6 31. Ra8 b4 32. Raa7 Qf8 33. h5 Bd6 34. Rd7 Be5 35. Rab7 Qe8 36. Bd1 Bc3 37. Bb3 Bd2 38. Kf1 Bc3 39. Ke2 Qg8 40. Bc2 Qe8 41. f4 g5 42. hxg6 fxg6 43. e4 g5 44. e5+ Bxe5 45. Rf7+ Qxf7 46. fxe5+ Kg7 47. Rxf7+ Kxf7 48. g4 Kg7 49. Kf3 Kf7 50. Bb3 Ke7 51. Ke4 Kf7 52. Bd1 Kg7 53. Kd4 Kg6 54. Kc4 h5 55. gxh5+ Kf5 56. h6 Kg6 57. Bg4 1-0 . . over and over again. I'm trying to create a pattern that will parse out the tags in the beginning, and the move text afterwards. So in the example I listed above, there should be 13 tags followed by 1 game text matched for this first game. Each subsequent game is matched similarly. The regular expression I'm using is: private static final String PGN_PATTERN = "(^\\[\\w+\\s+\".*\"\\])+(.*(1-0|0-1))"; and I think the part that is messing me up is the '.*' expression I'm using the capture the game movements. I haven't come up with a decent pattern yet for this part, so I just want to capture the game movements in a String and move on to the next pattern. Can someone help me out with this?
has answer: http://stackoverflow.com/a/25276624
accepted answer: http://stackoverflow.com/a/25276624
has comment: http://stackoverflow.com/comment/39387950

http://stackoverflow.com/q/25256953
type: UnansweredQuestion
has title: The meaning of action's context in interface ActionValidatorManager method validate() in Struts 2
has answer: http://stackoverflow.com/a/25258816
tagged with: struts
tagged with: struts2
has comment: http://stackoverflow.com/comment/39365167
tagged with: xwork
score: 0
tagged with: validation
tagged with: java
answer count: 1
has body: I wanted to use the following method for validation through XMLs on clientside. Can someone please tell me about the context of an action as said in the following method: Interface ActionValidatorManager: void validate(Object object, String context) throws ValidationException Validates the given object using action and its context. Parameters: object - the action to validate. context - the action's context. Throws: ValidationException - if an error happens when validating the action. I am not able to understand the meaning of action's context in this method.
type: Question

http://stackoverflow.com/comment/39344004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25252127
has text: Take a look at the previous example I linked

http://stackoverflow.com/q/25350579
has body: One user sent me the following error: java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads at android.content.ContentResolver.insert(ContentResolver.java:860) at android.app.DownloadManager.enqueue(DownloadManager.java:904) at even if i use the following code: ApplicationInfo ai = null;//Check if download manager is enabled try { ai = this.getPackageManager().getApplicationInfo("com.android.providers.downloads",0); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } appStatus = ai.enabled; When user tries to download if(appStatus=false){ // Download manager not available..... } else { //filename=String String fileName=URLUtil.guessFileName(url,contentDisposition,mimetype); request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName); request.setDescription(fileName); manager.enqueue(request); } What i am doing wrong?
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39525107
type: Question
tagged with: download-manager
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/53867693
has comment: http://stackoverflow.com/comment/69645001
has title: DownloadManager java.lang.IllegalArgumentException

http://stackoverflow.com/comment/39485023
type: Comment
has text: Hey Ian - thank you very much, this issue had been on my todo list for 9 months now and I am very happy to have solved it finally :-D Btw. I checked GATE and this looks very promising, maybe I'll find an application in my project :-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25312006

http://stackoverflow.com/comment/39383470
has text: Can someone clarify? It shouldn't have Person though, as these two will be run on different machines.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25273658
score: 0

http://stackoverflow.com/comment/63419460
type: Comment
has text: @MrkK Accept the answer instead of writing a comment.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25278030

http://stackoverflow.com/a/69119040
answers question: http://stackoverflow.com/q/25346712
score: 0
has body: private fun main(){ val bmp:Bitmap? = null //Any bitmap (if you are working with bitmap) var mRgba = Mat() // else you can direct use MAT on onCameraFrame val mGray = Mat() val bmp32: Bitmap = bmp.copy(Bitmap.Config.ARGB_8888, true) Utils.bitmapToMat(bmp32, mRgba) Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_BGR2GRAY) mRgba = makeOrientationCorrection(mRgba,mGray)// here actual magic starts Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_BGR2GRAY) val bmpOutX = Bitmap.createBitmap( mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888 ) Utils.matToBitmap(mRgba, bmpOutX) binding.imagePreview.setImageBitmap(bmpOutX!!) } private fun makeOrientationCorrection(mRGBA:Mat, mGRAY:Mat):Mat{ val dst = Mat() val cdst = Mat() val cdstP: Mat Imgproc.Canny(mGRAY, dst, 50.0, 200.0, 3, false) Imgproc.cvtColor(dst, cdst, Imgproc.COLOR_GRAY2BGR) cdstP = cdst.clone() val linesP = Mat() Imgproc.HoughLinesP(dst, linesP, 1.0, Math.PI/180, 50, 50.0, 10.0) var biggestLineX1 = 0.0 var biggestLineY1 = 0.0 var biggestLineX2 = 0.0 var biggestLineY2 = 0.0 var biggestLine = 0.0 for (x in 0 until linesP.rows()) { val l = linesP[x, 0] Imgproc.line( cdstP, org.opencv.core.Point(l[0], l[1]), org.opencv.core.Point(l[2], l[3]), Scalar(0.0, 0.0, 255.0), 3, Imgproc.LINE_AA, 0) } for (x in 0 until linesP.rows()) { val l = linesP[x, 0] val x1 = l[0] val y1 = l[1] val x2 = l[2] val y2 = l[3] val lineHeight = sqrt(((x2 - x1).pow(2.0)) + ((y2 - y1).pow(2.0))) if(biggestLine<lineHeight){ val angleOfRotationX1 = angleOf(PointF(x1.toFloat(),y1.toFloat()),PointF(x2.toFloat(),y2.toFloat())) Log.e("angleOfRotationX1","$angleOfRotationX1") if(angleOfRotationX1<45.0 || angleOfRotationX1>270.0){ biggestLine = lineHeight if(angleOfRotationX1<45.0){ biggestLineX1 = x1 biggestLineY1 = y1 biggestLineX2 = x2 biggestLineY2 = y2 } if(angleOfRotationX1>270.0){ biggestLineX1 = x2 biggestLineY1 = y2 biggestLineX2 = x1 biggestLineY2 = y1 } } } if(x==linesP.rows()-1){ Imgproc.line( cdstP, org.opencv.core.Point(biggestLineX1, biggestL…
type: Answer

http://stackoverflow.com/comment/39541905
type: QuestionComment
has text: Can there be spaces in the `'....'` strings?
comment on: http://stackoverflow.com/q/25360121
score: 1
type: Comment

http://stackoverflow.com/comment/39567068
comment on: http://stackoverflow.com/q/25373220
has text: In what you've shown here, 78 appears after two spaces, not three. Are you sure you have your requirements right?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39569584
type: QuestionComment
has text: Have you tried pausing the process and using a tool like `lsof` with the proper settings to filter?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25374505

http://stackoverflow.com/a/25319062
type: Answer
score: 0
has body: In your case its better to use a global class variable: public class MyClass { int operation; public int getOperation() { return operation; } public void setOperation(int value) { this.operation = value; } ..... THEN: .... public void buttonOnClick(View v){ ... case R.id.plus: this.operation = 1; break; case R.id.eq: if (this.operation == 1){ // Print value } break; .....
answers question: http://stackoverflow.com/q/25318857

http://stackoverflow.com/comment/39314697
type: QuestionComment
has text: @markspace this method already uses nio.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25236977

http://stackoverflow.com/comment/39387052
type: AnswerComment
score: 0
has text: +1 for pointing out that R is just another Java class and lives in a package
type: Comment
comment on: http://stackoverflow.com/a/25275802

http://stackoverflow.com/comment/139653338
has text: @JörgWMittag Java is indeed based on Objective-C but also on C++, Eiffel and others, as J.Gosling explained in the foundational Java white paper https://www.stroustrup.com/1995_Java_whitepaper.pdf p.12-13: "Design and architecture decisions drew from a variety of languages such as Eiffel, SmallTalk, Objective C, and Cedar/Mesa" and "keeping Java looking like C++ as far as possible results in Java being a familiar language (...) Having Java retain many of the object-oriented features and the 'look and feel' of C++ means that programmers can migrate easily to Java and be productive quickly"
type: Comment
comment on: http://stackoverflow.com/a/25323426
score: 0
type: AnswerComment

http://stackoverflow.com/q/25380096
tagged with: android
tagged with: eclipse
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39579870
tagged with: java
answer count: 1
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/39579947
linked to: http://stackoverflow.com/q/1372876
has title: Auto generate getter setter for shared prefrences
favorite count: 0
has answer: http://stackoverflow.com/a/25383690
type: Question
linked to: http://stackoverflow.com/q/23426493
has comment: http://stackoverflow.com/comment/39579731
has body: I know we can generate getter and setters by Source -> Generate Getter and Setters... but my question is is there any way we write our own Template for shared preferences getter and setters that can generate all the getter setters against all the data members in exactly the same way as Eclipse does for simple Getter and Setters. Its hectic job when you've a lot to save in preferences. Can eclipse write the following code for me against KEY_SESSTION_TIMEOUT. private static final String KEY_SESSION_TIMEOUT = "sTimeOut"; public static long getSessionTimeOut() { return sp.getLong(KEY_SESSION_TIMEOUT, 30000); } public static void setSessionTimeOut(long timeOutSec) { editor.putLong(KEY_SESSION_TIMEOUT, timeOutSec).commit(); }
type: UnansweredQuestion

http://stackoverflow.com/q/25271333
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/25271499
has comment: http://stackoverflow.com/comment/39378557
type: Question
has answer: http://stackoverflow.com/a/25271499
has title: SQL speed increase: Left Join, or Cartesian product/where clause
type: AnsweredQuestion
score: 0
tagged with: java
has body: I'm working with a sql query in a webservice and am looking to increase its speed. As of now, the query takes the cartesian products of multiple tables and uses a where clause to separate them out. I was wondering if switching to a LEFT JOIN would make the query execute faster since every row I want in my result is based off of one table, with additional information being pulled in from others.
tagged with: mysql
has comment: http://stackoverflow.com/comment/39378717

http://stackoverflow.com/comment/39560057
comment on: http://stackoverflow.com/q/25369407
type: QuestionComment
score: 2
has text: Consider using `Pattern.quote(key)` to escape potential regex metacharacters.
type: Comment

http://stackoverflow.com/q/25297967
has comment: http://stackoverflow.com/comment/39428399
possible better answer: http://stackoverflow.com/a/25298071
type: Question
accepted answer: http://stackoverflow.com/a/25298226
has answer: http://stackoverflow.com/a/25298226
has comment: http://stackoverflow.com/comment/39428346
has comment: http://stackoverflow.com/comment/39428336
has body: I have a text file (file.txt) which contains multiple lines: /location/test/file.csv /location/test1/file2.csv /location/test2/file.exe Using ECMA, I would like to replace all instance of "/" with "\". However, the code below only replaces the first line and eliminate lines 2 and 3. This is the result of the file.txt file after I run the code (as I said, lines 2 and 3 are missing): \location\test\file.csv Can anyone please help? function ReadFile () { var file = new java.io.BufferedReader(new java.io.FileReader("C:\\Test\\file.txt")); var fileWriter = new java.io.FileWriter("C:\\Test\\file.txt",false); while ((line = file.readLine()) != null) { println(line); if (line.contains ("/")) line = line.replace("/","\\"); fileWriter.write(line); fileWriter.close(); } } ReadFile ();
has answer: http://stackoverflow.com/a/25298097
has answer: http://stackoverflow.com/a/25298071
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39428296
score: 0
tagged with: java
has title: Replace string in text file using Java
answer count: 3

http://stackoverflow.com/q/25270399
linked to: http://stackoverflow.com/q/3732109
type: AnsweredQuestion
has body: This code should be able to respond to client browser. This is my code for listening to browser: public class simpleServer extends Thread { static ServerSocket serverSocket; public static void main(String[] args) throws IOException { serverSocket = new ServerSocket(8000); Thread t = new simpleServer(); t.start(); } @Override public void run() { while (true) { try (Socket socket = serverSocket.accept(); DataInputStream in = new DataInputStream(socket.getInputStream());) { String received = in.readUTF(); System.out.println("What received: " + received); } catch (IOException ioe) { ioe.printStackTrace(); } } } } Running code result: java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readUTF(DataInputStream.java:609) at java.io.DataInputStream.readUTF(DataInputStream.java:564) at myp.simpleServer.run(simpleServer.java:23) I try localhost:8000 But the unable to connect!
score: 0
has comment: http://stackoverflow.com/comment/39376966
answer count: 2
tagged with: serversocket
possible better answer: http://stackoverflow.com/a/25271130
has comment: http://stackoverflow.com/comment/39376735
accepted answer: http://stackoverflow.com/a/25270858
tagged with: java
has answer: http://stackoverflow.com/a/25270858
has comment: http://stackoverflow.com/comment/39376941
has comment: http://stackoverflow.com/comment/39376855
type: Question
linked to: http://stackoverflow.com/q/10788125
has comment: http://stackoverflow.com/comment/39376944
has comment: http://stackoverflow.com/comment/39376778
has answer: http://stackoverflow.com/a/25271130
tagged with: io
has title: Java responses to browser

http://stackoverflow.com/comment/39589477
score: 1
has text: You might want to define an equals method in Item.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25385058

http://stackoverflow.com/q/25318809
type: UnansweredQuestion
has title: suggestions on creating a admin page using jsp
has body: I am pretty new in developing web applications using Java. I have developed a small application which is a login & registration page both of which are working fine. Now, I have decided on making a admin page(using jsp). In my java code I control the redirection of jsp pages (if user!="admin"then home.jsp else user=="admin" then admin.jsp). in my admin page what I want to do is I want the admin to be able to view all the users registered and can edit their details or delete them. Someone can please suggest me on how to achieve this. Login Servlet.java(code where I decide between admin & regular user) protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String email = request.getParameter("email"); String password = request.getParameter("password"); String errorMsg = null; String name; if(email == null || email.equals("")){ errorMsg ="User Email can't be null or empty"; } if(password == null || password.equals("")){ errorMsg = "Password can't be null or empty"; } if(errorMsg != null){ RequestDispatcher rd = getServletContext().getRequestDispatcher("/login.html"); PrintWriter out= response.getWriter(); out.println(""+errorMsg+""); rd.include(request, response); }else{ Connection con = (Connection) getServletContext().getAttribute("DBConnection"); PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement("select id, name, email,country from Users where email=? and password=?"); ps.setString(1, email); ps.setString(2, password); rs = ps.executeQuery(); if(rs != null && rs.next()){ User user = new User(rs.getString("name"), rs.getString("email"), rs.getString("country"), rs.getInt("id")); name=rs.getString("name"); System.out.println("Name:"+ name); //if(rs.getString("name")!="admin") if(!name.equalsIgnoreCase("admin")) { logger.info("User found with details="+user); HttpSession session = request.getSession(); session.setAttribute("User", user); response.sendRedirect("home.jsp"); } /…
answer count: 2
downvote count: 0
tagged with: jsp
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25320249
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25318847
tagged with: java

http://stackoverflow.com/comment/39551905
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25365022
has text: It doesn't make any effect on where it is started, I tried starting it in the `onCreate();` and stopping it in the `onPostExecute();` but the result is the same.
score: 0

http://stackoverflow.com/comment/39495493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25333711
has text: If you use Calendar as your Entity property then in plain java it prints a lot of information which is not necessary when you want to save it to database, for example.In that case, you can have something like @Temporal(TemporalType.TIMESTAMP)Calendar calendar in your entity to store timestamp to your database or just date or just time by changing to @Temporal(TemporalType.DATE) or @Temporal(TemporalType.TIME) on your Calendar property.
score: 6

http://stackoverflow.com/a/25259589
has comment: http://stackoverflow.com/comment/39430303
has body: The Expr class derives from AST, which has equals, compareTo, and hashCode functions for this purpose. Since Z3 uses hash consing, this is very efficient, essentially just comparison of pointers (and, in Java, a cast).
answers question: http://stackoverflow.com/q/25251936
type: Answer
upvote count: 4
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25251936
score: 4

http://stackoverflow.com/q/25294343
score: 2
answer count: 1
downvote count: 0
tagged with: jackson
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25294996
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25294996
favorite count: 0
type: Question
tagged with: yammer
has body: I'm trying to parse JSON like the following into object using Jackson on Android (Note: I'm not in control of the JSON format - the format comes from Yammer) "references": [ { "type": "user", "id": 12345678, "name": "Wex" }, { "type": "message", "id": 12345679, "body": { "plain":"A short message" } }, { "type": "thread", "id": 12345670, "thread_starter_id": 428181699 } ] The problem is that each entry in references is a different type of object with different properties. As a start I've got: public static class Reference { public String type; public String id; } I'd rather avoid putting all potential properties in one object like: public static class Reference { public static class Body { public String plain; } public String type; public String id; public String name; public Body body; public String thread_starter_id; } And want to use separate classes that are created dependant on the type value like: public static class ReferenceUser extends Reference { public String name; } public static class ReferenceMessage extends Reference { public static class Body { public String plain; } public Body body; } public static class ReferenceThread extends Reference { public String thread_starter_id; } So... what's the best way of getting Jackson to parse the JSON like that? I'm currently parsing it quite simply like this: ObjectMapper mapper = new ObjectMapper(); Reference[] references = mapper.readValue(json, Reference[].class);
has title: How do I parse a JSON array into different objects using Jackson on Android?
upvote count: 2

http://stackoverflow.com/a/25503737
score: 0
answers question: http://stackoverflow.com/q/25361615
type: Answer
has body: I get it to work but i don't actually have several packages. My guess is though that the actual name is package.class and that is why it doesn't recognise it. It could yield unexpected results if there were several classes with same name and that is why it's not possible. My suggestion would be checking out aliases http://www.doxygen.nl/manual/custcmd.html if you dont want to have to add the package.

http://stackoverflow.com/comment/39362205
score: 1
type: QuestionComment
has text: this is not valid java code
comment on: http://stackoverflow.com/q/25262686
type: Comment

http://stackoverflow.com/a/25304313
score: 3
has body: You are instantiating cind and dbind inside the loop. This should fix it: cind = new String [sumc.length]; dbind = new String [sumc.length]; for (int i = 0 ; i &lt;= sumc.length - 1 ; i++){ String local = sumc[i]; System.out.println(local); String[] parts = local.split(":"); System.out.println(parts[0]); System.out.println(parts[1]); cind[i] = local.split(":")[0]; dbind[i] = local.split(":")[1]; } System.out.println(Arrays.toString(cind) + "\t"); System.out.println(Arrays.toString(dbind) + "\t"); A cleaner way of converting your Array sumc to a table-like structure would be as follows: String[][] data = new String[sumc.length][2]; for (int i = 0; i &lt; sumc.length; i++) data[i] = sumc[i].split(":"); Access is done via data[i][0] and data[i][1] respectively.
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39439792
accepted answer of: http://stackoverflow.com/q/25304217
has comment: http://stackoverflow.com/comment/39439848
answers question: http://stackoverflow.com/q/25304217
type: Answer
has comment: http://stackoverflow.com/comment/39440013

http://stackoverflow.com/q/25247469
tagged with: stringtokenizer
has comment: http://stackoverflow.com/comment/39334492
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
has body: I'm very new at Java and I have a question about a summer assignment. These are the instructions: Write a class called SpecialToken that has a static method called thirdToken. This method should return as a String, the third token of a String that you pass as a parameter. You may assume that spaces will serve as delimiters. This is what I have so far but honestly I am stumped at what the parameter should be and how to return the third token! I was thinking I could do something like nextToken() until the third. public class SpecialToken { public static String thirdToken() { } }
has comment: http://stackoverflow.com/comment/39334461
has title: Returning the nth Token
score: 2
has comment: http://stackoverflow.com/comment/39334294
tagged with: java
has answer: http://stackoverflow.com/a/25247611

http://stackoverflow.com/comment/39329070
has text: The error message is included in the code as a comment.
comment on: http://stackoverflow.com/q/25244719
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39744123
type: Comment
comment on: http://stackoverflow.com/a/25266264
type: AnswerComment
score: 0
has text: So don't use 'Arrays.asList' :). Choose a storage structure (either int[], or some List<Integer>), and then stick with it. Having to repeatedly convert it into something else is a bad code smell. (and 'for' loops iterating across int[] is fine - you don't HAVE to use 'contains()'). Whichever storage structure you choose will not change the behaviour of those three methods I suggested (merely their implementation). Your bug was caused by single bits of code doing too much (checking for duplicates AND less than 30) leading to repetition - lookup "separation of concerns" and "DRY principle"

http://stackoverflow.com/q/25316550
has answer: http://stackoverflow.com/a/25316721
has body: I have wrote a simple code that is a tinny web server . i want to show a picture when the client enter loalhost:8181/pic but when i String str = in.readLine() str show only localhost:8181 how i can find out the client in his browser enter the localhost:8181/pic ? there is my simple code : protected void start() { ServerSocket s; System.out.println("Webserver starting up on port 80"); System.out.println("(press ctrl-c to exit)"); try { // create the main server socket s = new ServerSocket(8181); } catch (Exception e) { System.out.println("Error: " + e); return; } System.out.println("Waiting for connection"); for (;;) { try { Socket remote = s.accept(); System.out.println("Connection, sending data."); BufferedReader in = new BufferedReader(new InputStreamReader( remote.getInputStream())); PrintWriter out = new PrintWriter(remote.getOutputStream()); String method = in.readLine(); out.flush(); remote.close(); } catch (Exception e) { System.out.println("Error: " + e); } } }
tagged with: http
favorite count: 0
has title: get url address with network class
type: Question
tagged with: sockets
has answer: http://stackoverflow.com/a/28506190
accepted answer: http://stackoverflow.com/a/28506190
downvote count: 0
tagged with: webserver
upvote count: 1
has answer: http://stackoverflow.com/a/25320845
possible better answer: http://stackoverflow.com/a/25320845
type: AnsweredQuestion
answer count: 3
score: 1
tagged with: java

compiler-errors
tags question: http://stackoverflow.com/q/25270240
tag name: compiler-errors
tags question: http://stackoverflow.com/q/25280644
tags question: http://stackoverflow.com/q/25360127
type: Tag
tags question: http://stackoverflow.com/q/25250197
tags question: http://stackoverflow.com/q/25282530
tags question: http://stackoverflow.com/q/25368907

http://stackoverflow.com/comment/39684809
type: AnswerComment
has text: This is assuming the list of strings is sorted, which isn't stated anywhere? If the list isn't sorted, it would make sense to sort it before passing it to this function so it only gets sorted once and not every time the function is called. Other than that I agree with this solution.
score: 0
comment on: http://stackoverflow.com/a/25428864
type: Comment

http://stackoverflow.com/a/25312448
upvote count: 6
has body: By implementing BeanNameAware. @Named("myUniqueName") public class ReportDashboardDao implements DashboardDAO, BeanNameAware{ //STUFF private String beanName; @Override public Void setBeanName(String beanName) { this.beanName = beanName; } } So that Spring can inject the beanName into the bean. If you add a public String getBeanName(); in your DashboardDAO interface, DashboardDaoConsumer will be able to obtain it. In this particular case, Spring will inject the name you specified in the annotation.
downvote count: 1
score: 5
type: Answer
answers question: http://stackoverflow.com/q/25301119

http://stackoverflow.com/comment/39478901
score: 0
type: AnswerComment
has text: I am no expert in C++, but at least in C there is sequence point involved in function call. If this is the case, your simplified example is not equivalent, and original C++ example is well defined.
comment on: http://stackoverflow.com/a/25324088
type: Comment

http://stackoverflow.com/comment/39486736
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25329343
type: Comment
has text: You're welcome, always check the javadoc when questions arise about a core Java class :) (or any class for that matter, good libraries are always documented).

http://stackoverflow.com/a/61696771
downvote count: 0
type: Answer
has body: allow less secure apps from your google account settings https://www.google.com/settings/security/lesssecureapps open your gmail> goto settings > IMAP/POP settings > enable IMAP goto this url and turn this on (completing all these steps will surely work) https://www.google.com/accounts/DisplayUnlockCaptcha official guide for help https://support.google.com/mail/answer/7126229?hl=en-GB&amp;visit_id=637246238859828954-474780158&amp;rd=2
upvote count: 6
answers question: http://stackoverflow.com/q/25341198
score: 6

http://stackoverflow.com/a/25261143
has body: It is better to import them one by one. This is simply because you may not have code collisions now, but if there is a later update to the package you are importing that adds a new class that has the same name as a class you have personally, written, it will break. Performance is not really the main issue with this, because it shouldn't make the code run slower, but it may increase the size of your .class files or .jar. The number of import statements is not really that big of an issue - yes, it may be many lines, but does it really do any damage to the readability of your code? Not really. I hope this helped.
type: Answer
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25260952

http://stackoverflow.com/a/25364818
upvote count: 1
answers question: http://stackoverflow.com/q/25364587
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39587150
has body: You can use SafeProgressBarUpdaterThread : progressBarUpdater = new SafeProgressBarUpdaterThread(progressBar); //... progressBarUpdater.setMaximum(maximum); progressBarUpdater.setValue(value); java.awt.EventQueue.invokeLater(progressBarUpdater);
downvote count: 0

http://stackoverflow.com/comment/39558114
type: Comment
type: QuestionComment
score: 0
has text: Try to repaint your panel after adding the label `panel.revalidate(); panel.repaint();`
comment on: http://stackoverflow.com/q/25368339

http://stackoverflow.com/a/25369776
type: Answer
answers question: http://stackoverflow.com/q/25369738
has body: How come 'Mango' is not placed before 'mango' and why is 'Pineapple' before 'pineapple'? According to your comparator, "Mango" and "mango" compare equal. Since Collections.sort() is stable, items that compare equal are returned in the order in which they were found in the original collection (an unstable sort would return them in an arbitrary order). If you expect "Mango" to always be returned just before "mango", your comparator needs to reflect that. This means that "Mango" needs to compare less than "mango" (but greater than "apple", "apricot", "Banana" etc). One way to achieve this is with the following comparator: Collections.sort(fruits, new Comparator&lt;String&gt;() { @Override public int compare(String o1, String o2) { int ret = o1.compareToIgnoreCase(o2); if (ret == 0) { ret = o1.compareTo(o2); } return ret; } }); This would return: Sorted: [apple, apricot, Banana, Mango, mango, melon, peach, Pineapple, pineapple]
score: 2
upvote count: 3
downvote count: 1

http://stackoverflow.com/comment/39566643
type: Comment
has text: what can i do to free up the memory it is using?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25373062

http://stackoverflow.com/q/25294711
downvote count: 0
accepted answer: http://stackoverflow.com/a/25295738
upvote count: 1
possible better answer: http://stackoverflow.com/a/25295963
has comment: http://stackoverflow.com/comment/39423636
has answer: http://stackoverflow.com/a/25295738
has title: Use JAXB and interpret same tag differently based on enclosing tag
type: AnsweredQuestion
tagged with: unmarshalling
score: 1
tagged with: java
tagged with: jaxb
has body: In the below sample, the Data block inside A and the Data block inside B should be unmarshalled into different classes. Is this achievable using JAXB? <Data> <Data> The Data inside A and the Data inside B represent different classes.The data inside A should be mapped to AData.class and the Data inside B should be mapped to BData.class. Note: Marshalling is working fine. Any number of classes can have the same name tag. The generated xml contains the same tag for all those classes. In this case, AData and BData will both be written to XML as <Data> . But even the same marshalled xml cannot be unmarshalled again. I am hoping this can be solved by adding some additional annotations.
has comment: http://stackoverflow.com/comment/39423904
favorite count: 0
has answer: http://stackoverflow.com/a/25295963
tagged with: http://stackoverflow.com/tag/xml
type: Question
answer count: 2

http://stackoverflow.com/comment/39558460
type: AnswerComment
comment on: http://stackoverflow.com/a/25368848
type: Comment
has text: It worked, thanks. But it printed single character in 1 line like s \n a \n m\n p\n\nl\ne\n1\n2\n1\n2...How do I print it line by line as in input?
score: 0

http://stackoverflow.com/a/25311812
has comment: http://stackoverflow.com/comment/39458484
answers question: http://stackoverflow.com/q/25304745
score: 0
has comment: http://stackoverflow.com/comment/39457703
accepted answer of: http://stackoverflow.com/q/25304745
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39458634
type: Answer
has body: Very simple, just use a wrong certificate ...

http://stackoverflow.com/comment/39400296
has text: Honestly, I have not worked with JavaFX at all. It would work pretty well, but the tutorials are scarce and the tutorials that talk about how to use JavaFX 1.1 have *nothing* to do with how to use JavaFX 2.0.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25283168
type: Comment

http://stackoverflow.com/a/25275818
has body: Start by create a new base class which extends from JPanel. Within this class, declare the from and to fields. Setup the layout, create and add your components to. Provide setter and getter methods to allow you to adjust the values of the fields, for example... public void setToValue(String text) { toField.setText(text); } public String gtToValue() { return toField.getText(); } You may also want to provide a setter to allow you to change the label as well. When needed, create an instance of this component and it to your UI and populate it with the values you need You could extend this idea to also provide a validation model of some kind to allow you to validate the to and from fields when they change, but lets keep to basics. Take a look at Creating a GUI With JFC/Swing for more details
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25275786
upvote count: 3
answers question: http://stackoverflow.com/q/25275786
downvote count: 0
has comment: http://stackoverflow.com/comment/39386985
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39386854

http://stackoverflow.com/q/25364157
downvote count: 0
tagged with: reflection
tagged with: java
answer count: 1
tagged with: annotations
tagged with: jsp
has title: Read property of annotation
favorite count: 0
type: Question
has body: If I had defined this class: @MainForm(grupo = 3, icone = "user") public class Usuario { ... } and pass to the view this List (which include the class above): public List&lt;Class&lt;?&gt;&gt; lista_classes_projeto() { ... } Is there any way to read the value for icone in this jsp code: &lt;c:forEach var="option" items="${lista}"&gt; &lt;li&gt; &lt;c:url value="/${option.simpleName}/listagem" var="url"/&gt; &lt;a class="link" href="${url}"&gt; &lt;i class="icon-"&gt;&lt;/i&gt; &lt;span&gt;${option.simpleName}&lt;/span&gt; &lt;/a&gt; &lt;/li&gt; &lt;/c:forEach&gt;
type: UnansweredQuestion
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/25364451
tagged with: jstl

http://stackoverflow.com/comment/39544304
comment on: http://stackoverflow.com/q/25361086
score: 0
type: Comment
type: QuestionComment
has text: It's hard to say with just the little bit of code you provided. It seems so, especially because you also get a `SocketException` that your pipe is broken, i.e. there is some problem with the connection. Could you maybe show the code, you use for receiving?

win32gui
type: Tag
tags question: http://stackoverflow.com/q/25241133
tag name: win32gui

http://stackoverflow.com/a/25374472
has comment: http://stackoverflow.com/comment/39587572
has comment: http://stackoverflow.com/comment/39584279
has comment: http://stackoverflow.com/comment/39586393
upvote count: 1
has comment: http://stackoverflow.com/comment/39570862
downvote count: 1
has comment: http://stackoverflow.com/comment/39570272
has comment: http://stackoverflow.com/comment/39576617
has comment: http://stackoverflow.com/comment/39573829
type: Answer
answers question: http://stackoverflow.com/q/25374362
has body: For a very basic example, while this is allowable in Java: public class HelloWorld { public static void main(String[] args) { int x = 4; String name = "four"; String test = name + x; System.out.println(test); } } The same thing will produce a compile error in Haskell: fourExample = "four" + 4 There is no implicit type casting in Haskell which helps in preventing silly errors like "four" + 4. You have to tell it explicitly, that you want to convert it to String: fourExample = "four" ++ show 4
has comment: http://stackoverflow.com/comment/39572958
has comment: http://stackoverflow.com/comment/39571086
score: 0
has comment: http://stackoverflow.com/comment/39569485

rsa
tags question: http://stackoverflow.com/q/25318008
type: Tag
tag name: rsa
tags question: http://stackoverflow.com/q/25318992
tags question: http://stackoverflow.com/q/25264750

http://stackoverflow.com/comment/39629126
type: AnswerComment
comment on: http://stackoverflow.com/a/25363135
score: 1
type: Comment
has text: I used this answer. Thanks guys.

http://stackoverflow.com/comment/39562137
type: Comment
type: QuestionComment
has text: whats the value of `TAG_SUCCESS`?
score: 0
comment on: http://stackoverflow.com/q/25370643

http://stackoverflow.com/q/25377249
has body: I'm trying to processing a step using my custom plugin. so i tried to get the value of a field from previous step inside the method processRow(). i tried some thing like this : public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (PluginMeta) smi; data = (PluginData) sdi; Object[] r=getRow(); // get row, blocks when needed! if (r==null) // no more input to be expected... { setOutputDone(); return false; } if (first) { first = false; data.outputRowMeta = (RowMetaInterface)getInputRowMeta().clone(); meta.getFields(data.outputRowMeta, getStepname(), null, null, this); } Object[] outputRow = RowDataUtil.addValueData(r, data.outputRowMeta.size()-1, ""); putRow(data.outputRowMeta, outputRow); // copy row to possible alternate rowset(s). try { // Send The Query to ActiveMQ FileOutputStream fw = new FileOutputStream("E:\\testing.txt"); fw.write(fieldSubstitute(meta.getField(), data.outputRowMeta, outputRow).getBytes()); fw.close(); } catch (IOException ex) { Logger.getLogger(PluginStep.class.getName()).log(Level.SEVERE, null, ex); System.out.println("@@@@@@@@@@@@@@@@@@@@: "+ex.getMessage()); } if (checkFeedback(getLinesRead())) { if (log.isBasic()) { logBasic("Linenr " + getLinesRead()); } } return true; } so i used fieldSubstitute() for replacing the field with it's output from previous step as i think that. so i'm confused now because it outputs the field name instead of outputs its value. so i think that i have something wrong with the parameters passed to the method. so any Help ?
tagged with: java
answer count: 1
type: Question
tagged with: pentaho
has answer: http://stackoverflow.com/a/25425173
tagged with: pentaho-cde
accepted answer: http://stackoverflow.com/a/25425173
tagged with: kettle
has title: Plugin Development : How to get previous field value?
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25259745
downvote count: 4
has comment: http://stackoverflow.com/comment/39357032
answer count: 2
has body: I'm running a multi threaded program and the problem I have is that it produces different output each time it's run. Here's my code. package com.mypackage; public class TryThreads extends Thread{ int i=-10; public static void main(String arg[]){ TryThreads tt1=new TryThreads(); TryThreads tt2=new TryThreads(); tt1.start(); tt2.start(); } public synchronized void run() { for(;i&lt;=10;i++) { System.out.println(TryThreads.getThreadName()+" "+i); } } static String getThreadName() { Thread t1=new Thread(); return t1.getName(); } } whenever I run the code it produces different output, can anybody help me out with this?
tagged with: java
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/25260500
has comment: http://stackoverflow.com/comment/39357011
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25259826
has comment: http://stackoverflow.com/comment/39357025
has comment: http://stackoverflow.com/comment/39358728
type: UnansweredQuestion
score: -3
has title: Multithreading program producing different ouptut
linked to: http://stackoverflow.com/q/7659615
has comment: http://stackoverflow.com/comment/39367297

http://stackoverflow.com/q/25280016
downvote count: 0
has comment: http://stackoverflow.com/comment/39394095
answer count: 1
has comment: http://stackoverflow.com/comment/39394000
has comment: http://stackoverflow.com/comment/39394255
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39394400
has comment: http://stackoverflow.com/comment/39394842
upvote count: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39394754
has comment: http://stackoverflow.com/comment/39394312
accepted answer: http://stackoverflow.com/a/25280200
tagged with: timertask
has comment: http://stackoverflow.com/comment/39394225
has body: Timer mTimer; void scheduleSyncIn(int aSeconds){ if (mTimer != null) { mTimer.cancel(); mTimer = null; } mTimer = new Timer(); TimerTask task = new TimerTask() { @Override public void run() { handleTimeout(); } }; if (request) { mTimer.schedule(task, aSeconds * 1000); } } method that is called by timer task void handleTimeout(){ Handler mainHandler = new Handler(mContext.getMainLooper()); Runnable runnable = new Runnable(){ @Override public void run() { sync(); //call the sync } }; mainHandler.post(runnable); } from this i got the following report from play store java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again at java.lang.VMThread.create(Native Method) at java.lang.Thread.start(Thread.java:1029) at java.util.Timer$TimerImpl.&lt;init&gt;(Timer.java:192) at java.util.Timer.&lt;init&gt;(Timer.java:367) at java.util.Timer.&lt;init&gt;(Timer.java:387) at java.util.Timer.&lt;init&gt;(Timer.java:394) at com.example.Manager.scheduleSyncIn(Manager.java:66) at com.example.Manager.scheduleSync(Manager.java:56) at com.example.Manager.RequestDone(Manager.java:180) com.example.Manager.Remote$GetMetaData.onPostExecute(Remote.java:338) at com.example.Manager.Remote$GetMetaData.onPostExecute(Remote.java:1) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5137) 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:795) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611) at dalvik.system.NativeStart.main(Native Method) now i don't know why this error while i am cancel the timer and free it for GC every time before initialize.…
has answer: http://stackoverflow.com/a/25280200
favorite count: 0
tagged with: android-asynctask
type: Question
tagged with: timer
has comment: http://stackoverflow.com/comment/39394272
has title: OutOfMemoryError by using java.util.Timer

http://stackoverflow.com/comment/39493653
comment on: http://stackoverflow.com/q/25235552
has text: When you say "In both cases, the second string is a suffix of the first string", how is it that "Tor" is a suffix of "Torcellite"?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39365433
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25264296
has text: Did you define jdbc connection as described here? https://developers.google.com/appengine/docs/java/cloud-sql/

http://stackoverflow.com/comment/39422730
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25294021
has text: Thank you for your constructive response. I will look up SwingWorker and see if that is what I'm looking for. as for the wait, the problem would be if its 100ms more then what it need to be. or if the wait is for 1000ms and then it turns out the condition isnt met until 1001ms in which case i would waste a full 999ms the msgBox.append halts the loop the moment the condition is met.

http://stackoverflow.com/comment/39899805
type: Comment
has text: This looks like the way to go for me. It raises the question of how many MBs of documentation does the site contain (currently 10MB) and how often will the build run (roughly once a day). So it looks like this strategy will produce about 1 GB every 3 months or so. Sounds reasonable.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25369232

http://stackoverflow.com/q/25377102
has title: A Boolean'ian Quandary
has comment: http://stackoverflow.com/comment/39576054
upvote count: 2
has comment: http://stackoverflow.com/comment/39574900
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39574460
has comment: http://stackoverflow.com/comment/39574436
score: 2
tagged with: boolean
answer count: 2
has comment: http://stackoverflow.com/comment/39574417
tagged with: java
has comment: http://stackoverflow.com/comment/39574305
downvote count: 0
has body: Consider the following Java method: public Boolean compare(String val1, String val2) { return val1.length() &gt; 0 &amp;&amp; val1.equals(val2); } If it isn't obvious, this method first checks if val1 length is greater than 0 (ie. do we have something to compare) and then applies an .equal() method. Of course, the quandary comes about because if val1.length() isn't greater than zero, the method will return a false. Bad because it becomes unknown where the false came from; the val1.length() method or the equals() method. A rewrite should fix the problem: public Boolean compare(String val1, String val2) { if (val1.length() &gt; 0) { return val1.equals(val2); } return // Oh dear.... stuck again ! } The obvious problem here is that Java methods require that a method return the return type specified. In this case I could return true or false (actually, because I've specified Boolean instead of boolean [capital B vs lower B] I can also return a null). So what to return here? Well it turns out that true or false won't work either, because again if val1.length() is false, whatever my return value is will be what's returned, leading again to a possible false positive or false negative. Although I can set a null here, my calling code will generate a NullPointerException -- so no null. What I need is not a Boolean, but a TRILEAN! So, I devised this: // Trilean.java public enum Trilean { FALSE, TRUE, IGNORE } And re-wrote my method like so: public Trilean compare(String val1, String val2) { if (val1.length() &gt; 0) { return (val1.equals(val2)) ? Trilean.TRUE : Trilean.FALSE; } return Trilean.IGNORE; } And this works: if (compare(val1, val2) == Trilean.TRUE) { // do stuff } This logic (btw) becomes valid when for example I want to perform regex on a string, say a string that my regex rules demand begin with a Letter or Number, but I only want to run that regex if my string actually isn't empty. Take for example a servlet, were I may have an html input field that is not required…
has answer: http://stackoverflow.com/a/25377361
has answer: http://stackoverflow.com/a/25377372
favorite count: 0
type: Question

http://stackoverflow.com/a/25307859
type: Answer
score: 0
has body: You should interrupt it from the main thread using Thread.interrupt(). In the worker thread, on each loop iteration, it should check for the return of workerThread.interrupted() and if it is true then clean up and return. Check the documentation, cause blocking methods like wait() will throw an InterruptedException you might have to evaluate.
answers question: http://stackoverflow.com/q/25307749

http://stackoverflow.com/comment/39519357
type: AnswerComment
has text: That problem is solved but I can't see any users now !
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25340103

http://stackoverflow.com/comment/39523619
score: 0
has text: we cant access non static variables and methods from a static method. and main is static. So, how we use all the other methods, classes and variables ?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25350113

http://stackoverflow.com/comment/39579675
comment on: http://stackoverflow.com/q/25365532
has text: @MarkRotteveel I used the Java 1.6 version of the JAR first, but with the 1.7 jar the same error occurs. Also the server.log does not show more details - I guess I have to use a debug log level (but the deployment error message should be clearer imho)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25325442
linked to: http://stackoverflow.com/q/5999100
has comment: http://stackoverflow.com/comment/39479449
tagged with: sleep
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25326056
has answer: http://stackoverflow.com/a/50757591
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39492552
has comment: http://stackoverflow.com/comment/39478859
has comment: http://stackoverflow.com/comment/39480874
has answer: http://stackoverflow.com/a/25325605
has answer: http://stackoverflow.com/a/25325649
has comment: http://stackoverflow.com/comment/39478712
has answer: http://stackoverflow.com/a/74734585
has comment: http://stackoverflow.com/comment/39479070
has comment: http://stackoverflow.com/comment/39478830
has comment: http://stackoverflow.com/comment/39479050
linked to: http://stackoverflow.com/q/14464544
has answer: http://stackoverflow.com/a/62884963
score: 38
has body: How to wait x seconds or until a condition becomes true? The condition should be tested periodically while waiting. Currently I'm using this code, but there should be a short function. for (int i = 10; i &gt; 0 &amp;&amp; !condition(); i--) { Thread.sleep(1000); }
has comment: http://stackoverflow.com/comment/39478828
tagged with: conditional-statements
upvote count: 38
has title: Wait x seconds or until a condition becomes true
has comment: http://stackoverflow.com/comment/39479093
tagged with: java
has answer: http://stackoverflow.com/a/25325830
answer count: 7
has comment: http://stackoverflow.com/comment/39478790

http://stackoverflow.com/a/25353718
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42064599
accepted answer of: http://stackoverflow.com/q/25353602
score: 3
has body: This solution works: start the application in run mode (instead of debug mode) with the remote debug option: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 Start remote debug from intellij. But perhaps there's a better solution?
answers question: http://stackoverflow.com/q/25353602
type: Answer
has comment: http://stackoverflow.com/comment/42402760

http://stackoverflow.com/comment/39567724
has text: Also whats your safari driver initialization code look like?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25373346

http://stackoverflow.com/comment/39362904
has text: That class isn't on the code you showed. Please show us the rest of the code.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25262994

http://stackoverflow.com/q/25287445
accepted answer: http://stackoverflow.com/a/25287561
has answer: http://stackoverflow.com/a/25287562
has answer: http://stackoverflow.com/a/25287561
has body: So I tried finding a tutorial on how to do this but nothing gets this complicated. This is the first I am learning of HAshMaps so I am sure my solution should be easy, but I don't know how to do it. I am trying to use an Array to populate a HashMap, and when I run the program my print out shows up null, which indicates that it isn't populating for me. Been working on this for two days, and am really lost and confused. I am trying to get my key "expenses" to be valued with a "type". Edit: I would like my case two to be a printout of 1: groceries 2: Entertainment 3: Etc..... public static void main(String[] args) throws FileNotFoundException, IOException { // TODO code application logic here // HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); HashMap&lt;String, List&lt;Expenses&gt;&gt; map = new HashMap&lt;&gt;(); List &lt;Expenses&gt; expenseType = new ArrayList(); double amount, totalAmount; int cmd, year, month, date; String type, resp; totalAmount = 0; String fname = JOptionPane.showInputDialog("Enter the name of the budget file, none if no file"); if (fname.compareTo("none") !=0) { FileInputStream ist = new FileInputStream(fname); ObjectInputStream ifile = new ObjectInputStream(ist); } boolean done = false; while(!done) { resp = JOptionPane.showInputDialog("Enter a command from: \n" + "\t1:Add a new deduction\n" //think its done + "\t2:Add a new expense\n" //this is done, but could be made better wit + "\t3:Add a deposit\n" //This is done + "\t4:Deduction options\n" + "\t5:Expense Options\n" + "\t6:Total balances in bank\n" + "\t7:quit"); cmd = Integer.parseInt(resp); switch(cmd) { case 1: break; case 2: //Give the option to add new spending occurence. //Give option to choose from array of spending types. resp = JOptionPane.showInputDialog("Enter a command from: \n" + "\t1: Create a new expense\n" //done + "\t2: Choose from expense list\n" + "\t3:quit"); int cmd2 = Integer.parseInt(resp); switch (cmd2) { case 1: type = JOptionPane.showInpu…
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25287562
answer count: 2
has comment: http://stackoverflow.com/comment/39407960
has title: Populating a HashMap with an Array
tagged with: java
has comment: http://stackoverflow.com/comment/39407941
tagged with: arrays
has comment: http://stackoverflow.com/comment/39410785
type: Question
tagged with: hashmap

http://stackoverflow.com/a/25268473
has body: In the main you show the JFrame: new JavaGame().setVisible(true); and then you return from main. In the background there is a thread running, called EDT, event dispatching thread. On that thread button clicks, repainting and so on are handled. That should be done in a short period, to keep the user interface responsive, not freezed. So you need to work event driven: you can often add a listener for some specific event, like closing the JFrame, menu items, buttons. Those listeners are called with an event object specifying what happened. You called addActionListener. The control flow is to keep the button click responsive, and doing hard work a bit later: @Override public void actionPerformed(ActionEvent evt) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JavaGame.this.createANewAvatar(); } }); } And then somewhere have a private void createNeewAvatar() { ... } This hard to follow control-flow (because fragmentary) needs a good naming, and organized sources.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25268040
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39374148
answers question: http://stackoverflow.com/q/25268040
has comment: http://stackoverflow.com/comment/39374332

http://stackoverflow.com/q/25342026
type: AnsweredQuestion
score: 0
tagged with: natural-logarithm
tagged with: math
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39509967
favorite count: 0
type: Question
has body: I know I could generate it using Math.log(2) but I when I try to make up my own program to generate a natural log of 2 it continuously print 1. This is my code: import java.math.BigDecimal; import java.util.Scanner; public class Ques11 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); BigDecimal sum = new BigDecimal(1); for(int i = 2; i &lt;= n; i++) { sum.add(new BigDecimal(1/n)); } System.out.print(sum.setScale(10).toPlainString()); } } I have tried to use float, double and int and in the end used BigDecimal but I still got 1 as the result I don't know why. P.S It actually throws InputMismatchException when big numbers are given i.e greater than 2000000000 or 2 Billion.
has comment: http://stackoverflow.com/comment/39509993
accepted answer: http://stackoverflow.com/a/25342064
upvote count: 1
has answer: http://stackoverflow.com/a/25342064
downvote count: 1
has comment: http://stackoverflow.com/comment/39510037
has title: Generate Natural Logarithm of 2 Customly

http://stackoverflow.com/a/25329322
has comment: http://stackoverflow.com/comment/39486539
type: AcceptedAnswer
upvote count: 94
has comment: http://stackoverflow.com/comment/39486531
has comment: http://stackoverflow.com/comment/39486927
downvote count: 0
has comment: http://stackoverflow.com/comment/39487601
answers question: http://stackoverflow.com/q/25329275
has comment: http://stackoverflow.com/comment/39487969
has comment: http://stackoverflow.com/comment/39486615
score: 94
has comment: http://stackoverflow.com/comment/39487389
has body: You can get the activity that contains the fragment with getActivity(). Therefore getActivity().getApplicationContext() would work. getActivity().findViewById(int) would also work. Make sure, though, you don't use getActivity() prior to onActivityCreated(), since it would return null prior to that.
type: Answer
has comment: http://stackoverflow.com/comment/39487046
has comment: http://stackoverflow.com/comment/39486682
has comment: http://stackoverflow.com/comment/89227987
has comment: http://stackoverflow.com/comment/39490843
has comment: http://stackoverflow.com/comment/39487889
accepted answer of: http://stackoverflow.com/q/25329275

http://stackoverflow.com/q/25249000
tagged with: java
answer count: 1
tagged with: selenium
tagged with: ui-automation
has comment: http://stackoverflow.com/comment/39339802
type: Question
has body: Currently using selenium in java and trying to locate an element and click. It gives the error saying that the element is unclickable at point (x,y), Other element would receive click: However is the element I wanted it to click... Any help is appreciated.
has title: Selenium other element would receive click but is the correct
linked to: http://stackoverflow.com/q/44912203
type: UnansweredQuestion
tagged with: google-chrome
duplicate of: http://stackoverflow.com/q/44912203
has answer: http://stackoverflow.com/a/25249766
tagged with: selenium-webdriver
score: 0

http://stackoverflow.com/q/25335813
has answer: http://stackoverflow.com/a/25376115
has comment: http://stackoverflow.com/comment/39499286
has comment: http://stackoverflow.com/comment/39504340
score: 8
has comment: http://stackoverflow.com/comment/39499625
answer count: 3
has comment: http://stackoverflow.com/comment/39499642
tagged with: sql
has comment: http://stackoverflow.com/comment/39504182
tagged with: java
has comment: http://stackoverflow.com/comment/39502826
has comment: http://stackoverflow.com/comment/39501384
has answer: http://stackoverflow.com/a/25335951
has comment: http://stackoverflow.com/comment/39499457
downvote count: 1
favorite count: 0
has title: Fetching rows at extremely high speed
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/39499558
has comment: http://stackoverflow.com/comment/39634518
has answer: http://stackoverflow.com/a/25336788
has body: I have very large table (hundreds of millions rows, contains numbers and strings) in Oracle and I need to read all content of this table, format it and write to file or any other resource. Generally my solution looks like this: package my.odp; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeUnit; import java.lang.Throwable; import java.sql.*; public class Main { public static volatile boolean finished = false; public static void main(final String[] args) throws InterruptedException { final ArrayBlockingQueue&lt;String&gt; queue = new ArrayBlockingQueue&lt;String&gt;(10000); final Thread writeWorker = new Thread("ODP Writer") { public void run() { try { File targetFile = new File(args[0]); FileWriter fileWriter = new FileWriter(targetFile); BufferedWriter writer = new BufferedWriter(fileWriter); String str; try { while (!finished) { str = queue.poll(200, TimeUnit.MILLISECONDS); if (str == null) { Thread.sleep(50); continue; } writer.write(str); writer.write('\n'); } } catch (InterruptedException e) { writer.close(); return; } } catch (Throwable e) { e.printStackTrace(); return; } } }; final Thread readerThread = new Thread("ODP Reader") { public void run() { try { Class.forName("oracle.jdbc.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@//xxx.xxx.xxx.xxx:1521/orcl", "user", "pass"); Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(500000); ResultSet rs = stmt.executeQuery("select * from src_schema.big_table_view"); System.out.println("Fetching result"); while (rs.next()) { StringBuilder sb = new StringBuilder(); sb.append(rs.getString(1)).append('\t');//OWNER sb.append(rs.getString(2)).append('\t');//OBJECT_NAME sb.append(rs.getString(3)).append('\t');//SUBOBJECT_NAME sb.append(rs.getLong(4)).append('\t');//OBJECT_ID sb.append(rs.getLong(5)).append('\t');//DATA…
has comment: http://stackoverflow.com/comment/39499398
has comment: http://stackoverflow.com/comment/39502984
has comment: http://stackoverflow.com/comment/39499037
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39504063
tagged with: jdbc

http://stackoverflow.com/comment/39416229
type: Comment
type: AnswerComment
score: 0
has text: @RandRandom `How exactly could this be written in Java then ?` implies OP wants to know how to define methods that accept lambda expressions in Java.
comment on: http://stackoverflow.com/a/25291796

http://stackoverflow.com/q/25368888
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25370966
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25370966
tagged with: libgdx
tagged with: scale
has title: Rotate sprite on sprite pixel level, not screen pixel level, in LibGDX
tagged with: java
type: Question
tagged with: rotation
tagged with: pixel
upvote count: 3
has body: I'm making a pixelated game, and I'm trying to rotate a sprite. However, I'm not achieving the sort of rotating effect I'm aiming for. Currently, my sprite looks like this when it rotates: As you can see, it rotates relatively smoothly. You can see that the 'big pixels' rotate smoothly. However, this isn't the rotating effect I'm looking for. Instead, this is how I want it to rotate: However, preferably in a way that doesn't distort the pixels as much. You can see the difference. I want the actual 'big pixels' to rotate, not the 'screen pixels'. I think the issue might lie in how I scale the pixels to become bigger. What I'm doing, is that I'm zooming the camera in, moving it closer sorta. What I instead want to do, is to render like normal, then just scale up the screen pixels. That way I'd automatically achieve the rotation effect I want. I don't know how to do that, though. This is how I currently 'scale up the pixels': camera = new OrthographicCamera(); camera.setToOrtho(false, 1280 / 4, 720 / 4); The game's resolution is 1280x720, so the way I make the pixels bigger is that I just zoom in 4x times. However, what I instead want to do, is to render like normal, then just stretch the screen 4x times. Any help on how I could do this would be greatly appreciated.
answer count: 1

http://stackoverflow.com/comment/39460088
type: QuestionComment
has text: Alright, I commented the code.
comment on: http://stackoverflow.com/q/25315197
score: 0
type: Comment

http://stackoverflow.com/a/25239808
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25239279
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25239279
has body: ViewerSupport just provides simplified methods based on the various data binding content and label providers. It is perfectly acceptable to use these content and label providers directly when ViewerSupport does not provide what you want. For example, ViewerSupport.bind(StructuredViewer viewer, IObservableList input, IValueProperty[] labelProperties) is just: ObservableListContentProvider contentProvider = new ObservableListContentProvider(); if (viewer.getInput() != null) viewer.setInput(null); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new ObservableMapLabelProvider(Properties .observeEach(contentProvider.getKnownElements(), labelProperties))); if (input != null) viewer.setInput(input); So you could just use this code but with a sub-class of ObservableMapLabelProvider with your font and color providers.

http://stackoverflow.com/q/25371014
tagged with: java
has answer: http://stackoverflow.com/a/25371146
has comment: http://stackoverflow.com/comment/39562871
answer count: 4
has answer: http://stackoverflow.com/a/25371067
favorite count: 0
type: Question
tagged with: static
upvote count: 5
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/25371072
type: UnansweredQuestion
has body: According to the very last note here: "If a primitive type or a string is defined as a constant and the value is known at compile time, the compiler replaces the constant name everywhere in the code with its value. This is called a compile-time constant. If the value of the constant in the outside world changes (for example, if it is legislated that pi actually should be 3.975), you will need to recompile any classes that use this constant to get the current value." Suppose i defined a public constant PI (public static final double PI=3.14) in class A, and used this constant PI from within class B. So - by the above spec, if I change the value of PI from 3.14 to, say 3.0 in class A, i have to re-compile class B to get the effect of that change in class B. the Q here is-- what exactly is the definition of "constant" in the above spec? is it the final keyword? does any static field member "qualify" as a constant in this context? the non-static field members would be out of context here-- their values are assigned at run-time(?) TIA. //=========================== EDIT: The Q here is: what makes the compiler decide to bind the value at compile time. does the static keyword do this job all by itself. or is there anything else into it. //======================= in reference to a quick answer below that keeps getting voted up: the line on the same page: "The static modifier, in combination with the final modifier, is also used to define constants. The final modifier indicates that the value of this field cannot change." 1.) "... is also used to define constants. ...": what else defines a constant. 2.) "... in combination with the final modifier": is final necessary to make the value bound in compile-time-- which i doubt it is.
has title: Compile-time value-binding of Java constants
has answer: http://stackoverflow.com/a/25371065
tagged with: constants
has comment: http://stackoverflow.com/comment/39563113

http://stackoverflow.com/q/25387105
has comment: http://stackoverflow.com/comment/39600055
score: 4
has comment: http://stackoverflow.com/comment/39617952
tagged with: grails
has comment: http://stackoverflow.com/comment/39599502
upvote count: 4
has comment: http://stackoverflow.com/comment/39595299
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39600387
tagged with: vaadin
tagged with: java
answer count: 1
downvote count: 0
tagged with: mysql
has body: I am new to vaadin, couple of days back i have downloaded vaadin dashboard demo application. http://demo.vaadin.com/dashboard/ vaadin quickticket demo application And i found it amazing and become a fan of vaadin. I am swing developer and about to start new project using vaadin. I am confused about database communication to vaadin. I am using MySql database. As i did not stared writing code, can some one guide me which approach would be best. Use vaadin with grails fast in development use spring and hibernate. Do it impact any performance as there is number of layer? I have no idea about grails, if it best with vaadin then i will learn it. Directly use TableQuery and SQLContanier. Use Hibernate independently to fetch the data from database. Use JSON and make api call to another webservices to get the data . as the vaadin quickticket demo application is doing. Which approch should i use or can anyone guide me which could be the best practices with vaadin with MySql database. Should i used grails with vaadin i am developing dashboard application for tracking inventory. Will it cause any major issue with performance or speed.
favorite count: 0
accepted answer: http://stackoverflow.com/a/25433829
type: Question
has title: Vaadin With Grails
has answer: http://stackoverflow.com/a/25433829
has comment: http://stackoverflow.com/comment/39596001
has comment: http://stackoverflow.com/comment/41779084
has comment: http://stackoverflow.com/comment/39596423

message-queue
type: Tag
tags question: http://stackoverflow.com/q/25260223
tag name: message-queue

http://stackoverflow.com/q/25260763
has title: Using the same session for multiple applications
type: Question
has answer: http://stackoverflow.com/a/25261118
answer count: 2
linked to: http://stackoverflow.com/q/661978
tagged with: session
has body: I have developed a struts2 application with login feature. My java code for this is Map session = ActionContext.getContext().getSession(); session.put("login", "true"); session.put("user", username); and I will check if the user already logged in jsp as &lt;s:if test="#session.login != 'true'"&gt; Now I want to develop another application. As the users will be same I do not want to ask them to login again. I want to access the session of application1 in application2. How to do this. Please help.
linked to: http://stackoverflow.com/q/1638508
tagged with: struts2
possible better answer: http://stackoverflow.com/a/25261126
has answer: http://stackoverflow.com/a/25261126
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25261118

http://stackoverflow.com/comment/39324165
comment on: http://stackoverflow.com/a/25242035
score: 0
type: Comment
has text: i inintialed the stream reader to null and getting this exception.java.net.ConnectException: Connection timed out: connect java.lang.NullPointerException
type: AnswerComment

http://stackoverflow.com/q/25314298
answer count: 3
downvote count: 0
upvote count: 1
tagged with: spring
favorite count: 0
type: AnsweredQuestion
tagged with: spring-boot
has title: css file can't be loaded with spring boot
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25315866
accepted answer: http://stackoverflow.com/a/25327528
has body: following is my file dir tree, and html files is in src/main/webapp/templates, have added src/main/webapp into classpath. src──main ├─java │ └─com │ └─ma2oo │ └─quizbox │ ├─application │ ├─config │ └─controllers ├─resources └─webapp ├─static │ ├─css │ └─js └─templates The web config file is: @Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { System.out.println("reached here "); registry.addResourceHandler("/resources/**").addResourceLocations("/static/"); } @Override public void addInterceptors(InterceptorRegistry registry) { LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("lang"); registry.addInterceptor(localeChangeInterceptor); } } And the ref link in html is: &lt;link href="/static/css/components.css" rel="stylesheet"&gt;&lt;/link&gt; When web server is running, I can't get the expected result from browser, it's just same with there is no css existed. Could anyone help with it please? Thanks in advance.
tagged with: css
possible better answer: http://stackoverflow.com/a/39657255
has answer: http://stackoverflow.com/a/25327528
type: Question
has answer: http://stackoverflow.com/a/39657255

http://stackoverflow.com/comment/39400061
has text: How can we do both @Test(expected=Exception.class) and catch and interrogate the exception ourself at the same time? I think we should not try to add logic to our tests, adding both seems like step in that direction.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25283180
type: Comment

http://stackoverflow.com/q/25239348
has comment: http://stackoverflow.com/comment/39319197
downvote count: 0
upvote count: 1
score: 1
has body: I am using HTML5 server-sent events and I would like to send random messages to the client from the server. Below is some portion of MessageServlet.java : PrintWriter writer = response.getWriter(); Random rnd1 = new Random(); Random rnd2 = new Random(); for(int i = 0; i &lt; 5; i++) { //each message that we end must end with \n\n writer.flush(); System.out.println("This is i : " + i); if(i == 4) { writer.write("event: close \n"); } if(rnd1.nextInt(100) &lt; 30) writer.write("data: "+"{\"Messages\": [{\"Msg\":\"Success1\"}]}"+"\n\n"); else writer.write("data: "+"{\"Messages\": [{\"Msg\":\"Success2\"}]}"+"\n\n"); try { Thread.sleep(rnd2.nextInt(3000)); } catch (InterruptedException e) { e.printStackTrace(); } } writer.close(); It is supposed to stop once the loop reaches 4 however, it is continuously re-sending again the messages. To prove this I printed the counter, i, so as to see if this is true and in fact it prints like this : THis is i : 0 THis is i : 1 THis is i : 2 THis is i : 3 THis is i : 4 THis is i : 0 THis is i : 1 THis is i : 2 THis is i : 3 THis is i : 4 THis is i : 0 THis is i : 1 THis is i : 2 THis is i : 3 THis is i : 4 Does someone know what I'm doing wrong please? I'm really stuck. Thank you very much.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25242592
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: javascript
has comment: http://stackoverflow.com/comment/39319035
has answer: http://stackoverflow.com/a/25240400
tagged with: servlets
has comment: http://stackoverflow.com/comment/39319095
answer count: 2
has comment: http://stackoverflow.com/comment/39319051
has title: Java Servlet keep on sending messages
tagged with: java

http://stackoverflow.com/q/25387419
favorite count: 0
has answer: http://stackoverflow.com/a/25390332
score: 1
tagged with: java
tagged with: ebean
type: Question
tagged with: playframework-2.0
answer count: 2
downvote count: 0
has title: Exception mapping @ManyToOne relationship in Play Framework 2.3.3 using Ebean
upvote count: 1
type: UnansweredQuestion
has body: I'm having trouble mapping a relationship because to models in Play Framework 2.3.3. I have two models GaDataModel and BusinessAccounts with a relationship ManyToOne, in model GaDataModel I'm declaring the relationship inside a class GaDataModelPK that basically is an @Embedabble PK. The following classes are my current implementation. GaDataModelPK @Embeddable public class GaDataModelPK implements Serializable { @ManyToOne @JoinColumn(nullable = false) public BusinessAccount businessAccount; @Column(nullable = false) public String date; @Override public boolean equals(Object o) { ... } @Override public int hashCode() { ... } } GaDataModel @Entity @Table(name = "ga_data_model") public class GaDataModel extends Model { @EmbeddedId public GaDataModelPK gaDataModelPK; ... } } BusinessAccounts @Entity @Table(name = "business_account") public class BusinessAccount extends Model { @EmbeddedId public BusinessAccountPK businessAccountPK; public String portal; public String region; public String category; public String hqCountry; public String portalCountry; @OneToMany(mappedBy = "business_account", cascade = {CascadeType.REMOVE}) public List&lt;GaDataModel&gt; gaDataModels; ... } But when I try to run the application, I have the following exception Stack Trace in PLAY WEBBROWSER java.lang.RuntimeException: Error reading annotations for repository.models.GaDataModelPK com.avaje.ebeaninternal.server.deploy.parse.ReadAnnotations.readAssociations(ReadAnnotations.java:54) com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1028) com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.createEmbedded(BeanDescriptorManager.java:455) com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readEmbeddedDeployment(BeanDescriptorManager.java:478) com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:232) com.avaje.ebeaninternal.server.core.InternalConfiguration.&lt;init&gt;(Internal…
tagged with: jpa
tagged with: orm
has answer: http://stackoverflow.com/a/27321521

http://stackoverflow.com/comment/39341692
type: AnswerComment
comment on: http://stackoverflow.com/a/25251117
has text: @StealthyHunter7 I did, and you are correct - I stand corrected
score: 1
type: Comment

http://stackoverflow.com/comment/39394969
type: QuestionComment
score: 0
has text: Yes, native code is required for it. I was wondering if this can be done in swt itself without any native code. Thanks.
comment on: http://stackoverflow.com/q/25258243
type: Comment

http://stackoverflow.com/comment/39483126
has text: There are a variety of ways; I would probably do it by checking the time every minute or so and seeing if it's past the right time. I'll append something to my answer in a second
type: AnswerComment
comment on: http://stackoverflow.com/a/25327465
type: Comment
score: 0

http://stackoverflow.com/comment/39359071
comment on: http://stackoverflow.com/q/25240548
score: 0
type: Comment
has text: @pskink and this is download link for project https://android.googlesource.com/platform/development/+archive/master/samples/SoftKeyboard.tar.gz
type: QuestionComment

http://stackoverflow.com/a/25307807
answers question: http://stackoverflow.com/q/25307743
has comment: http://stackoverflow.com/comment/39474009
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25307743
has comment: http://stackoverflow.com/comment/39474823
has comment: http://stackoverflow.com/comment/39474551
type: Answer
has body: Use any JSON parsing library such as GSON or Jackson and convert it into Java Object. Sample code using GSON library Type type = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() {}.getType(); Map&lt;String, Object&gt; data = new Gson().fromJson(jsonString, type); System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(data)); // get the desired value from map Map&lt;String,ArrayList&lt;Map&lt;String,String&gt;&gt;&gt; mMap=(Map&lt;String,ArrayList&lt;Map&lt;String,String&gt;&gt;&gt;)data.get("M"); ArrayList&lt;Map&lt;String,String&gt;&gt; rowArray=mMap.get("row"); for(Map&lt;String,String&gt; colMap:rowArray){ for(String value:colMap.values()){ System.out.println(value); } } You can convert JSON string into Java POJO class as well that is replica of the JSON string class MDetails { private MDetail M; // getter &amp; setter } class MDetail { private ArrayList&lt;Map&lt;String, String&gt;&gt; row; // getter &amp; setter } ... MDetails data = new Gson().fromJson(jsonString, MDetails.class); for (Map&lt;String, String&gt; colMap : data.getM().getRow()) { for (String value : colMap.values()) { System.out.println(value); } } You can use different field name using @SerializedName annotation. class MDetails { @SerializedName("M") private MDetail mDetail; // getter &amp; setter } As per comments, the keys are dynamic so iterate the map containing another map in it and print all the values whose key starts with col sample code: (call below method that recursively iterate all keys and values) public static void printColValues(Object data) { if (data instanceof Map) { for (Map.Entry&lt;String, Object&gt; entry : ((Map&lt;String, Object&gt;) data).entrySet()) { String key = entry.getKey(); if (key.startsWith("col")) { System.out.println(entry.getValue()); } else { printColValues(entry.getValue()); } } } else if (data instanceof List) { for (Object obj : (List) data) { printColValues(obj); } } } output: c00 c10 c11 c20 c21 c22 OR if nothing works then try with re…
has comment: http://stackoverflow.com/comment/39454864
has comment: http://stackoverflow.com/comment/39474644
has comment: http://stackoverflow.com/comment/39474877
has comment: http://stackoverflow.com/comment/39474634
score: 0
has comment: http://stackoverflow.com/comment/39447768
has comment: http://stackoverflow.com/comment/39448927

gzipinputstream
type: Tag
tags question: http://stackoverflow.com/q/25310193
tag name: gzipinputstream

http://stackoverflow.com/comment/39499863
type: Comment
has text: Does this take into consideration having multiple words that could match and does it compare to the total number of words instead of the number of characters to find percent? It appears that way to me, but I am not the best at programming, so I could be wrong. It appears the token method might be the easiest from what I have seen.
type: AnswerComment
comment on: http://stackoverflow.com/a/25330157
score: 0

http://stackoverflow.com/q/25284516
has answer: http://stackoverflow.com/a/25286693
has comment: http://stackoverflow.com/comment/39402368
has answer: http://stackoverflow.com/a/25284584
has comment: http://stackoverflow.com/comment/39402372
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25284669
accepted answer: http://stackoverflow.com/a/25284669
answer count: 3
has comment: http://stackoverflow.com/comment/39402399
tagged with: java
has comment: http://stackoverflow.com/comment/39402430
has comment: http://stackoverflow.com/comment/39402324
possible better answer: http://stackoverflow.com/a/25286693
linked to: http://stackoverflow.com/q/9791024
type: Question
has body: Hi I am trying to create a method that finds the mode of an array. To do this I first need to create a method that sorts the list from least to greatest but I am not sure what I am doing wrong in the first place public class Mode { public int [] sort(int[] asd) { int[] sorted = new int[10]; for (int i = 0; i &lt; asd.length; i++) { for (int j = 1; j &lt; asd.length; j++) { if ( (asd[i] &gt; asd[j]) &amp;&amp; (i != j) ) { int temp = asd[j]; asd[j] = asd[i]; asd[i] = asd[temp]; } else continue; } } return sorted; } public static void main(String[] args) { Mode list1 = new Mode(); int[] array = {3,2,5,4,1,1,1,1,10,9}; int[] potato = list1.sort(array); for (int i = 0; i &lt; potato.length; i++) System.out.print(potato[i]); } } When I run this, I get 0000000000 as an output. I think there is something wrong in the method since I am returning an array that has been initialized but nothing has been put in there. How do I (in my nested for loop) add each number in the sorted array?
has title: Method to sort an array from least to greatest Java
has comment: http://stackoverflow.com/comment/39402436
tagged with: sorting

http://stackoverflow.com/a/25355506
accepted answer of: http://stackoverflow.com/q/25331628
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25331628
has body: If your browsing the sources on google code your looking at a rather old build, the official repository is now on GitHub. The current version on github has done away with setOrdered As you say the methods are identical so they were either distinctly named for readability or ended up identical due to some refactoring work.

http://stackoverflow.com/comment/39421663
has text: @pskink The problem is that i can't color more than one line of text in different colors
score: 0
comment on: http://stackoverflow.com/q/25294540
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25292753
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/25291924
type: Answer
accepted answer of: http://stackoverflow.com/q/25291924
has comment: http://stackoverflow.com/comment/39420084
has body: Using the graphics class correctly is very tricky, especially if you're new to java. It's likely that the error your getting is a null pointer, because your g2d arg is probably null. One (preferred) way to draw text in java is to subclass the JPanel class and override the paint(Graphics) method so whenever the panel is drawn, it's drawn with text. Here's an example: public class Test1 extends JFrame { public Test1(){ TextPanel t = new TextPanel("Here's some text!"); getContentPane().add(t, BorderLayout.CENTER); setMinimumSize(new Dimension(500, 500)); //Various JFrame initialization stuff. //repaint() makes sure the text is immediately visible. repaint(); pack(); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } class TextPanel extends JPanel{ private String text; public TextPanel(String t){ text = t; } //Called by swing whenever this or a parent component calls repaint() @Override public void paint(Graphics g){ g.setFont(new Font("Helvetica", Font.PLAIN, 13)); g.drawString(text, 20, 30); } } public static void main(String[] args){ new Test1(); } } If you want to use the text for overlays then just make sure the background of the TextPanel is transparent and place it wherever you want to on the window.

http://stackoverflow.com/comment/39381719
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25270605
has text: Tell me please how i can pass null in form if i have a button type "submit" which working without any javascript?

http://stackoverflow.com/comment/39572674
comment on: http://stackoverflow.com/a/25376039
type: Comment
type: AnswerComment
has text: @StephenC thanks! I guess that it explains why this env variable is not set by default when Java is installed on Windows ?
score: 0

http://stackoverflow.com/a/25321920
has body: They are both fast enough. The properties resource bundles are a little bit slower because the file has to be parsed, but this overhead is egligible, and the result is cached in memory. The choice is not made based on performance. It's based on features. A ListResourceBundle is more flexible. It allows using Java to do whatever you need to create your keys and values. A properties resource bundle is easier to read, edit and maintain. Even a non-programmer translator can easily edit such a file. Regarding your question about the default package, it's of course possible to put your class, and the resource bundle, in any package you want. If the class StatsBundle_ja_JP is in the package com.foo.bar, then you must load it using ResourceBundle stats = ResourceBundle.getBundle("com.foo.bar.StatsBundle", japanLocale); The same rule applies to prperty resourcebundles: if the MessageBundle properties files are in the package com.foo.bar, it should be loaded using ResourceBundle stats = ResourceBundle.getBundle("com.foo.bar.MessageBundle", someLocale); The documentation explains it: Note:The baseName argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to access PropertyResourceBundles by specifying a path name (using "/") instead of a fully qualified class name (using ".").
downvote count: 0
answers question: http://stackoverflow.com/q/25321065
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/25289482
downvote count: 1
favorite count: 0
score: 28
type: Question
answer count: 9
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31869659
has title: Installing jdk8 on ubuntu- "unable to locate package" update doesn't fix
has answer: http://stackoverflow.com/a/39296381
has comment: http://stackoverflow.com/comment/99243252
has comment: http://stackoverflow.com/comment/99243250
has answer: http://stackoverflow.com/a/56156948
has body: I've been trying to install the jdk on my ubuntu after downloading it. first I've used: sudo apt-get update then: sudo apt-get install jdk* (because I didn't want to write the whole long name). it didn't work- printed the message in the title. I thought the problem might me with the directory I'm executing from (I've executed it from the Downloads directory in which the file exists), so I've tried executing the same command (sudo apt-get install jdk*) from the home directory (root directory). Then it worked.. the whole installation took about 5 minutes and it looked like it was installing a lot of things I didn't ask for. I wasn't sure it installed what I needed to I went back to the Downloads directory where the jdk8 package was located and like the first time ran the command from there. the same message as before... couldn't locate the package. What have I done wrong ? Obviously it wasn't installed because when I've checked the version of java (java -version) it didn't show jdk8 was installed. Thank you if you've taken the time to read to this point :)
has answer: http://stackoverflow.com/a/57953352
upvote count: 29
has answer: http://stackoverflow.com/a/58475223
has answer: http://stackoverflow.com/a/25289528
has answer: http://stackoverflow.com/a/69254983
tagged with: java
has answer: http://stackoverflow.com/a/31980393
has answer: http://stackoverflow.com/a/34354526

http://stackoverflow.com/comment/39415070
type: AnswerComment
has text: Oh ok. Anyway, yes, it is a bug :P (otherwise the question would have not be raised here)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25291061

stored-procedures
tags question: http://stackoverflow.com/q/25334207
tag name: stored-procedures
type: Tag
tags question: http://stackoverflow.com/q/25280395

http://stackoverflow.com/a/25279831
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39424204
has body: Command pattern You should be rather implementing Observer pattern and your download library should allow other code to attach listeners and be notified about when certain action is completed/started/whatever. And since you are just being informed that something happened you can have your code that reacts on that notification completely different in every part of your app if you need so.
answers question: http://stackoverflow.com/q/25279568
type: Answer

http://stackoverflow.com/q/25354989
type: AnsweredQuestion
has title: Primefaces selectOneMenu with Selenium webdriver does not select the item + Java
score: 0
tagged with: primefaces
tagged with: java
has comment: http://stackoverflow.com/comment/39535524
has body: I need to set value on p:selectOneMenu during my selenium test but having problem to set the value. here is the code i used to do that: { driver.findElement(By.id("myForm:meSelection_label")).click(); driver.findElement(By.xpath("//div[@id='myForm:meSelection_panel']/div[2]/ul/li[text() = 'mytext']")).click(); } Problem is that it does not select my selection, i even tried to use index on li (e.g. /li[2]) it is second item. when i run the test it shows the dropdown list and i can see my elements in it but it just do not select the element. And yes, i do have converter on for this object. I also tried Selenium IDE and put my xpath in there exactly the same as above and it works perfectly fine, but in my test case in java it does not select the element at all. I searched the net and forums but could not find any solutions for it. It seams some people had problems with it but no answers were posted on these questions. here is my pom.xml with dependencies for testing: { org.seleniumhq.selenium.client-drivers selenium-java-client-driver 1.0.2 test org.seleniumhq.selenium selenium-java 2.40.0 org.seleniumhq.selenium selenium-firefox-driver 2.40.0 } Any help would be much appreciated.
type: Question
has answer: http://stackoverflow.com/a/25418079
answer count: 2
tagged with: testing
possible better answer: http://stackoverflow.com/a/25356230
tagged with: firefox
tagged with: selenium
has answer: http://stackoverflow.com/a/25356230
accepted answer: http://stackoverflow.com/a/25418079

http://stackoverflow.com/q/25384514
has title: @RolesAllowed doesn't work properly
tagged with: deltaspike
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25495250
tagged with: cdi
score: 2
downvote count: 0
tagged with: java
answer count: 1
has body: I have to restrict the access of a method only to the users who have a certain role. The IdentityManager is built correctly. I have this controller class. @Named @RequestScoped @LoggedIn public class UserController{ @RolesAllowed({"tt"}) public String saveUserChanges() { ... ... } } And this class handles the AccessDeniedException thrown by the method above saveUserChanges. @ExceptionHandler public class SecurityExceptionHandler { public void onAccessDeniedException(@BeforeHandles ExceptionEvent&lt;AccessDeniedException&gt; event) { ... ... } } The problem is that the AccessDeniedException is correctly thrown and catched by the SecurityExceptionHandler class, but the method saveUserChanges() is executed anyway. Is it right? I want the method saveUserChanges() is no longer executed if the user doesn't have the "tt" role.
tagged with: jboss7.x
favorite count: 0
type: Question
upvote count: 2
tagged with: picketlink

http://stackoverflow.com/q/25332951
has body: I've been having a bit of an issue with my assignment. After reading from an input.txt file, I've created an array in which all of the information has been stored in, but for some reason I seem to be unable to compare them individually. I've tried equals() and contains() I can't think of anything else that would work. what I'm trying to achieve. public static void readFromFile(String filePath) throws IOException{ BufferedReader inputFile = new BufferedReader(new FileReader(filePath)); String inputText = null; List&lt;String&gt; list = new ArrayList&lt;String&gt;(); String[] splited = null; //splitting the text file while((inputText = inputFile.readLine())!= null) { splited = inputText.split("[;^:]"); for (String part : splited) { list.add(part); } } String [] stockArr = list.toArray(new String[list.size()]); // verify contents of array for(int index = 0; index &lt; stockArr.length;index++) { System.out.println(stockArr[i]); } for (int i = 0; i &gt; stockArr.length; i++) { if(stockArr[i].equals("BusinessContact")) { System.out.println("test"); } } } Now if I were to print this, it does not print "test" but rather only BusinessContact firstName=Victor middleName=Garces lastName=Guana Address addressType=WORK streetName=Athabasca Hall streetNumber=2-32 apartmentNumber=4-52 city=Edmonton postalCode=T6G 2E8 country=Canada
tagged with: arrays
has answer: http://stackoverflow.com/a/25332979
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: compare
tagged with: windows
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25332976
upvote count: 0
tagged with: list
answer count: 2
has title: Comparing List<String> to String

http://stackoverflow.com/comment/39565511
score: 1
comment on: http://stackoverflow.com/a/25372271
has text: I'll accept abs() operator, which can be implemented using bit operators. max(a,b) = 1/2 (a+b+abs(a-b))
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39370339
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25266893
score: 0
has text: Show the `getAllScanAndLoc` function.

http://stackoverflow.com/a/25294940
has body: You can replace the reference (!) to a String as often as you like: String A = "Test"; A = A.toUpperCase(); //will make A upper case A = A.substring( 1 ); and so on. Excess usage of this may not be the best approach - it depends on the context. Since some people seem to think that this can't be done with a String passed through a method: String modify( String x ){ x = x.toLowerCasae(); x = x.substring( 1 ); return x; } and the call must, of course replace the original String reference. String tomod = "abc"; tomod = modify( tomod ); Three are, of course, classes better suited to this kind of String modification.
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39447483
score: 0
has comment: http://stackoverflow.com/comment/39432349
has comment: http://stackoverflow.com/comment/39422414
upvote count: 1
answers question: http://stackoverflow.com/q/25294836

http://stackoverflow.com/q/25232432
has answer: http://stackoverflow.com/a/29853292
has comment: http://stackoverflow.com/comment/39305512
has comment: http://stackoverflow.com/comment/39305535
linked to: http://stackoverflow.com/q/2721546
has comment: http://stackoverflow.com/comment/39305506
type: AnsweredQuestion
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39305571
tagged with: java
has comment: http://stackoverflow.com/comment/39305610
tagged with: generics
accepted answer: http://stackoverflow.com/a/25232468
type: Question
has answer: http://stackoverflow.com/a/25232468
has body: I am trying to convert and array ints to a List however every time I try I get a compilation error. List&lt;Integer&gt; integers = toList(draw.getToto6From49().getFirstRound()); // getFirstRound() returns int[] ; and here is my to toList method public class ArraysUtil { public static &lt;T&gt; List&lt;T&gt; toList(T[] ts) { List&lt;T&gt; ts1 = new ArrayList&lt;&gt;(); Collections.addAll(ts1, ts); return ts1; } } java: method toList in class com.totoplay.util.ArraysUtil cannot be applied to given types; required: T[] found: int[] reason: inferred type does not conform to declared bound(s) inferred: int bound(s): java.lang.Object
has title: Java autoboxing and unboxing
possible better answer: http://stackoverflow.com/a/25232479
has answer: http://stackoverflow.com/a/25232479

http://stackoverflow.com/comment/39490881
comment on: http://stackoverflow.com/q/25331323
has text: @BarneySmith: You are probably observing score while still within the loop. score is reinitialized to 0 at the beginning of every iteration of your outer loop.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39503289
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25337970
type: AnswerComment
has text: Sorry, no idea about hiding the fragment. Whenever I need to load data once and show them in fragments, I just made the data source static variable and show them with the above checking.....

http://stackoverflow.com/q/25295935
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39424382
tagged with: http://stackoverflow.com/tag/csv
score: 1
accepted answer: http://stackoverflow.com/a/25297112
has comment: http://stackoverflow.com/comment/39724464
tagged with: java
tagged with: regex
has body: Source String: 1,4,test,v,4t,10,20,more Need to use a regular expression to see if this string contains any one of those values. So the question is: Does the source string have 1 in it? Yes Does the source string have 10 in it? Yes Does the source string have v in it? Yes Does the source string have 01 in it? No Does the source string have va in it? No Does the source string have test,v in it? (invalid input, so don't have to worry about it) P.S. The core language is Java. Response to: "Any reason why you aren't using a dedicated regex parser?" Answer: Well, I am working in Java, so will be using the java.util.regex class. From what I know of regular expression, for the most part they are language neutral, so I don't fully understand what you are driving at, can you expound on it a bit? Response to: "Why do you need regex? You could use separate contains() calls in a loop, which would be easier to maintain and understand." Answer: It is my impression that a well written regular expression will execute faster and be easier to read, assuming it is commented correctly. Am I mistaken?
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25296062
upvote count: 2
has comment: http://stackoverflow.com/comment/39424313
has comment: http://stackoverflow.com/comment/39425171
has answer: http://stackoverflow.com/a/25297112
has comment: http://stackoverflow.com/comment/39724450
downvote count: 1
has title: regular expression to find value in csv string
possible better answer: http://stackoverflow.com/a/25296062

http://stackoverflow.com/q/25280040
tagged with: typesafe-config
has title: What is a good way to implement reloading of a Typesafe config
tagged with: scala
type: UnansweredQuestion
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25284180
favorite count: 0
type: Question
tagged with: concurrentmodification
tagged with: java
score: 10
has body: In a Scala application that is using Typesafe Config, I want to add the possibility to reload a Config at runtime. A Config instance is immutable. Here is what I have so far: package config trait Settings { private[config] var config: Config = ConfigFactory.empty() def engine: EngineSettings } trait EngineSettings { def weight: Int def offset: Int } class AppSettings { override def engine = new EngineSettings { override def weight = config.getInt("engine.weight") override def offset = config.getInt("engine.offset") } } object Settings { private val namedSettings = new TrieMap[String, AppSettings] def load(configName: String = "local"): Settings = { // load config // create or update AppSettings // add to map and return } } Initially a Settings instance is created using Settings.load. That instance reference is handed to other classes. Then a second thread can reload the underlying Config by calling Settings.load again. Here is how you access it: class Engine(settings: Settings) { def calculate() = { val weight = settings.engine.weight // do some stuff val offset = settings.engine.offset } } There are two problems: someone might reload the underlying Config while calculate() is at line: // do some stuff (consistency) don't like using a var in the Settings trait How can I improve this design :)
upvote count: 10

http://stackoverflow.com/q/25290458
type: Question
has title: Could not find artifact in maven local repository
type: UnansweredQuestion
has body: I installed external jars into maven local repositories via maven android sdk deployer successfully. Because these are not available into maven central repositories. Failed to execute goal on project mavendemo: Could not resolve dependencies for project com.mavendemo:mavendemo:apk:1.0: **The following artifacts could not be resolved: com.square:picasso:jar:1.0, com.analytics-androids-1.0.0:analytics-android.1.0.0:jar:1.0.0, com.gson:gson:jar:2.2.4, com.scribe:scribe:jar:1.0:** **Could not find artifact com.square:picasso:jar:1.0 in central (http://repo.maven.apache.org/maven2)** -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
tagged with: maven
score: 0
has answer: http://stackoverflow.com/a/25290997
tagged with: android
tagged with: java
answer count: 1

http://stackoverflow.com/a/25263505
answers question: http://stackoverflow.com/q/25263085
has comment: http://stackoverflow.com/comment/39364006
type: Answer
has body: Try This.... public static void main(String[] args) { int[] aaa=new int[]{10,2,4,5,7,8,3,34,4,4,545,5,3,4,4,5,5,5,10,3,4,45,6,2,7}; Map&lt;Integer, Integer&gt; all_counts=new LinkedHashMap&lt;Integer,Integer&gt;(); for (int key : aaa) { if(all_counts.containsKey(key)) { Integer count=all_counts.get(key); count++; all_counts.put(key, count); } else { all_counts.put(key, 1); } } for (Map.Entry&lt;Integer, Integer&gt; entry : all_counts.entrySet()) { System.out.println(entry.getKey() + "--&gt;" + entry.getValue()); } }
score: 0
has comment: http://stackoverflow.com/comment/39364212
has comment: http://stackoverflow.com/comment/39363718

http://stackoverflow.com/a/28313647
has comment: http://stackoverflow.com/comment/123394402
has comment: http://stackoverflow.com/comment/71273707
score: 15
has body: Actually, be careful - they are not exactly the same. If you define any interceptors within your application, they will not apply to Controllers annotated as @RestController, however they do work with @Controller annotated controllers. ie. configuration for the interceptor: @Configuration public class WebMvcConfiguration extends WebMvcConfigurerAdapter { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new TemplateMappingInterceptor()).addPathPatterns("/**", "/admin-functions**").excludePathPatterns("/login**"); } } and in the declaration of a Spring controller: @Controller public class AdminServiceController {... Will work, however @RestController public class AdminServiceController {... does not end up having the interceptor being associated with it.
has comment: http://stackoverflow.com/comment/87331507
answers question: http://stackoverflow.com/q/25242321
downvote count: 3
type: Answer
upvote count: 18
has comment: http://stackoverflow.com/comment/53615495

http://stackoverflow.com/comment/39362753
type: AnswerComment
has text: How will the value of num1 be affected?
comment on: http://stackoverflow.com/a/25262792
type: Comment
score: 0

http://stackoverflow.com/a/70914884
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25352764
has body: The below imports are required import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.Link; import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder; With a static import from WebMvcLinkBuilder for all methods

http://stackoverflow.com/q/25376141
tagged with: java
tagged with: io
has comment: http://stackoverflow.com/comment/39572999
score: 0
answer count: 1
tagged with: file
tagged with: case-sensitive
has title: How to make a File class input case sensitive for the file name?
has answer: http://stackoverflow.com/a/25376198
type: Question
has body: I have a working application here already which reads a text file using the File class after prompting the user for the file name input. However, I have to make it case-sensitive which means that say if the user inputs zombie.txt, then there will be an FileNotFoundException thrown although the actual file name is Zombie.txt. So my question is how do I correct my application to make it so? Additionally, as I'm still a newbie to programming etc, all suggestions or advices to shorten my code will be deeply appreciated. ;) Thanks in advance! import java.util.Scanner; import java.io.*; class FileReadingExercise { public static void main (String [] args) { Scanner userInput = new Scanner(System.in); Scanner fileInput = null; do { try { System.out.println("Please enter the name of a file or type QUIT to finish"); String a = userInput.nextLine(); if(a.equals("QUIT")) { System.exit(0); } fileInput = new Scanner(new File(a)); //inline expression } catch (FileNotFoundException e) { System.out.println("Error - File does not exist"); //read document as there is more } } while (fileInput == null); while(fileInput.hasNext()) { String first = fileInput.nextLine(); System.out.println(first); } fileInput.close(); } }
type: UnansweredQuestion

http://stackoverflow.com/q/25333387
possible better answer: http://stackoverflow.com/a/25334835
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/25334265
has body: For the past two weeks, I have been struggling to produce a solution to store my checkbox values next to each of my listview items when I exit and open the app. Essentially, I have a custom BaseAdapter class which populates the listview with installed applications on the users phone and a checkbox next to each installed app. When I scroll down the checkbox states stay;however, when I click back or exit and come back it doesn't stay. I used SharedPreferences in almost every way possible. My last way was using a for loop to create a SharedPreference for each one and restore the boolean in the for loop as well and to store a boolean true and false (for checked and unchecked respectively) in if and else statements. Here is my code for my BaseAdapter class using SharedPreferences: package com.ibc.android.demo.appslist.app; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.TextView; import com.spicycurryman.getdisciplined10.app.R; import java.util.List; // public class ApkAdapter extends BaseAdapter { //Pastebin link: http://pastebin.com/LGRicg4U , http://pastebin.com/c4WfmhMK , http://pastebin.com/gFuuM4dY, http://pastebin.com/4Q7EP9G4 // http://pastebin.com/Te2g072w, http://pastebin.com/NLT5iUiA , SharedPreferences sharedPrefs; List&lt;PackageInfo&gt; packageList; Activity context; PackageManager packageManager; boolean[] itemChecked; String PACKAGE_NAME; public ApkAdapter(Activity context, List&lt;PackageInfo&gt; packageList, PackageManager packageManager) { super(); this.context = context; this.packageList = packageList; this.packageManager = package…
score: -1
accepted answer: http://stackoverflow.com/a/25373415
type: AnsweredQuestion
answer count: 3
upvote count: 0
tagged with: java
tagged with: sqlite
tagged with: sharedpreferences
has title: How to effectively store checkbox values in Custom BaseAdapter
downvote count: 1
linked to: http://stackoverflow.com/q/12621804
has answer: http://stackoverflow.com/a/25373415
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25334835

http://stackoverflow.com/comment/39437113
score: 1
type: QuestionComment
has text: @andrew thompsons thank you for edit.
type: Comment
comment on: http://stackoverflow.com/q/25302859

http://stackoverflow.com/comment/39388623
comment on: http://stackoverflow.com/a/25276846
has text: @ScaryWombat That is not surprising, English is inherently ambiguous. Edited to try and clarify; but, I meant the variable *could be* a class level variable.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/25921057
accepted answer of: http://stackoverflow.com/q/25336179
downvote count: 0
type: Answer
score: 6
answers question: http://stackoverflow.com/q/25336179
upvote count: 6
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41553827
has body: I had the same problem too. You need to remove \bin. Also, if you change the JAVA_HOME environment variable, you'll need to restart the Libgdx Project Generator, otherwise it will not use the latest variable value. You'll only have to include \bin inside the PATH variable.

http://stackoverflow.com/comment/39387320
comment on: http://stackoverflow.com/a/25276117
type: AnswerComment
has text: But how do you tell the difference between the user typing something and the pasting something, the `DocumentListener` is to abstract
score: 1
type: Comment

http://stackoverflow.com/a/25247215
type: Answer
has comment: http://stackoverflow.com/comment/39337266
has comment: http://stackoverflow.com/comment/39337038
score: 0
answers question: http://stackoverflow.com/q/25247119
has comment: http://stackoverflow.com/comment/39335294
has comment: http://stackoverflow.com/comment/39337436
has comment: http://stackoverflow.com/comment/39335787
has body: The quiz buttons are now running but it only retrieves questions from quiz1 This is because you use getQuizNum() method to obtain which quiz to query: private List&lt;Question&gt; getQuestionSetFromDb() throws Error { int quizNum = getQuizNum(); //rest of the code... } And by looking at the implementation of getQuizNum(), you always return 1: public static final int Quiz1 = 1; //... private int getQuizNum() { int qNum = Quiz1; return qNum; } Change the code in getQuizNum to return one of the available results. Use a Random value, for example: public static final int MAX_QUIZ_QUANTITY = 3; private int getQuizNum() { Random r = new Random(); return r.nextInt(MAX_QUIZ_QUANTITY) + 1; } I misunderstood the initial question but the problem remains the same. You should provide a different instance that implements OnClickListener interface for your quiz buttons. An alternative would be to move the code to implement onClick method into an inner class, thus removing the repeated code and making it reusable for different buttons: //removed the implementation of OnClickListener from the class //and moved into an inner class //usually, your Activity doesn't implement OnClickListener unless there's a single button public class Practice extends Activity { //constants public static final String QUIZNUM = "QUIZNUM"; public static final int Quiz1 = 1; public static final int Quiz2 = 2; public static final int Quiz3 = 3; public static final int NUMBER_OF_QUESTIONS = 10; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.practice); //Menu buttons Button quiz1 = (Button) findViewById(R.id.q1Btn); quiz1.setOnClickListener(new PracticeButton(Quiz1, NUMBER_OF_QUESTIONS)); Button quiz2 = (Button) findViewById(R.id.q2Btn); quiz2.setOnClickListener(new PracticeButton(Quiz2, NUMBER_OF_QUESTIONS)); Button quiz3 = (Button) findViewById(R.id.q3Btn); quiz3.setOnClickListener(new PracticeButton(Quiz3, NUMBER_OF_QUESTIONS)); } //in…

http://stackoverflow.com/comment/39330958
has text: @lt_katana don't use names. use indicies. Column model can get the column by its index, not only by the name. See my example.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25245723
type: AnswerComment

http://stackoverflow.com/q/25347564
linked to: http://stackoverflow.com/q/3411265
tagged with: java
tagged with: io
has body: My java application does much IO operations and consumes much memory and CPU (serializations and deserializations). Generally some time my application throws out of memory exceptions in certain times even though heap sizes have already been increased and GC pauce time reduced..:( Therefore, the expected performance level cannot be gained. I found some questions like thiis . But they are theoritical and couldn't find which suits my problem. Currently I am share the load among threads. How ever I am looking whether any performance improvement can be gained by putting the load into the different JVM. I want to know Can we share the application tasks among different JVMs? if can,How ?(any example?) will there be a performance improvement ?
has comment: http://stackoverflow.com/comment/39519324
tagged with: jvm
has answer: http://stackoverflow.com/a/25356377
type: Question
has comment: http://stackoverflow.com/comment/39519072
downvote count: 0
has comment: http://stackoverflow.com/comment/39521111
has comment: http://stackoverflow.com/comment/39519069
upvote count: 1
has title: Java balance the load into many JVM
type: UnansweredQuestion
score: 1
tagged with: multithreading
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39519887
has comment: http://stackoverflow.com/comment/39519042

http://stackoverflow.com/comment/39482752
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25327506
type: Comment
has text: If the code doesn't compile, then presumably you've got an error. Always, always **always** include the error message in a question like this...

http://stackoverflow.com/q/25326689
has comment: http://stackoverflow.com/comment/39481379
type: Question
tagged with: cxf
has answer: http://stackoverflow.com/a/25327679
type: UnansweredQuestion
score: 0
answer count: 1
tagged with: maven
has title: java.lang.ClassNotFoundException: org.apache.cxf.frontend.ClientProxyFactoryBean
has comment: http://stackoverflow.com/comment/39481299
has comment: http://stackoverflow.com/comment/39481611
has body: I have a weird problem, I am not able to run my project suddenly. The same project works on another computer as expected but when I run it on my office computer it gives me a classNotFoundException for cxf. I build my project using maven and the project has been created in wicket. Root cause: java.lang.ClassNotFoundException: org.apache.cxf.frontend.ClientProxyFactoryBean at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:401) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:367) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363) When I try to explicitly add cxf dependencies in pom.xml file it starts giving me other weird exceptions, like other classes could not resolved. Could any one help me with the most possible reason for such a behavior. Pom file <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0…
tagged with: java
tagged with: wicket
has comment: http://stackoverflow.com/comment/39481687

http://stackoverflow.com/a/25283005
has comment: http://stackoverflow.com/comment/39399592
upvote count: 3
type: Answer
has body: How about: str.replaceAll("\\(|\\)","").split(",");
downvote count: 1
has comment: http://stackoverflow.com/comment/39399827
score: 2
answers question: http://stackoverflow.com/q/25282945

http://stackoverflow.com/comment/39389900
score: 0
has text: http://stackoverflow.com/questions/2619584/how-to-set-java-home-on-windows-7
comment on: http://stackoverflow.com/q/25270314
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39381620
type: Comment
score: 0
type: AnswerComment
has text: Your answer means that i can't check length of field until it could be empty - is it not good and i think you are wrong.
comment on: http://stackoverflow.com/a/25270609

http://stackoverflow.com/comment/39319098
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25238805
score: 0
has text: @Arno_Gesmar Sorry for troubling you every time. I have added Repository also but still the result is same

http://stackoverflow.com/comment/39547355
type: Comment
has text: pls set your answer as best answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25363198

http://stackoverflow.com/comment/39548446
type: Comment
type: AnswerComment
has text: @Karl Neither is inherently better or worse than the other - both types have their uses, you just need to make sure you pick the appropriate one for the situation.
comment on: http://stackoverflow.com/a/25363663
score: 1

http://stackoverflow.com/a/25283201
score: -1
has body: No you can catch specific exception by using the following template @Test(expected= TerribleWindException.class)
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25283140
upvote count: 1
has comment: http://stackoverflow.com/comment/39400190

http://stackoverflow.com/a/42861960
has body: The only solution that worked for me was the one posted by teteArg above. I'm on Spring Boot 1.4.2 w/Hibernate 5. Namely spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl For additional insight I'm posting the call trace so that its clear what calls Spring is making into Hibernate to setup the naming strategy. at org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl.toPhysicalColumnName(PhysicalNamingStrategyStandardImpl.java:46) at org.hibernate.cfg.Ejb3Column.redefineColumnName(Ejb3Column.java:309) at org.hibernate.cfg.Ejb3Column.initMappingColumn(Ejb3Column.java:234) at org.hibernate.cfg.Ejb3Column.bind(Ejb3Column.java:206) at org.hibernate.cfg.Ejb3DiscriminatorColumn.buildDiscriminatorColumn(Ejb3DiscriminatorColumn.java:82) at org.hibernate.cfg.AnnotationBinder.processSingleTableDiscriminatorProperties(AnnotationBinder.java:797) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:561) at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874) at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFact…
downvote count: 0
upvote count: 15
answers question: http://stackoverflow.com/q/25283198
type: Answer
score: 15

http://stackoverflow.com/comment/96404400
comment on: http://stackoverflow.com/a/54797916
type: AnswerComment
has text: There is no reason to ever use `java.sql.Timestamp` again, now replaced by `java.sql.OffsetDateTime` -- as of JDBC 4.2 we can directly exchange some *java.time* types with the database.
score: 0
type: Comment

http://stackoverflow.com/comment/39546533
score: 0
has text: @Code-Apprentice one test passes using XOR swap and both using traditional swap. The total length of the String seems to be the deciding factor.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25354468

http://stackoverflow.com/a/26132865
has body: What you need in web.xml is this. appstats yyy appstats xxx <web-resource-collection> admin xxx </web-resource-collection> admin It's an equivalent to following yaml for Python handlers: - url: /xxx script: yyy login: admin See https://cloud.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Requiring_login_or_administrator_status
has comment: http://stackoverflow.com/comment/40960512
type: Answer
answers question: http://stackoverflow.com/q/25263894
score: 0
has comment: http://stackoverflow.com/comment/40960436

http://stackoverflow.com/a/25270128
has comment: http://stackoverflow.com/comment/39376482
accepted answer of: http://stackoverflow.com/q/25269848
answers question: http://stackoverflow.com/q/25269848
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: Both panels are being added to the JFrame, however one of them is completely empty. When you call your initLottoPanel method, you are actually reassigning all of your sub-components (JLabels, JTextFeild, etc) to the new panel being pass. To fix this, you need to have have two set of sub-components, with each set corresponding to only one panel.

http://stackoverflow.com/a/25284157
answers question: http://stackoverflow.com/q/25284011
has body: Spring support @Autowire, ... only for Spring Beans. Normally a Java Class become a Spring Bean when it is created by Spring, but not by new. One workarround is to annotate the class with @Configurable but you must use AspectJ (compile time or loadtime waving)! @see Using Spring's @Configurable in three easy steps for an short step by step instruction.
accepted answer of: http://stackoverflow.com/q/25284011
type: AcceptedAnswer
downvote count: 0
upvote count: 24
has comment: http://stackoverflow.com/comment/39403131
has comment: http://stackoverflow.com/comment/89841673
type: Answer
has comment: http://stackoverflow.com/comment/39403425
score: 24

http://stackoverflow.com/q/25306684
has answer: http://stackoverflow.com/a/25306954
has answer: http://stackoverflow.com/a/25317469
linked to: http://stackoverflow.com/q/4567055
score: 2
has comment: http://stackoverflow.com/comment/39443896
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39443881
linked to: http://stackoverflow.com/q/34536242
linked to: http://stackoverflow.com/q/3913502
has title: Accessing OneNote API from Java
has body: I am interested in writing a Java application that can access my OneNote notebooks via the OneNote API. I am not sure how to gain access to that API from within Java. Can anybody point me to an example of how to get started here? I use Eclipse as my development environment.
has answer: http://stackoverflow.com/a/38754611
favorite count: 0
has comment: http://stackoverflow.com/comment/39448231
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: onenote
downvote count: 0

http://stackoverflow.com/comment/39384294
type: QuestionComment
score: 0
has text: @Rod_Algonquin no I mean after background fade out then for 1 second background show completely, and then go to next page .
comment on: http://stackoverflow.com/q/25274197
type: Comment

http://stackoverflow.com/q/25318989
downvote count: 0
tagged with: upload
accepted answer: http://stackoverflow.com/a/25437883
tagged with: http
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: java
has body: I have a Google app engine instance, using java (sdk 1.9.7), and it is connected to Google Cloud Storage. I'm able to successfully take a request's input and output it to a file/object in my google cloud storage bucket. here's my code for my servlet: public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { // read the input stream byte[] buffer = new byte[1024]; List&lt;byte[]&gt; allBytes = new LinkedList&lt;byte[]&gt;(); InputStream reader = req.getInputStream(); while(true) { int bytesRead = reader.read(buffer); if (bytesRead == -1) { break; // have a break up with the loop. } else if (bytesRead &lt; 1024) { byte[] temp = Arrays.copyOf(buffer, bytesRead); allBytes.add(temp); } else { allBytes.add(buffer); } } // init the bucket access GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance()); GcsFilename filename = new GcsFilename("my-bucket", "my-file"); Builder fileOptionsBuilder = new GcsFileOptions.Builder(); fileOptionsBuilder.mimeType("text/html"); // or "image/jpeg" for image files GcsFileOptions fileOptions = fileOptionsBuilder.build(); GcsOutputChannel outputChannel = gcsService.createOrReplace(filename, fileOptions); // write file out BufferedOutputStream outStream = new BufferedOutputStream(Channels.newOutputStream(outputChannel)); for (byte[] b : allBytes) { outStream.write(b); } outStream.close(); outputChannel.close(); } and when i do something like a curl POST command, this works perfectly if i just feed it data directly, like so: curl --data "someContentToBeRead" http://myAppEngineProj.appspot.com/myServlet and i can see the exactly string that i put in, "someContentToBeRead". HOWEVER, when i put a file, like so: curl -F file=@"picture.jpg" http://myAppEngineProj.appspot.com/myServlet the file is completely corrupted. if i upload a text file, it has a line of crap in the beginning of the file, and a line of crap at the end, like: ------------------------------266cb0e18eba Content-…
has answer: http://stackoverflow.com/a/25437883
tagged with: google-cloud-storage
has answer: http://stackoverflow.com/a/28140093
possible better answer: http://stackoverflow.com/a/28140093
score: 2
linked to: http://stackoverflow.com/q/23144082
type: AnsweredQuestion
answer count: 2
upvote count: 2
has title: How to properly upload (image) file to Google Cloud Storage using Java App Engine?

http://stackoverflow.com/comment/39564937
comment on: http://stackoverflow.com/q/25371983
has text: What errors do you get?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39345625
type: QuestionComment
comment on: http://stackoverflow.com/q/25253350
score: 1
type: Comment
has text: Use an embedded database or an external cache.

http://stackoverflow.com/q/25244315
type: AnsweredQuestion
has title: "Invalid byte 1 of 1-byte UTF-8 sequence" occurs when posting xml in .jar but not in eclpise
tagged with: java
tagged with: utf-8
has body: I have a problem where I am struggling, and I read many thread about "Invalid byte 1 of 1-byte UTF-8 sequence" , such as XML Invalid byte 1 of 1-byte UTF-8 sequence , MalformedByteSequenceException Invalid byte 1 of 1-byte UTF-8 sequence . But it does not solve my problem. I have a web application(living in a paas cloud), and it is working fine to handle the request from the mobile clients(not developed by myself). In order to test the server application, I write a client application(say test-client)based on Swing to post the xml data through HTTP to my server. The strange problem is that when I run this test-client in eclipse , it works fine to submit the post and get the message from my server back. But when I export it into Runnable jar, the exception is found in my server logs that " org.dom4j.DocumentException: Invalid byte 1 of 1-byte UTF-8 sequence. Nested exception: Invalid byte 1 of 1-byte UTF-8 sequence." when I post some xml data contains Chinese Character. I believe this is relative to the difference encoding between my computer and eclipse. Please note that 1.I do not have xml to read,instead I construct the xml data from an object 2.my general/preference/workspace is encoded as UTF-8. And I have request.setCharacterEncoding("UTF-8"); in my doPost; 3.I hope to modify my test-client code to let it works fine since the server is now working fine in production with the mobile user. Below is how I post the xml data URL url = new URL(address); URLConnection uc = url.openConnection(); HttpURLConnection conn = (HttpURLConnection) uc; conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-type", "text/xml"); System.out.println("before POST:\n"+xmlstr); PrintWriter pw = new PrintWriter(conn.getOutputStream()); pw.write(xmlstr); pw.close(); And the xmlstr comes from below (RequestTextMessage is a very easy class which only has getter, and one field of this Class will accept a input String, which may be Chine…
tagged with: eclipse
linked to: http://stackoverflow.com/q/24987535
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
upvote count: 2
tagged with: encoding
linked to: http://stackoverflow.com/q/12212729
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25244527
accepted answer: http://stackoverflow.com/a/25244527
score: 2

http://stackoverflow.com/q/25237020
has comment: http://stackoverflow.com/comment/39337128
has title: Sonar maven jacoco code coverage for Multimodule project
tagged with: maven
tagged with: jacoco
tagged with: sonarqube
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39337861
score: 2
has comment: http://stackoverflow.com/comment/39331011
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27976671
possible better answer: http://stackoverflow.com/a/27976671
tagged with: code-coverage
tagged with: java
has comment: http://stackoverflow.com/comment/39349400
has comment: http://stackoverflow.com/comment/39345389
favorite count: 0
has body: I have a multimodule project with a parent pom.xml and two modules in it. Project.jar and Project.war. All the test cases are under Project.jar. When I run mvn sonar.sonar goal on the Parent pom, jacoco.exec is not getting generated and code coverage is blank. I have the following properties in the parent pom. &lt;properties&gt; &lt;sonar.java.coveragePlugin&gt;jacoco&lt;/sonar.java.coveragePlugin&gt; &lt;sonar.dynamicAnalysis&gt;reuseReports&lt;/sonar.dynamicAnalysis&gt; &lt;sonar.jacoco.reportPath&gt;${project.basedir}/target/jacoco.exec&lt;/sonar.jacoco.reportPath&gt; &lt;/properties&gt; Please help. I am using Sonarqube 4.2.
type: Question
has answer: http://stackoverflow.com/a/25260410
accepted answer: http://stackoverflow.com/a/25260410

http://stackoverflow.com/comment/39494240
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25332812
has text: Yes, I'm hoping to join the two query results together as one entity so that I can plug it in the set assignee line: cc.setAssignee();

http://stackoverflow.com/comment/39387644
comment on: http://stackoverflow.com/q/25276225
score: 0
has text: Your question seems overly vague. Please include class definitions, including appropriate annotations at the class level.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25277858
answers question: http://stackoverflow.com/q/25277043
has body: Your splitting code is leaving leading space characters which cause them to not correctly match. You should instead be using a version of String.split in order to produce your array3. This will create the correct substrings with a lot less work. Edit: Your splitting code also appears to leave off the first and last morse codes which is why you get ArrayIndexOutOfBoundsExceptions when you input less than 4.
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39597418
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25386103
has text: You **could** create a font where the minus sign is empty and use that with `IAxisTick#setFont(Font)`, but that strikes me as quite a hack.
score: 0

http://stackoverflow.com/q/25263978
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25264128
score: 0
tagged with: junit4
has title: IOException parsing XML document from class path resource - file does not exist - Spring
tagged with: java
has body: I'm aware that this question about the spring xml config file not been found in execution has been asked several times before, but none of the other answers seems to work for me. I'm trying to run some test in a Maven Project with Spring and JUnit and I get this error all the time: T E S T S Running es.udc.jcastedo.NosaTenda.test.model.productoService.ProductoServiceTest 12-ago-2014 13:37:33 org.springframework.test.context.TestContextManager retrieveTestExecutionListeners INFO: Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext] 12-ago-2014 13:37:33 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2f8bbc98: startup date [Tue Aug 12 13:37:33 CEST 2014]; root of context hierarchy 12-ago-2014 13:37:33 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [nosaTenda-spring-config.xml] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.225 sec &lt;&lt;&lt; FAILURE! Results : Tests in error: es.udc.jcastedo.NosaTenda.test.model.productoService.ProductoServiceTest es.udc.jcastedo.NosaTenda.test.model.productoService.ProductoServiceTest: Could not initialize class es.udc.jcastedo.NosaTenda.test.model.util.DbUtil Tests run: 2, Failures: 0, Errors: 2, Skipped: 0 This is a link to the complete trace of the surefire report: https://dl.dropboxusercontent.com/u/2635926/es.udc.jcastedo.NosaTenda.test.model.productoService.ProductoServiceTest.txt Where you can find this lines: Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [nosaTenda-spring-config.xml]; nested e…
tagged with: http://stackoverflow.com/tag/xml
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25264128
tagged with: maven
has answer: http://stackoverflow.com/a/25268864
accepted answer: http://stackoverflow.com/a/25268864
tagged with: spring

http://stackoverflow.com/comment/39380650
type: AnswerComment
has text: You should make sure you close your streams in a `finally` block.
score: 2
comment on: http://stackoverflow.com/a/25272331
type: Comment

http://stackoverflow.com/comment/39388081
type: Comment
type: QuestionComment
score: 0
has text: adam I think your answer will work let me test it. Can you supply it as an answer with a reason and context?
comment on: http://stackoverflow.com/q/25276477

http://stackoverflow.com/q/25333768
score: 0
has answer: http://stackoverflow.com/a/25333932
tagged with: java
has answer: http://stackoverflow.com/a/25343369
tagged with: concurrency
has answer: http://stackoverflow.com/a/25333844
possible better answer: http://stackoverflow.com/a/25333844
answer count: 4
has body: I am recently reading the book "Java Concurrency in Practice". One example of "safe publish" it gives is to initialize a private int field n during construction, and a later assertion on that field n == "expect value" through a public method could still be failed if it is called from another thread. This makes me feel worried in that, assuming all private fields are initialized only once, do we still have to mark them as volatile or wrap them into ThreadLocal or even use an AtomicReference to get a pure thread safe java class, since these private fields, though not visible outside, definitely could be referenced by the method(s) called by other threads. EDIT: Just to be clear - the assertion is failed because the calling thread sees a stale value of n, even though it has been set during construction. This is a clearly a memory-visibility issue. Problem is whether synchronizing on n is worthy of the overhead after all, since it is only initialized once, and as a private field, author can make sure it won't be changed again.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39495856
accepted answer: http://stackoverflow.com/a/25334572
has comment: http://stackoverflow.com/comment/39495434
has title: pure thread-safe Java class
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/25334572

http://stackoverflow.com/comment/48621338
score: 0
has text: @Skorpius I recommend you explain further what you mean with "flipping the bits of the info in each index and writing back to that index"
comment on: http://stackoverflow.com/q/25330591
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25359111
type: Answer
accepted answer of: http://stackoverflow.com/q/25358987
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25358987
has body: Close the project, re-open and try again if this doesn't work: Close eclipse, re-open and try again if this doesn't work: Close project, manually edit .classpath file, re-open project

http://stackoverflow.com/q/25241133
has comment: http://stackoverflow.com/comment/39324525
tagged with: win32gui
has comment: http://stackoverflow.com/comment/39322148
has comment: http://stackoverflow.com/comment/39324544
answer count: 1
tagged with: applet
has answer: http://stackoverflow.com/a/25241245
type: UnansweredQuestion
type: Question
has body: I try to start an applet on top of my own Win32 window. In other words, I need to develop a java applet container on windows. Where can I find the doc or sample code to start an applet in my own application. Browsing the source code of Chrome did not reveal the answer. So : how to deliver my Window handle to the JVM so it places the applet on my HWND? And what is needed to position/size the applet. The applet container should run in a UNIFACE environment. In the current setup customers use an OCX container with an OCX in it which contains the applet. Also they use the HTML widget which is based on the Chrome browser. The OCX widget is discontinued and the Chrome browser is way too fat. So the UNIFACE lab is questioned for a Java Container like the OCX container widget. Thanks in advance for your time Jasper de Keijzer
has title: How to run a Java Applet on top of my own window handle
score: 0
tagged with: java

http://stackoverflow.com/a/25243438
upvote count: 19
has comment: http://stackoverflow.com/comment/39328082
has comment: http://stackoverflow.com/comment/39328029
downvote count: 0
has comment: http://stackoverflow.com/comment/51167531
has comment: http://stackoverflow.com/comment/39326411
score: 19
has body: The real error is this: Connection to http://repo1.maven.org refused Gradle needs to download the dependencies listed in the error message to be able to compile the project. You're probably behind a firewall or your Internet connection isn't working. You need to make sure Gradle can access http://repo1.maven.org. Note: Maven Central (http://repo1.maven.org) can be accessed with a browser. If you see the message "Browsing for this directory has been disabled" that means your browser could connect to the server (the error is a special message my Maven Central, not a standard HTTP error message). If you see this but Maven or Gradle fail, then you need to check your browser's/OS's proxy settings and configure your tool accordingly. Related: How do I use Maven through a proxy? Gradle proxy configuration
has comment: http://stackoverflow.com/comment/51159195
type: Answer
answers question: http://stackoverflow.com/q/25243342

http://stackoverflow.com/comment/39517237
score: 0
type: Comment
has text: Please explain the downvote. This question tells the OP the (probably) most effective way to satisfy his requirement. And it answers his literal question too.
type: AnswerComment
comment on: http://stackoverflow.com/a/25346197

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/25384285
tags question: http://stackoverflow.com/q/25231323
type: Tag
tags question: http://stackoverflow.com/q/25286904
tag name: pdf
tags question: http://stackoverflow.com/q/25248981
tags question: http://stackoverflow.com/q/25362553
tags question: http://stackoverflow.com/q/25359024

http://stackoverflow.com/q/25247409
accepted answer: http://stackoverflow.com/a/25247784
favorite count: 0
type: Question
score: 1
tagged with: android
tagged with: java
has body: I am new to Android Developement and to Java too. I am working on a search tool. I have a SQLite database and the search tool search in it with success. Now I want to use custom suggestions. The problem is : I want to access my database inside my SearchSuggestionsProvider but can't because i need a context (and the class is not an Activity). I read that i could pass a context in the constructor but since i'm not creating any objects I can't. Maybe I'm missing something here. I followed this tutorial : http://weblog.plexobject.com/?p=1689. Here is my SearchSuggestionsProvider class : public class SearchSuggestionsProvider extends SearchRecentSuggestionsProvider { static final String TAG = SearchSuggestionsProvider.class.getSimpleName(); public static final String AUTHORITY = SearchSuggestionsProvider.class .getName(); public static final int MODE = DATABASE_MODE_QUERIES | DATABASE_MODE_2LINES; private static final String[] COLUMNS = { "_id", // must include this column SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_INTENT_DATA, SearchManager.SUGGEST_COLUMN_INTENT_ACTION, SearchManager.SUGGEST_COLUMN_SHORTCUT_ID }; public SearchSuggestionsProvider() { setupSuggestions(AUTHORITY, MODE); } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { String query = selectionArgs[0]; if (query == null || query.length() == 0) { return null; } MatrixCursor cursor = new MatrixCursor(COLUMNS); try { List&lt;Pokemon&gt; list = callmyservice(query); int n = 0; for (Pokemon pokemon : list) { cursor.addRow(createRow(new Integer(n), query, pokemon.getName(), pokemon.getTier())); n++; } } catch (Exception e) { Log.e(TAG, "Failed to lookup " + query, e); } return cursor; } private Object[] createRow(Integer id, String text1, String text2, String name) { return new Object[] { id, // _id text1, // text1 text2, // text2 text1, "android.intent.action.SEARCH", // action Se…
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25247788
possible better answer: http://stackoverflow.com/a/25247788
downvote count: 0
upvote count: 1
tagged with: sqlite
has title: How can I access my DataBase (using a context) with my class (which is not an activity)
has answer: http://stackoverflow.com/a/25247784

http://stackoverflow.com/a/25257696
type: Answer
score: 0
has body: I forgot annotate config with @EnableWebMvc. After annotating controller works fine.
accepted answer of: http://stackoverflow.com/q/25239072
answers question: http://stackoverflow.com/q/25239072
type: AcceptedAnswer

http://stackoverflow.com/comment/39417164
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25292246
has text: Also, your first statement seems wrong, because they would get the same (type of) error if they used `<T>` instead of `<? extends T>`.
type: Comment

http://stackoverflow.com/comment/39461474
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25315829
type: AnswerComment
has text: It depends on the time it takes to service each request. If it's low, do it all in one thread.

http://stackoverflow.com/comment/39595737
comment on: http://stackoverflow.com/a/25385031
score: 0
type: AnswerComment
type: Comment
has text: Have you tried temporarily switching to Java 7 to see if it's a version specific issue?

http://stackoverflow.com/a/25287879
score: 3
has comment: http://stackoverflow.com/comment/50895277
type: Answer
has body: I had exactly the same problem happen to me the last 2 days. It was a simple bug where I had an ArrayList of Entities which are displayed at the moment. If a collision happened, I set a flag just as you did. Later, I run through my Entity ArrayList and deleted every Entities body which was flagged - but not the Entity itself! Here's my deletion code. It works for me, I hope it works for you as well. CopyOnWriteArrayList&lt;Entity&gt; entities = new CopyOnWriteArrayList&lt;Entity&gt;(); public void deleteEntities() { for(Entity entity: entities){ Body body = entity.getBody(); if (body != null) { EntityData data = (EntityData) body.getUserData(); if (data.isFlaggedForDelete()) { final Array&lt;JointEdge&gt; list = body.getJointList(); //delete all joints attached while (list.size &gt; 0) { myWorld.getWorld().destroyJoint(list.get(0).joint); } //nullify everything, remove the entity from entities and destroy the body body.setUserData(null); myWorld.getWorld().destroyBody(body); entities.remove(entity); body = null; } } } } Additionally make sure you dont dispose() too early! Could be a problem as well. I hope this was helpful :-)
accepted answer of: http://stackoverflow.com/q/25243532
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25243532

http://stackoverflow.com/a/25347239
type: Answer
answers question: http://stackoverflow.com/q/25347172
score: 2
upvote count: 2
downvote count: 0
has body: Since you are using only one reference to the panel_main by the time you call this.setContentPane(panel_main2); it will then remove it self from the contentPane panel and add itself to the Frame as its main Panel thus you can not see it in your contentPane panel upon exiting the fullscreen. solution: since you cant resize it back to its state, you can create 2 instance of ReadPanel one for the contentPane and one for the fullscreen panel_main = new ReadPanel(); panel_main2 = new ReadPanel(); panel_main.setNews("This is a news\r\n1\r\n\r\n\r\n\r\n\r\n\r\n\r\n" + "This is a news\r\n2\r\n\r\n\r\n\r\n" + "This is a news\r\n3\r\n\r\n\r\n" + "This is a news\r\n4"); panel_main2.setNews("This is a news\r\n1\r\n\r\n\r\n\r\n\r\n\r\n\r\n" + "This is a news\r\n2\r\n\r\n\r\n\r\n" + "This is a news\r\n3\r\n\r\n\r\n" + "This is a news\r\n4"); panel_main2.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { exitFullReadMode(); } For going fullScreen public void goFullReadMode(){ this.setContentPane(panel_main2); this.repaint(); this.revalidate(); } Now when you update the text of the panel_main you must update the panel_main2 as well.

http://stackoverflow.com/comment/39316281
has text: i navigate through my app but see nothing in the logcat
comment on: http://stackoverflow.com/a/25235967
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/44441336
type: Answer
has body: Enter in the YOUR_WORKSPACE/.metadata search for "google" and delete all folders In the first line of your "eclipse.ini" include: -clean Start you eclipse This work for me.
answers question: http://stackoverflow.com/q/25276970
score: 0

http://stackoverflow.com/q/25344016
has answer: http://stackoverflow.com/a/25344111
tagged with: code-signing
tagged with: udid
tagged with: java
type: Question
score: 0
type: UnansweredQuestion
has title: iOS analog of java developer signature
tagged with: ios
answer count: 1
has body: Is there a way in iOS to uniquely identify developer like it is done in java through package name and developer signature. I know that in iOS 7 there is identifierForVendor that has same value for all of the apps of the same vendor, but the problem is on different devices the VendorID is different regardless developer as explained here.

http://stackoverflow.com/comment/39540534
score: 0
has text: .. that is why one should always use [yoda conditions](http://en.wikipedia.org/wiki/Yoda_conditions#Advantage) (at least to avoid the NPE)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25359512

http://stackoverflow.com/comment/39495434
type: QuestionComment
has text: I would think that the assertion would always fail if you put the value in a `ThreadLocal` in one thread and run the assertion in a different one.
comment on: http://stackoverflow.com/q/25333768
score: 0
type: Comment

http://stackoverflow.com/q/25298093
has comment: http://stackoverflow.com/comment/39428528
favorite count: 0
has comment: http://stackoverflow.com/comment/39428498
type: Question
answer count: 2
has title: Android Fragments not being recreated on Activity Restart
has comment: http://stackoverflow.com/comment/39428843
type: UnansweredQuestion
tagged with: android
downvote count: 0
has answer: http://stackoverflow.com/a/25298538
has body: I have an Activity which contains a couple of nested Fragments. I have been having a lot of trouble handling orientation changes. Something is not correct when the Activity tries to recreate itself which causes the app to crash. If I try to debug the code during an orientation change the app crashes without any messages in the logcat. My problem seems to be the the runtime is trying to recreate the fragments in my Activity when I don't want it to. None of the fragments have setRetainInstance(true) so they shouldn't be getting kept. I have added logging to the onCreate and onDestroy methods of the Activity and Fragments. When the app first runs I get the following output: Activity onCreate Fragment1 onCreate Fragment1 onCreateViewStart Fragment1 onCreateViewEnd Fragment2 onCreate Fragment2 onCreateViewStart Fragment2 onCreateViewEnd I then rotate the device and get the following: Fragment1 onDestroy Fragment2 onDestroy Activity onDestroy Fragment1 onCreate Fragment2 onCreate Activity onCreate Fragment1 onCreateViewStart Fragment1 onCreateViewEnd Fragment2 onCreateViewStart Fragment2 onCreateViewEnd Fragment2 onDestroy Fragment2 onCreate After the last message above the app crashes with the following exception message: E/FragmentManager(32258): No view found for id 0x7f0a0047 (com.appName:id/fragmentHolder) for fragment Fragment2{6529b910 #6 id=0x7f0a0047 16002} Why are my fragments being recreated automatically? Is there anything I can do to force the activity to reload as if the app was being started for the first time when the orientation changes? Is this not how the life cycle is supposed to work in the first place? I can add any code if requested.
score: 3
has answer: http://stackoverflow.com/a/25298623
tagged with: android-fragments
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/70342393
score: 0
type: AnswerComment
has text: @banncee you should use PATCH, not PUT
comment on: http://stackoverflow.com/a/25451662
type: Comment

http://stackoverflow.com/a/25336458
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25335461
has body: As explained in the documentation, WithApplication "automatically ensure that a fake application is started and stopped for you" So you do not need to start a new one in your test if you extend WithApplication. Try this : public class ApplicationTest extends WithApplication { @Test public void simpleCheck() { int a = 1 + 1; assertThat(a).isEqualTo(2); } } or this public class ApplicationTest { @Test public void simpleCheck() { running(fakeApplication(), new Runnable() { public void run() { int a = 1 + 1; assertThat(a).isEqualTo(2); } }); } }
has comment: http://stackoverflow.com/comment/40126314
answers question: http://stackoverflow.com/q/25335461
score: 0
type: Answer

http://stackoverflow.com/comment/39538505
type: Comment
comment on: http://stackoverflow.com/a/25358146
score: 0
type: AnswerComment
has text: Oh ok, so you do provide the input fields to enter the credentials, I'll update my answer accordingly. Still, I believe the rest of my answer is correct.

http://stackoverflow.com/q/25231639
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39304067
has comment: http://stackoverflow.com/comment/39304407
has answer: http://stackoverflow.com/a/25231790
has comment: http://stackoverflow.com/comment/39304111
possible better answer: http://stackoverflow.com/a/25231775
answer count: 4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25231775
has body: Let's say that url = "http://gmail.com". I try to make from this a string dnsname = "Top-level com". Now we run the following piece of code: System.out.println(url); String[] urlsplit = new String[3]; System.out.println(url.substring(10,11)); urlsplit = url.split(url.substring(10,11)); String dnsname = "Top-level " + urlsplit[urlsplit.length - 1]; System.out.println(dnsname); As output we get: http://www.gmail.com . Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1 I do not see the mistake I made, however there must be one.
has comment: http://stackoverflow.com/comment/39303901
accepted answer: http://stackoverflow.com/a/25231697
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25231697
has title: After splitting a string, ArrayOutOfBoundsException
has comment: http://stackoverflow.com/comment/39304138
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25231777
has comment: http://stackoverflow.com/comment/39304168

http://stackoverflow.com/a/25381722
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25381607
has body: Just search for a plugin for your favorite web browser that lets you change the user agent string. The user agent string is how the browser tells the web site what kind of device and browser is trying to access the page and the web site can then render a page that's appropriate for your device and browser (for the web sites that have customized versions of their pages).

image-processing
tags question: http://stackoverflow.com/q/25382093
type: Tag
tags question: http://stackoverflow.com/q/25360544
tags question: http://stackoverflow.com/q/25361621
tags question: http://stackoverflow.com/q/25361635
tag name: image-processing
tags question: http://stackoverflow.com/q/25313155

http://stackoverflow.com/q/25291720
has comment: http://stackoverflow.com/comment/39416065
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25291796
possible better answer: http://stackoverflow.com/a/25291796
has body: In C# when we wanna create methods that can take in lambda expressions as arguments we can use either Action or Func&lt;T&gt; depending on the situation. The new Java 8 has added support for lambdas but I couldn't find any decent example on how to use that. So assuming that I wanna create a method in Java similar to this C# one: public static Boolean Check (String S, Func&lt;String, Boolean&gt; AnAction) { return AnAction(S); } How exactly could this be written in Java then ?
has answer: http://stackoverflow.com/a/25291885
favorite count: 0
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1184418
tagged with: lambda
has title: Support for lambda expressions in Java 8
accepted answer: http://stackoverflow.com/a/25291885
tagged with: java-8
has comment: http://stackoverflow.com/comment/39415948
type: AnsweredQuestion

http://stackoverflow.com/comment/39484220
comment on: http://stackoverflow.com/q/25316074
has text: @CommonsWare So in this case, how does one obtain the file type and name correctly from the returned intent data?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39306295
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25232789
score: 4
has text: Microbenchmarks are not reliable measures of performance. You can always go read the Java source code if you really want to know.

http://stackoverflow.com/q/25248612
has comment: http://stackoverflow.com/comment/39336411
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25249646
has title: Java router port setup programmatically
has body: I'm wondering if there is a way to setup connection between a client and a server over the internet and have both of them programmatic setup all needed router/firewall configuration changes to open needed external ports to communicate. Assuming both server and client have known ip addresses and a DNS is not needed in this example to find the IP addresses. How might one have a server that when started configures access past the firewall and tells the router how to route proper communication to the server. I would assume the client may not need anything like this as it should only need to know the external IP address and port number of the server. If i'm wrong about my assumption please let me know. Example if I have two houses house (A) has a server and house (B) has a client and both sites know what the other house external IP address is and know what port they will be using how may a Java application do all the configuration or at least do as much as possible on say windows,mac,ubuntu. The idea is the user of the server and client should not have to do a bunch of firewall/router configurations to get the application running. It would also be nice if in the example it shows how to release the connections when the server is terminated. Example when the java server is turned off it should close up port settings on the firewall and router. security and clean house.
has answer: http://stackoverflow.com/a/25249646
answer count: 1
tagged with: firewall
upvote count: 1
tagged with: router
downvote count: 1
has comment: http://stackoverflow.com/comment/39336499
type: AnsweredQuestion
score: 0
tagged with: network-programming
tagged with: sockets
tagged with: java

http://stackoverflow.com/q/25314744
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25315645
has answer: http://stackoverflow.com/a/25315645
upvote count: 2
has title: Fitting text to a physical size (standard 8.5" x 11" letter paper) in Java
tagged with: swing
type: AnsweredQuestion
tagged with: printing
score: 2
tagged with: java
answer count: 1
downvote count: 0
has body: Java has a nice class for dealing with text sizes on a display (FontMetrics) but I can't find anything on how to get the size of a given string of text on a physical piece of paper. Basically, I have a JTextArea in which the user can enter however much text he/she wishes. I need to figure out how wide a given section of text is on physical paper so that I can insert line breaks. I would loop through all the text in the text box, adding line breaks if words would end up outside the bounds of the page. It sounds so simple, but without any way to measure how big the text is, it seems quite difficult. How can I measure how large the text is when printed on paper?

sqlite
tags question: http://stackoverflow.com/q/25289107
tags question: http://stackoverflow.com/q/25307868
tags question: http://stackoverflow.com/q/25371274
tags question: http://stackoverflow.com/q/25314309
tags question: http://stackoverflow.com/q/25300127
tags question: http://stackoverflow.com/q/25306198
tags question: http://stackoverflow.com/q/25254793
tags question: http://stackoverflow.com/q/25309388
tags question: http://stackoverflow.com/q/25263013
tags question: http://stackoverflow.com/q/25331750
tags question: http://stackoverflow.com/q/25334857
tags question: http://stackoverflow.com/q/25372459
tags question: http://stackoverflow.com/q/25333387
tags question: http://stackoverflow.com/q/25232818
tags question: http://stackoverflow.com/q/25344518
tags question: http://stackoverflow.com/q/25231739
tags question: http://stackoverflow.com/q/25348763
type: Tag
tags question: http://stackoverflow.com/q/25332855
tags question: http://stackoverflow.com/q/25356493
tags question: http://stackoverflow.com/q/25236696
tags question: http://stackoverflow.com/q/25389290
tags question: http://stackoverflow.com/q/25326549
tags question: http://stackoverflow.com/q/25253435
tags question: http://stackoverflow.com/q/25271215
tags question: http://stackoverflow.com/q/25340665
tags question: http://stackoverflow.com/q/25303766
tags question: http://stackoverflow.com/q/25247756
tags question: http://stackoverflow.com/q/25266893
tags question: http://stackoverflow.com/q/25247409
tags question: http://stackoverflow.com/q/25247224
tag name: sqlite
tags question: http://stackoverflow.com/q/25347664
tags question: http://stackoverflow.com/q/25247119
tags question: http://stackoverflow.com/q/25232730
tags question: http://stackoverflow.com/q/25364474
tags question: http://stackoverflow.com/q/25238152

http://stackoverflow.com/comment/103038929
has text: an explicitly set column name should under all conditions override an implicitly generated one. If it doesn't, that's a bug in the JPA implementation.
type: Comment
comment on: http://stackoverflow.com/a/44694896
score: 0
type: AnswerComment

http://stackoverflow.com/a/25349859
has comment: http://stackoverflow.com/comment/39525555
has body: If you want to hide the meta data from users of your domain classes A, B or C, don't have them extend DBObject&lt;MetaObject&gt; as it will have the opposite effect: exposing the DBObject interface to users. In general, it is bad to have domain classes depend on a persistence layer because changes in the persistence layer will ripple through to those classes and you want your domain to be rather stable.
answers question: http://stackoverflow.com/q/25349637
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39534741
accepted answer of: http://stackoverflow.com/q/25349637
score: 0
type: Answer

httpconnection
tag name: httpconnection
type: Tag
tags question: http://stackoverflow.com/q/25268406

http://stackoverflow.com/comment/39354134
has text: @user3698577 thanks for the comment, the code still give me result of webView height not content webView height :(
comment on: http://stackoverflow.com/q/25257826
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25266684
type: Question
has title: BufferedReader reads a value which is somehow null
accepted answer: http://stackoverflow.com/a/25267302
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39369798
answer count: 2
tagged with: nullpointerexception
tagged with: java
has answer: http://stackoverflow.com/a/25267169
possible better answer: http://stackoverflow.com/a/25267169
has body: Ok, so I was doing a program which has a config file handler, and what it does is that it reads in the lines from a text file, which looks something like this: ImagePath=SomePath The method reads line by line matching the key with the corresponding line, and after that it then searches for the '=' character position in the String, and then substrings it such that the value SomePath is obtained. However, there is an issue. Basically, the issue I am facing is that the reader is able to read the file, as I put a statement to print out the lines variable and it does print out the line read. However, the issue is that this lines variable would then be manipulated, but an NullPointerException error would occur around there (the lines.substring(0,key.length()-1) part), suggesting that the lines variable suddenly became null even though it is shown that something was read into the variable. Thing is, what happens to this variable in between the print statement and the string manipulation? I am unable to fix this issue. Pardon my code which might look messy or whatnot. I was trying multiple variations of my code to try to mitigate the issue, but it seems to not work. What is shown below is my latest variation of the code. public static String readConfig(String key) throws IOException { BufferedReader reader=null; try { reader=new BufferedReader(new FileReader(config)); } catch(FileNotFoundException e) { System.out.println("Failed to read file. Code: 3"); System.exit(0); } String lines=reader.readLine(); System.out.println(lines); String returnValue=null; while(true) { if(key.equals(lines.substring(0,key.length()-1))) { int plusPos=0; for(int i=0;i&lt;lines.length();i++) { if(lines.charAt(i)=='=') { plusPos=i; } } if(plusPos==0) { reader.close(); return null; } returnValue=lines.substring(plusPos,lines.length()-1); reader.close(); return returnValue; } lines=reader.readLine(); } } Edit 1: Ok, I see that Sbodd suggested that my code is kinda flawed, but well, the above snippet…
has answer: http://stackoverflow.com/a/25267302
has comment: http://stackoverflow.com/comment/39370098

http://stackoverflow.com/a/25291061
has comment: http://stackoverflow.com/comment/39415057
downvote count: 0
has comment: http://stackoverflow.com/comment/39414908
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/39415070
accepted answer of: http://stackoverflow.com/q/25291007
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39414805
has body: You probably have a bug, since both your loops iterate on the same list programacoesEmpresas, so even if you didn't get an exception, you would simply remove all the objects from the list (assuming you are not comparing Strings with == - I don't know what the type of getId() is). You can't modify that list while iterating over it with the enhanced for loop (which is what you do in the internal loop). for (final Iterator iterator = programacoesEmpresas.iterator(); iterator.hasNext();) and for (final Programacao progEmpresa : programacoesEmpresas)
answers question: http://stackoverflow.com/q/25291007
has comment: http://stackoverflow.com/comment/39414808
score: 2
has comment: http://stackoverflow.com/comment/39415000

http://stackoverflow.com/q/25273818
accepted answer: http://stackoverflow.com/a/25275075
has comment: http://stackoverflow.com/comment/39383442
has comment: http://stackoverflow.com/comment/39383441
has comment: http://stackoverflow.com/comment/39384534
favorite count: 0
has comment: http://stackoverflow.com/comment/39384595
type: AnsweredQuestion
tagged with: nullpointerexception
has body: I realize there is an nearly identical question in title. The question does not seem to be relevant to my particular issues. I'm using the JavaFX scene builder to create my UI, (which includes the TextArea in question). All I want to do is take the message I get from the server and post it into the text area. Through various println statements I have narrowed the problem to this. I have tried various solutions (for hours); coming here was a last resort. The only other possible cause I can think of would be something going wrong with the multithreading, but can even begin to think of what. public class IncomingReader implements Runnable { @Override public void run() { String message; try { while((message = Connection.connection.reader.readLine()) != null) { System.out.println("read" + message); //for debug, prints fine FXMLDocumentController.controller.chatBox .appendText(message + "\n"); /////////PROBLEM HERE////// } } catch(IOException e) { System.out.println("Problem!"); // TODO: Catch better. } } } FXML controller class (relevant line only): @FXML protected TextArea chatBox; public class JavaChat extends Application { @Override public void start(Stage stage) throws Exception { // Create and set up scene... Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); // Establish connection to server... Connection.createNewConnection(); // Create new reader thread... Thread readerThread = new Thread(new IncomingReader()); readerThread.start(); // When all done... stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } The line of FXML that defines the chatBox: &lt;TextArea id="ChatBox" fx:id="chatBox" focusTraversable="false" mouseTransparent="true" prefHeight="400.0" prefWidth="200.0" promptText="Chat:" wrapText="true" BorderPane.alignment="CENTER"&gt; The resulting exception: Exception in thread "Thread-4" java.lang.NullPointerException at javachat.IncomingReader.run(Incoming…
has comment: http://stackoverflow.com/comment/39383542
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39384895
has comment: http://stackoverflow.com/comment/39384748
has answer: http://stackoverflow.com/a/25275075
has comment: http://stackoverflow.com/comment/39383225
has comment: http://stackoverflow.com/comment/39383505
has comment: http://stackoverflow.com/comment/39383588
has comment: http://stackoverflow.com/comment/39384224
has comment: http://stackoverflow.com/comment/39383562
tagged with: append
linked to: http://stackoverflow.com/q/14187963
has title: NullPointerException when using TextArea.append()
type: Question
has comment: http://stackoverflow.com/comment/39384843
has comment: http://stackoverflow.com/comment/39384345
has comment: http://stackoverflow.com/comment/39383344
upvote count: 1
has comment: http://stackoverflow.com/comment/39384303
has comment: http://stackoverflow.com/comment/39384851
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39383846
answer count: 1

http://stackoverflow.com/q/25233072
answer count: 1
downvote count: 0
favorite count: 0
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1897655
tagged with: java
has answer: http://stackoverflow.com/a/25233085
accepted answer: http://stackoverflow.com/a/25233085
has title: Why is the Java type `UNIXProcess` not visible on my system?
has comment: http://stackoverflow.com/comment/39306933
tagged with: unix
has body: I am building a Java application that I intend to be used only on a Unix OS. In the application I create some child processes using ProcessBuilder and want to interact with them in a native manner. So instead of using the interface provided by Process I would like to cast them to UNIXProcess after starting the child. However I get this error when trying to use the Type. import java.lang.UNIXProcess; public class Main { public static void main(String args) throws Exception { ProcessBuilder bp = new ProcessBuilder("/bin/echo", "hello"); Process process = bp.start(); UNIXProcess unixProcess = (UNIXProcess) process; } } The type java.lang.UNIXProcess is not visible Am I not supposed to be using UNIX Process? I am seeing this error in Eclipse for Java 1.7, if that matters.
type: Question
upvote count: 2

http://stackoverflow.com/a/25316952
answers question: http://stackoverflow.com/q/25316863
type: Answer
has comment: http://stackoverflow.com/comment/39463314
downvote count: 0
score: 1
upvote count: 1
has body: You need to find the pattern of how number of lines affect the placing of the center. For example if we got 3 lines : 1 #0 1 line = 0 spacing 1 #2 2 1 2 2 lines = 2 spacing 1 #4 2 1 2 3 2 1 2 3 3 lines = 4 spacing You might already see the pattern, the spacing the center piece is 2*numberOfLines. 1 #4 2 1 2 #2 3 2 1 2 3 #0 You will also pretty quick notice that each lines decrease with 2 in spacing. Always start with the basic things first and try to find a pattern, it makes most assignments much easier.

http://stackoverflow.com/a/25318174
answers question: http://stackoverflow.com/q/25317877
has comment: http://stackoverflow.com/comment/39480435
type: Answer
has comment: http://stackoverflow.com/comment/39474862
has body: You will have to use a Comparator and define your own logic.The Comparator will take two String as inputs . String [] stringArray = {"Bart4", "Bart5", "Bart6", "Bart7", "Bart8", "Bart9", "Bart10", "Lisa", "Marge", "Homer", "Bart", "Bart1", "Bart2", "Bart3", "Bart11", "Bart12"}; java.util.Arrays.sort(stringArray ,new Comparator&lt;String&gt;(){ @Override public int compare(String s1, String s2) { //You will need to build your logic here ..You will have to extract numbers //from the string and compare the substring and the number with other sub string and number } });
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39489690

http://stackoverflow.com/q/25347309
has comment: http://stackoverflow.com/comment/39518682
has comment: http://stackoverflow.com/comment/39518991
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1431681
downvote count: 2
answer count: 1
has body: I have a Java ArrayList, that is being used by 500+ threads simultaneously. For some reason, the synchronization block is not ensuring synchronization on a Java Array List. I known that ArrayLists are non thread-safe, i.e., they are not synchronized. However, I thought that by wrapping the list into a synchronized block I would achieve that. Unfortunately, in rare (but in some situations) two or more threads are entering the synchronized block simultaneously, which is giving me non-deterministic behaviour. Am I missing something? How can I guarantee that my array list (or any other list collection) are completely thread safe throughout 500+ simultaneous threads operating in the array. There is a related question, (Correct way to synchronize ArrayList in java), but I did not understood its answer. Should I create a Synchronized collection at every "run" of my threads??? Sample: Thread 1 synchronized (_myList) { Iterator it = _myList.iterator(); ... } Thread 2 synchronized (_myList) { Iterator it = _myList.iterator(); ... } Thread n synchronized (_myList) { Iterator it = _myList.iterator(); ... }
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39518673
has comment: http://stackoverflow.com/comment/39518685
score: -2
has comment: http://stackoverflow.com/comment/39518806
tagged with: java
has comment: http://stackoverflow.com/comment/39518957
has answer: http://stackoverflow.com/a/25347417
tagged with: concurrency
has title: Synchronize block not synchronizing a Java array list
has comment: http://stackoverflow.com/comment/39518705
has comment: http://stackoverflow.com/comment/39519015

http://stackoverflow.com/a/25366498
answers question: http://stackoverflow.com/q/25366309
has body: Try replacing Toast.makeText(this, String.valueOf("The perimeter of square is " + perimeter),Toast.LENGTH_LONG).show(); by Toast.makeText(getApplicationContext(), "The perimeter of square is " + perimeter,Toast.LENGTH_LONG).show(); OR Toast.makeText(MainActivity.this, "The perimeter of square is " + perimeter,Toast.LENGTH_LONG).show();
type: Answer
score: 0

http://stackoverflow.com/a/25231258
upvote count: 7
has body: You've said that "We know that overloading doesn't work for derived classes in C++". It is not true or an accurate sentence. You can overload across base and derived classes in C++. Just need to using the parent's method into the derived class to un-hide that method. class Derived : public Base { public: using Base::f; ^^^^^^^^^^^^^^ double f(double d) { ... } }; In Java overloaded (same name) method in the derived class doesn't hide its parent method and you don't need to explicitly bring it from the parent's method.
answers question: http://stackoverflow.com/q/25231084
score: 7
type: Answer
downvote count: 0

http://stackoverflow.com/a/25298843
has comment: http://stackoverflow.com/comment/129125876
downvote count: 1
has comment: http://stackoverflow.com/comment/135786273
has comment: http://stackoverflow.com/comment/81010585
accepted answer of: http://stackoverflow.com/q/25298063
has comment: http://stackoverflow.com/comment/129082276
type: Answer
has body: According to Mozilla Developer Docs encodeURICompoent() uses UTF-8 to encode. When I run this on your string I get tester%C3%A6%C3%B8%C3%A5 as expected. When i run the following Java code: System.out.println(URLEncoder.encode("testeræøå", "UTF-8")); It also prints tester%C3%A6%C3%B8%C3%A5. I also ran your test and got: ------ START TESTING WITH USER ID = 'dummy' ---------------------- Test URLEncoder.encode(userId): dummy Test URLEncoder.encode(userId,"UTF-8"): dummy Test URLEncoder.encode(userId,"UTF-16"): dummy Test URLEncoder.encode(userId,"UTF-16LE"): dummy Test URLEncoder.encode(userId,"UTF-16BE"): dummy Test engine.eval("encodeURIComponent(\""+userId+"\")"): dummy Test encodeURIComponent(userId): dummy TEST new URI(userId).toASCIIString(): dummy ------ END TESTING WITH USER ID = 'dummy' ---------------------- ------ START TESTING WITH USER ID = 'testeræøå' ---------------------- Test URLEncoder.encode(userId): tester%C3%A6%C3%B8%C3%A5 Test URLEncoder.encode(userId,"UTF-8"): tester%C3%A6%C3%B8%C3%A5 Test URLEncoder.encode(userId,"UTF-16"): tester%FE%FF%00%E6%00%F8%00%E5 Test URLEncoder.encode(userId,"UTF-16LE"): tester%E6%00%F8%00%E5%00 Test URLEncoder.encode(userId,"UTF-16BE"): tester%00%E6%00%F8%00%E5 Test engine.eval("encodeURIComponent(\""+userId+"\")"): tester%C3%A6%C3%B8%C3%A5 Test encodeURIComponent(userId): tester%C3%A6%C3%B8%C3%A5 TEST new URI(userId).toASCIIString(): tester%C3%A6%C3%B8%C3%A5 ------ END TESTING WITH USER ID = 'testeræøå' ---------------------- ------ START TESTING WITH USER ID = 'tester%C3%A6%C3%B8%C3%A5' ---------------------- Test URLEncoder.encode(userId): tester%25C3%25A6%25C3%25B8%25C3%25A5 Test URLEncoder.encode(userId,"UTF-8"): tester%25C3%25A6%25C3%25B8%25C3%25A5 Test URLEncoder.encode(userId,"UTF-16"): tester%FE%FF%00%25C3%FE%FF%00%25A6%FE%FF%00%25C3%FE%FF%00%25B8%FE%FF%00%25C3%FE%FF%00%25A5 Test URLEncoder.encode(userId,"UTF-16LE"): tester%25%00C3%25%00A6%25%00C3%25%00B8%25%00C3%25%00A5 Test URLEncoder.encode(userId,"UTF-16BE…
has comment: http://stackoverflow.com/comment/135781173
has comment: http://stackoverflow.com/comment/39506019
upvote count: 7
type: AcceptedAnswer
score: 6
answers question: http://stackoverflow.com/q/25298063
has comment: http://stackoverflow.com/comment/81013430

http://stackoverflow.com/comment/39345655
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/25253350
has text: Why will `ArrayList` clearly die? If you have the heap space, you can easily call [`new ArrayList<>(DESIRED_SIZE);`](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#ArrayList%28int%29) and get your array.
type: Comment

http://stackoverflow.com/q/25253448
type: Question
linked to: http://stackoverflow.com/q/1399750
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25274486
has title: Java- PLSQL- Call Table of records from java
has answer: http://stackoverflow.com/a/25274486
type: AnsweredQuestion
tagged with: plsql
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/13801183
upvote count: 1
has body: PLSQL package-procedure declarations TYPE custom_type IS TABLE OF single_rec_type; TYPE single_rec_type IS RECORD( //id, name etc ) Problem: But custom_type has no direct Java type representation [like OracleTypes.CLOB or OracleTypes.CURSOR] because custom_type is a PLSQL type and not a SQL type. When I googled, I came across these two options: To represent it , (1) create a SQL TYPE from procedure(or a wrapper PLSQL function) that we can bind from java. Reference: java - passing array in oracle stored procedure (2) Register the output parameter with our type and use SQLData object to represent a record. Reference: Howto get a table as a out parameter in oracle callableStatement.registerOutParameter(8, OracleTypes.ARRAY, "custom_type"); On doing this, I get the error: java.sql.SQLException: invalid name pattern: MYDB_OWNER.custom_type at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:554) at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:471) One suggestion was to declare the custom_type TYPE inside the schema, instead of declaring inside the package. or by creating public synonym and giving grants. Question - Regarding the second approach, is it correct practice to declare any custom type in schema level?
favorite count: 0

http://stackoverflow.com/q/25296449
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39425632
has answer: http://stackoverflow.com/a/25311724
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25296695
answer count: 2
has title: Android JSONArray equivalent of indexOf?
tagged with: java
has answer: http://stackoverflow.com/a/25296695
tagged with: http://stackoverflow.com/tag/json
has body: I have a JSONArray of JSONObjects called myArray, and at some point in my code I retrieved one of the objects. For example: JSONObject myObject = myArray.getJSONObject(x); Later, I'd like to look up the index of myObject within myArray. That is, I'd like to get x back. Is there an "indexOf" method in Java/Android? y = myArray.indexOf(myObject); // y should equal x If not, can I loop through myArray and directly compare myObject to myArray.getJSONObject(i) without having to compare every element of the JSONObject. In other words, is myObject a copy or a reference to an element in myArray? Thanks.
accepted answer: http://stackoverflow.com/a/25311724

http://stackoverflow.com/comment/39496274
type: Comment
has text: The failing instruction is at offset 0x14 : b70034. That's an invokespecial of the method at constant pool index 0x34.
type: QuestionComment
comment on: http://stackoverflow.com/q/25332861
score: 0

http://stackoverflow.com/comment/39431063
comment on: http://stackoverflow.com/a/25299530
type: AnswerComment
has text: if you happen to know java well, do you mind if you help me with this question: http://stackoverflow.com/questions/25292465/how-do-i-insert-error-message-if-no-file-is-selected ??
score: 0
type: Comment

http://stackoverflow.com/a/25321816
has comment: http://stackoverflow.com/comment/39472584
has comment: http://stackoverflow.com/comment/39472573
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: in your oncreate you creating a textview with a resource id of R.id.k_k dis = (TextView) findViewById(R.id.k_k); and in your onClick method you are using setText with a resource id dis.setText(R.id.k_k); you can use of array for your description String[] descriptionArray={"this is button 1","this is button 2"}; //set onclick listener to your button button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { dis.setText(descriptionArray[0]); } }); button2.setOnClickListener(new OnClickListener() { public void onClick(View v) { dis.setText(descriptionArray[1]); } }); if you want to use the ids of your textview just make a TextView array TextView[] textViewArray={(TextView)findViewById(R.id.k_k),(TextView)findViewById(R.id.h_d) }; to set the text to dis TextView dis.setText(textViewArray[0].getText().toString());
accepted answer of: http://stackoverflow.com/q/25321773
answers question: http://stackoverflow.com/q/25321773
type: Answer
has comment: http://stackoverflow.com/comment/39472556
has comment: http://stackoverflow.com/comment/39472700
has comment: http://stackoverflow.com/comment/39472529

http://stackoverflow.com/q/25239227
tagged with: eclipse
type: Question
upvote count: 3
linked to: http://stackoverflow.com/q/981213
tagged with: intellij-idea
has body: I am using an application context file to setup SSL so as to connect to a queue using Spring JMS. I do this leveraging the MethodInvokingFactoryBean: <util:properties> src\main\resources\META-INF\spring\ssl\truststore.jks ****** src\main\resources\META-INF\spring\ssl\keystore.jks ****** jks </util:properties> This works within eclipse without any issue. However when run with IDEA it doesn't seem to find the keyStore file and hence can't connect causing an SSL Handshake failure. Caused by: java.io.FileNotFoundException: src\main\resources\META-INF\spring\ssl\keystore.jks (The system cannot find the path specified) The project is a standard maven project. Both Eclipse and IDEA are using the same JRE and have the resources folder included in the build path. Any help as to why this is happening is appreciated. Also if any other info is required let me know.
downvote count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/25239320
favorite count: 0
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25239320
has title: keystore.jks (for SSL) cannot be found when running project with Intellij IDEA, but is found by Eclipse
tagged with: java
answer count: 1

http://stackoverflow.com/q/25362228
has body: From my understanding, the requestFocus Method from the component class, does set the Cursor Style while hovering over a TextItem. (The One looking like an I) The application i am working with, does run in two different modes. The first mode is the normal application mode, and the cursor is free to change. The other on the help mode. It does contain a normal Cursor with a questionmark next to it. In this mode the Cursor is not allowed to change when hovering over any textItem, since it wont create any input. Is there any way to denie the Cursor change from happening, or to change the Default Cursor of a textitem temporarly?
type: Question
has answer: http://stackoverflow.com/a/25362939
type: UnansweredQuestion
score: 0
tagged with: java
has title: Change or denie Cursor Style change of requestFocus in Textfields
answer count: 1

http://stackoverflow.com/a/25570208
has body: If you keep track of all the entries while you write them, you should be able to add another entry containing the "links" (but how should a csv link to a file? Please specify what you try to achieve). If you intend to use the file under windows, you could create .lnk files programmatically; but this only works for one file per link. On unices, ZipOutputStream cannot create symlinks, but ZipFileSystem can.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25231685
score: 1
type: Answer

http://stackoverflow.com/a/25348291
type: Answer
answers question: http://stackoverflow.com/q/25346555
has body: It looks like it is not really a tokenising problem. In a fairly standard parser there are distinct stages, tokenising - breaking your input up into chunks ("method",""public","void","main","(",")") and parsing - taking the list of tokens and combining them according to the grammar of the language. It makes sense to keep these two separate don't try to do any grammar analysis in the tokenising stage. Programming languages are complex beast and parsing is a specialised task, there are special tools to do such a task. In the unix/C world there is lex/flex for tokenising and yacc/bison for parsing. In java there is JavaCC which I've used and probably many others. You will find it much easier to use these tool which generally generate code for the parser. This is especially worthwhile at the early stages when your grammar is flexible. It will be much easier to change a grammar definition file that try and debug some complex hand written code. Sometimes at a very late stage compilers will move to hand written code for the parser but these are complex state machines requiring a lot of theory to get right.
upvote count: 2
downvote count: 0
score: 2

http://stackoverflow.com/comment/39534362
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25356098
has text: @ElliottFrisch: to specify, I don't really need very detailed logging.

http://stackoverflow.com/q/25366958
has answer: http://stackoverflow.com/a/25367036
has body: I would like to replace the java launch icon: I am starting my application via spring and put my icon here inside: I am starting my gui like that my MainWindow extends a JFrame: /** * starts the GUI */ public void start() { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { Toolkit.getDefaultToolkit().getImage(MainWindow.class.getResource("icon.png")); makeLayout(); } }); } However the icon does not change. Any recommendation what I could do? I appreciate your answer!
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: icons
tagged with: swing
has answer: http://stackoverflow.com/a/25367084
has answer: http://stackoverflow.com/a/25367715
accepted answer: http://stackoverflow.com/a/25367715
type: Question
has title: Changing the launch icon
tagged with: java
possible better answer: http://stackoverflow.com/a/25367036

http://stackoverflow.com/a/25384490
has body: Solved my own problem - The value -2,147,483,648 is also the value used by the constant DatatypeConstants.FIELD_UNDEFINED so in order to make my date match with the date used by the web service I had to set my time field in the XMLGregorianCalendar like so GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); xmlDate.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); I was assuming that 0 would be equivalent to undefined, but that is not the case.
answers question: http://stackoverflow.com/q/25377944
score: 0
accepted answer of: http://stackoverflow.com/q/25377944
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/39317165
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25238334
type: QuestionComment
has text: I'll write you the answer

http://stackoverflow.com/q/25262890
tagged with: deobfuscation
has answer: http://stackoverflow.com/a/25263126
type: Question
has body: I have an obfuscated jar which is part of a deployed application in Tomcat on my machine. The jar consists of some weird code with same variable names. I used jshrink in order to decompile the code. static private org.apache.commons.logging.Log a; private org.springframework.context.MessageSource a; private org.springframework.context.support.MessageSourceAccessor a; static private LicenseBean a; static private ThreadLocal a; private javax.servlet.ServletContext a; private String a; public LicenseBean() { a = null; a = null; a = this; } Is it an issue with decompilation process? My question is how does JVM handle this if the decompilation process is correct?
has comment: http://stackoverflow.com/comment/39372431
tagged with: java
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/39362773
has comment: http://stackoverflow.com/comment/39363458
type: AnsweredQuestion
has title: Obfuscated code contains same member variable names
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25263096
upvote count: 1
has comment: http://stackoverflow.com/comment/39362862
score: 1
has comment: http://stackoverflow.com/comment/39368639
accepted answer: http://stackoverflow.com/a/25263126
has answer: http://stackoverflow.com/a/25263096
favorite count: 0

http://stackoverflow.com/q/25371058
has comment: http://stackoverflow.com/comment/39563301
type: Question
accepted answer: http://stackoverflow.com/a/25371223
has comment: http://stackoverflow.com/comment/39568098
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25371223
has comment: http://stackoverflow.com/comment/39567260
has body: I've attempted to extend EnumSet to implement Comparable in Eclipse. However, I'm fraught with errors, right from the beginning. Here's what I start with: package sets; import java.util.EnumSet; enum Suits{ SPADE, DIAMOND, CLUB, HEART; } class ExtendedEnumSet extends EnumSet&lt;Suits&gt; implements Comparable&lt;Suits&gt; { } (Issue 1) Defining an Explicit Constructor It immediately informs me: Implicit super constructor EnumSet&lt;Suits&gt;() is undefined for default constructor. Must define an explicit constructor. So, I follow the quick fix and it adds the following constructor: ExtendedEnumSet(Class&lt;Suits&gt; finalArg0, Enum[] finalArg1) { super(finalArg0, finalArg1); // TODO Auto-generated constructor stub } ...where it then informs me: The constructor EnumSet&lt;Suits&gt;(Class&lt;E&gt;, Enum[]) is not visible. I've tried changing the access modifier of both this class and this constructor to no avail. (Issue 2) Overriding Abstract Methods The next issue is when I decide to move on and fix the next error Eclipse reports: The type ExtendedEnumSet must implement the inherited abstract method AbstractCollection&lt;Suits&gt;.iterator(). Of course, this is just the tip of the iceberg. I once again employ the quick fix (add unimplemented methods) and it adds the following: @Override public int compareTo(Suits finalO) { // TODO Auto-generated method stub return 0; } @Override void addAll() { // TODO Auto-generated method stub } @Override void addRange(Suits finalArg0, Suits finalArg1) { // TODO Auto-generated method stub } @Override void complement() { // TODO Auto-generated method stub } @Override public Iterator&lt;Suits&gt; iterator() { // TODO Auto-generated method stub return null; } @Override public int size() { // TODO Auto-generated method stub return 0; } Where it then reports The method addAll() of type ExtendedEnumSet must override or implement a supertype method. It echoes this error for addRange and complement. I'm able to copy the addAll signature fr…
favorite count: 0
upvote count: 4
score: 4
tagged with: enumset
has comment: http://stackoverflow.com/comment/39563290
tagged with: constructor
tagged with: extends
possible better answer: http://stackoverflow.com/a/25371233
tagged with: subclass
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25371233
has comment: http://stackoverflow.com/comment/39566873
has comment: http://stackoverflow.com/comment/39563284
has title: How do you properly extend/subclass EnumSet in Java?

http://stackoverflow.com/comment/39594880
comment on: http://stackoverflow.com/q/25388044
score: 1
type: QuestionComment
type: Comment
has text: `Map<Enum<?>, Object> whatever`.

http://stackoverflow.com/comment/39349637
has text: I think I have to vote "too vague" also. Concurrency here would be about your processing, not the fact that IO is slow and you read data in chunks. So we need to know all tasks on your end, and probably all data too before we could say anything useful.
type: QuestionComment
comment on: http://stackoverflow.com/q/25255337
score: 0
type: Comment

http://stackoverflow.com/q/25367900
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25367911
favorite count: 0
has body: I have a date stored in my database as a string 14/08/2010. I want to parse it into a date in order to compare it with the current date. This is what I did but it doesn't compile I don't know why: try{ date = new SimpleDateFormat("dd/MMM/yyyy").parse(rs.getString(2)); System.out.println(rs.getString(2)); }catch(ParseException s){ s.printStackTrace(); } It prints this error: java.text.ParseException: Unparseable date: "14/08/2010" I tried changing the date format to dd/MM/yyyy but I have the same problem.
has comment: http://stackoverflow.com/comment/39557220
downvote count: 0
has answer: http://stackoverflow.com/a/25368035
answer count: 3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39556502
tagged with: date
has answer: http://stackoverflow.com/a/25368116
has title: parsing dates in java
type: Question
upvote count: 1

http://stackoverflow.com/q/25255287
tagged with: swing
has comment: http://stackoverflow.com/comment/39349353
favorite count: 0
has comment: http://stackoverflow.com/comment/39349364
has body: I am building a desktop application in Java. I want to get the mouse coordinates of a mouse click relative to an image which is within a JSrollPane. The JScrollPane, screenScroll, is contained in a JPanel with a BorderLayout. final JLabel screenLabel = new JLabel(new ImageIcon(image)); JScrollPane screenScroll = new JScrollPane(screenLabel); screenScroll.getViewport().setBackground(Color.white); screenLabel.addMouseListener(new MouseAdapter() { @Override //I override only one method for presentation public void mousePressed(MouseEvent e) { System.out.println("Y'all clicked at: "+e.getX() + ", " + e.getY()+" in the image."); } }); So here's the problem: the JPanel is larger than the image and the JScrollPane is taking up 100% of the JPanel (which looks nice, I'm happy about that) but the mousePressed event is giving me the coordinates relative to the JScrollPane/JPanel, not the image so the x coordinate is offset (even though the mouseListener was add to the JLabel containing the ImageIcon). Hope I explained that clearly. How can I modify above code to get coordinates relative to image?
has comment: http://stackoverflow.com/comment/39349346
type: AnsweredQuestion
score: 3
tagged with: imageicon
has title: Mouse coordinates relative to ImageIcon within a JScrollPane
has comment: http://stackoverflow.com/comment/39349379
tagged with: java
accepted answer: http://stackoverflow.com/a/25255494
type: Question
has comment: http://stackoverflow.com/comment/39349398
has answer: http://stackoverflow.com/a/25255494
tagged with: jscrollpane
upvote count: 3
has comment: http://stackoverflow.com/comment/39349366
tagged with: mouselistener
has comment: http://stackoverflow.com/comment/39349278
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25347360
has body: how to programmatically define init-parameters for a particular servlet? There does not seem to be anything like this in Tomcat API. org.apache.catalina.Context#addParameter is an equivalent of context-param But there does not seem to be anything like this for the servlet... Am I missing something or this was done for some reason? How to get around this? I cannot instantiate the servlet class either.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39519056
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39519081
score: 0
linked to: http://stackoverflow.com/q/13818244
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39518967
has title: Tomcat servlet "init-parameter" programmatically?
tagged with: servlets
type: Question

http://stackoverflow.com/comment/39332482
comment on: http://stackoverflow.com/q/25246571
type: Comment
type: QuestionComment
has text: this page https://developer.apple.com/library/prerelease/mac/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html talks about arrays and dictionary. Since Dictionary keys are unique, you could use a dummy value as value and work with keys only (like current HashSet implementation of Java)
score: 0

http://stackoverflow.com/comment/39521837
type: Comment
type: QuestionComment
score: 2
has text: Are you a developer familiar with Java and who develops the application that you're trying to use, or are you a simple end user. It the former, it should say something to you. If the latter, then report the bug to the person or company that gave/sold you this program.
comment on: http://stackoverflow.com/q/25349000

http://stackoverflow.com/a/25366632
has comment: http://stackoverflow.com/comment/39604520
has comment: http://stackoverflow.com/comment/39554822
has comment: http://stackoverflow.com/comment/39577631
has body: It looks like currently Some&lt;E extends Some&lt;E&gt;&gt; has no adventage over Some&lt;E extends Some&gt; According to article written in conjuction with Java Champions and creator of Java Generics FAQ: Article admits some possibilites/assumptions: since Enum is a generic class, we should only ever use it in conjunction with a type Java might become more strict and raw types could become illegal I think that Enum would have been sufficient. However, as Philip Wadler pointed out to me, since Enum is a generic class, we should only ever use it in conjunction with a type. In future, Java might become more strict and raw types could become illegal. We therefore have the choice of writing either Enum&lt;E extends Enum&lt;E&gt;&gt; or Enum&lt;E extends Enum&lt;?&gt;&gt;, of which the first option is more accurate. Even though the compiler currently does not show me a difference, I might see warnings in future, so I follow that idiom in my class as well
score: 0
has comment: http://stackoverflow.com/comment/39555352
answers question: http://stackoverflow.com/q/25365589
type: Answer

http://stackoverflow.com/comment/39421366
comment on: http://stackoverflow.com/q/25294237
has text: This question appears to be off-topic because it is about configuring GAE/Gmail, and not about programming or software development.
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/25293099
answer count: 2
accepted answer: http://stackoverflow.com/a/25293211
tagged with: java
has answer: http://stackoverflow.com/a/25293211
has comment: http://stackoverflow.com/comment/39418555
tagged with: string
has comment: http://stackoverflow.com/comment/39418506
favorite count: 0
type: Question
upvote count: 4
tagged with: split
has title: How to split a string with conditions
has comment: http://stackoverflow.com/comment/39418445
score: -2
possible better answer: http://stackoverflow.com/a/25293524
has comment: http://stackoverflow.com/comment/39434803
tagged with: regex
has body: When splitting a string, how can I make sure that if the delimiter is located between two characters then it won't be considered? // Input String string = "a,b,[c,d],e"; String[] split = string.split(","); // Output split[0] // "a" split[1] // "b" split[2] // "[c" split[3] // "d]" split[4] // "e" // Required split[0] // "a" split[1] // "b" split[2] // "[c,d]" split[3] // "e"
has comment: http://stackoverflow.com/comment/39420277
has answer: http://stackoverflow.com/a/25293524
downvote count: 6
has comment: http://stackoverflow.com/comment/39419166
type: AnsweredQuestion

http://stackoverflow.com/comment/39331603
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59115/discussion-between-afzalex-and-jon-skeet).
type: AnswerComment
comment on: http://stackoverflow.com/a/25245591
score: 0

http://stackoverflow.com/a/25295321
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/25295194
has body: Use Scanner.nextInt instead of manually parsing the String. This will handle variable length integers instead of where your code only handles two digit numbers. That is why it fails on 0-9 and 100. for( int i = 0; i &lt; total; i++ ) { gpa += scanner.nextInt(); } gpa = gpa / total; Edit: You may also want to add error handling to detect if a grade is below 0 or higher than 100, since those don't make sense in this context.
has comment: http://stackoverflow.com/comment/39423610
type: Answer
answers question: http://stackoverflow.com/q/25295194
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/25339856
upvote count: 2
has answer: http://stackoverflow.com/a/25364555
type: UnansweredQuestion
has body: To find synonym of a word, I have below code. There is a one problem with below source code; since word coming from user, I donot know its POS type. Therefore, how can I find IIndexWord of a word in case of I dont know its POS type? IIndexWord idxWord = dict . getIndexWord ("dog", POS. NOUN ); IWordID wordID = idxWord . getWordIDs ().get (0) ; // 1st meaning IWord word = dict . getWord ( wordID ); ISynset synset = word . getSynset (); for( IWord w : synset . getWords ()) System .out . println (w. getLemma ()); signature of my method looks like; void synonym(Strng word) I am going to use word in type of String in place of "dog" word but, at runtime, I dont know its POS type. I have second problem, before getting its synonym of a word, I want to check whether it is English word or not but JWI does not have a method like isEnglish() or isInDictionary(). How can I check a word whether it is english or not so that I would avoid to look for synonym of non-english word? ( eventually, improve performance)
tagged with: jwi
has answer: http://stackoverflow.com/a/43110944
score: 2
answer count: 2
has title: get synonym of word with JWI
tagged with: java
downvote count: 0
tagged with: wordnet
favorite count: 0
type: Question

cxf
tags question: http://stackoverflow.com/q/25337408
tags question: http://stackoverflow.com/q/25249893
tag name: cxf
type: Tag
tags question: http://stackoverflow.com/q/25376841
tags question: http://stackoverflow.com/q/25287626
tags question: http://stackoverflow.com/q/25357853
tags question: http://stackoverflow.com/q/25326689
tags question: http://stackoverflow.com/q/25289279

http://stackoverflow.com/comment/39388517
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25274003
has text: Thanks for your answer. We have internal penetration tests as part of PCI DSS and the auditor complains every time he finds an open network port with no authentication.

http://stackoverflow.com/a/25302483
answers question: http://stackoverflow.com/q/25302423
downvote count: 0
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25302423
type: AcceptedAnswer
has body: Calendar.DAY_OF_MONTH is a constant value, which points at the day of the month field. To get the actual value, you'd need to call: calendar.get(Calendar.DAY_OF_MONTH)
score: 4

http://stackoverflow.com/a/25361034
answers question: http://stackoverflow.com/q/25360677
score: 0
has body: Define a new interface so the listener can give feedback to the panel: public interface PointHolder { /** * Pass the new mouse location. * Pass null if the mouse left the panel */ public void setPoint(Point newpoint); } Let the MainPanel implement it: public MainPanel extends JPanel implements PointHolder { private Point lastpoint; @Override public void setPoint(Point newpoint) { lastpoint=newpoint; } public Point getPointerLocation() { return lastpoint; } } Add a constructor to CustomMouseListener: public CustomMouseListener { PointHolder holder; public CustomMouseListener(PointHolder holder) { this.holder=holder; } @Override public void mouseMoved(MouseEvent e) { holder.setPoint(e.getPoint()); System.out.println("MouseMove: " + e.getPoint().getX() + " , " + e.getPoint().getY()); } @Override public void mouseExited(MouseEvent e) { holder.setPoint(null); } } In your main: MainPanel mainPanel = new MainPanel(); CustomMouseListener listener=new CustomMouseListener(mainPanel); mainPanel.addMouseListener(listener); mainPanel.addMouseMotionListener(listener); From now on you can call mainPanel.getPointerLocation() which should return null in case the mouse is no longer over the panel.
type: Answer

http://stackoverflow.com/a/25303342
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25303119
answers question: http://stackoverflow.com/q/25303119
downvote count: 0
has body: You need to be use executeUpdate instead of executeQuery, but this will return the number of rows affected by this change, for example try (Connection connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd)) { String str=""; str="INSERT INTO login('uname', 'password') VALUES (?, ?)"; try (PreparedStatement pst=connection.prepareStatement(str)) { pst.setString(1, proid); pst.setString(2, proname); int count=pst.executeQuery(); System.out.println(count + " rows changed"); } } catch (SQLException exp) { exp.printStackTrace(); } If you want to then retrieve the values from the database, you need to use a select statement, for example... try (Connection connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd)) { String str=""; str="select * from login where name = ? and password = ?"; try (PreparedStatement pst=connection.prepareStatement(str)) { pst.setString(1, proid); pst.setString(2, proname); try (ResultSet rs = pst.executeQuery()) { while (rs.next() { //... Process each result... } } } } catch (SQLException exp) { exp.printStackTrace(); } Take a closer look at JDBC(TM) Database Access for more details...
score: 1
upvote count: 1

http://stackoverflow.com/comment/39469135
has text: Well I think the problem is that you want to run the ping jobs asynchronously (i.e. in parallel), but you want it to appear as if they are running synchronously (i.e. one after the other). What's wrong with just using one thread in your thread pool? Each job will happen sequentially then.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25319864
score: 0

http://stackoverflow.com/comment/39480874
type: Comment
type: QuestionComment
has text: @user3561614 the nature of your condition() function is the key. Are you expecting some user input? What are you "really" waiting for?
score: 0
comment on: http://stackoverflow.com/q/25325442

http://stackoverflow.com/comment/39523796
comment on: http://stackoverflow.com/a/25349677
has text: The format `MM/dd/yyyy hh:mm a` is not correct as per the input date string. It should be `dd/MM/yyyy hh:mm a`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25339939
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25302794
has comment: http://stackoverflow.com/comment/39518136
type: AcceptedAnswer
has body: If you set permissions for the file, you can then see it in your regular gmail acount ("Shared with me" section): Permission newPermission = new Permission(); newPermission.setValue("...your regular username...@gmail.com"); newPermission.setType("user"); newPermission.setRole("reader"); service.permissions().insert(file.getId(), newPermission).execute(); You can also use the unique url to get to the file: System.out.println("Title: " + uploadedDoc.getTitle()+ " "+ uploadedDoc.getAlternateLink()); The possible values for Type and Role are in Google Drive SDK docs: https://developers.google.com/drive/v2/reference/permissions/insert
has comment: http://stackoverflow.com/comment/39535551
type: Answer
answers question: http://stackoverflow.com/q/25302794
has comment: http://stackoverflow.com/comment/39517214
score: 3
upvote count: 3

http://stackoverflow.com/comment/39558199
score: 1
comment on: http://stackoverflow.com/q/25368339
type: Comment
type: QuestionComment
has text: @Khinsu - The OP's problem is that he never calls `setText` to update the text in the label. Nothing to do with repainting.

embedded-jetty
tag name: embedded-jetty
type: Tag
tags question: http://stackoverflow.com/q/25278350

http://stackoverflow.com/comment/39499053
type: AnswerComment
comment on: http://stackoverflow.com/a/25335662
has text: Nope. That didn't work. The problem is one level higher when setting the hostConfiguration.host property. Not on the HttpHost bean. I have individually created that one without problems outside the scope of the HttpClient bean definition.
type: Comment
score: 0

http://stackoverflow.com/q/25276093
has comment: http://stackoverflow.com/comment/39387351
tagged with: basicnamevaluepair
answer count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/39387466
type: AnsweredQuestion
has body: I have a class that builds a HttpResponse initializer. in one of the methods that should return the BasicNameValuePair I have to check if there is a entry in the list with key or name specified by String "name". public List&lt;BasicNameValuePair&gt; getPostPairs() { if(mPostPairs == null || mPostPairs.size() &lt; 1) { throw new NullPointerException(TAG + ": PostPairs is null or has no items in it!"); } //there is no hasName() or hasKey() method :( if(!mPostPairs.hasName("action")) { throw new IllegalArgumentException(TAG + ": There is no 'action' defined in the collections"); } return mPostPairs; } How to do this? if it is not possible with BasicNameValuePair, what would be the alternative? subclassing and adding the method? I need to use this for a HttpPost, which its setEntity only accepts this type: public UrlEncodedFormEntity (List&lt;? extends NameValuePair&gt; parameters)
score: 0
has comment: http://stackoverflow.com/comment/39387330
tagged with: http-post
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25276147
has comment: http://stackoverflow.com/comment/39387296
has answer: http://stackoverflow.com/a/25276147
type: Question
has comment: http://stackoverflow.com/comment/39387317
has title: How to check if List<BasicNameValuePair> contains a key?

http://stackoverflow.com/comment/39426476
type: Comment
type: QuestionComment
score: 0
has text: what's permgen (and how does it relate to eclipse) and how does it differ from heap?
comment on: http://stackoverflow.com/q/25297022

http://stackoverflow.com/a/38236110
downvote count: 1
answers question: http://stackoverflow.com/q/25271894
type: Answer
has body: Here's an alternative solution building on the accepted answer. Summary If you want to eliminate all production runtime cost from your service (even the relatively small one of picking up the XML artifacts which are then consumed by the #collect API), you can move the cost to the unit testing stage while still retaining 100% safety in prod of all entities being registered. See end of answer for code. Motivation &amp; Details This has several benefits as outlined below, though whether they are worth it is up to your use case. To me personally, it isn't whether any of these are ever going to be a problem -- it's more that given the option to avoid doing anything unnecessary in production (and deleting code from production paths), I would always take it, as long as it doesn't entail extra complexity, weird design costs, etc. In this case there are none. This is a text-book approach of moving runtime registration guarantees from prod to testing. Note that GAE instances may get restarted arbitrarily many times. Other considerations include how sensitive your app is to service startup times, how large the generated Reflection XML artifacts are (a function of your jar dependencies and impl details of the Reflection 3rd party library), and how efficiently the library parses them. While you can mitigate performance risk with multi-threading, google still charges you for CPU time used. The relative benefits of converting this to a unit test solution are: you eliminate the cost of parsing XML resources and reconstructing them into Reflection metadata each time your service is restarted (may happen arbitrarily many times) you eliminate the risk of changing your project JAR dependencies at some future times (dependencies tend to grown over time for non-trivial projects) and forgetting to re-assess new size of XML resources and their parsing; this may start adding more sizeable overhead to your service restart time gradually, which is hard to pinpoint but affects users (contribut…
score: -1
upvote count: 0

http://stackoverflow.com/q/25274036
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
answer count: 1
accepted answer: http://stackoverflow.com/a/25274128
type: Question
has title: cannot serialize FB object: Attempted to serialize java.lang.Class
has body: I try to parse a FB GraphObject to string: The code crashes here: Gson gson = new Gson(); FbDataToServer fbDataToServer = new FbDataToServer(); fbDataToServer.fbJson = gson.toJson(graphObject); this is the object: GraphObject{graphObjectClass=GraphObject, state={"id":"ddd","work":[{"employer":{"id":"dddddd","name":"dddd"},"start_date":"2013-09-19"},...[{"id":"209889829023118","name":"Landmark"}],"name":"Architecture"}],"paging":{"next":"https:\/\/graph.facebook.com\/v1.0\/685560152\/interests?access_token=CAAB3f7ftw4MBABHRExfffdteQ....5VvJwDc3onA3aq1gZDZD&amp;limit=25&amp;offset=25&amp;__after_id=enc_AewtXh6lIg-eFjFLaQHEZ....D9efdfdTcUk9aAORxo_iL_dNTLLP49q"}},"likes":{"data":[{"id":"593290680744992","category":"Spas\/beauty\/personal care","created_time":"2014-08-12T14:43:48+0000","category_list":[{"id":"200814353265561","name":"Spa"},{"id":"144873802247220","name":"Cosmetics &amp; Beauty Supply"}],"name":"Zen Spa"},{"id":"123194331045896","created_time":"2014-08-10T10:35:31+0000","category":"Health\/beauty","name":"SABON - סבון"},.....m{"id":"110344025691431","created_time":"2014-05-12T18:19:55+0000","category":"Local business","name":"סקי בגלבוע"},{"id":"240049663793","created_time":"2014-05-07T06:05:15+0000","category":"Tv channel","name":"חדשות10"},{"id":"154815284659799","created_time":"2014-05-02T13:59:52+0000","category":"Company","name":"חריש הירוקה"}],"paging":{"cursors":{"after":"MTU0O....NjU5Nzk5","before":"NTkzM...NzQ0OTky"},"next":"https:\/\/graph.facebook.com\/v1.0\/685560152\/likes?access_token=CAAB3f7ftw.....c3onA3aq1gZDZD&amp;limit=25&amp;after=MTU0....5Nzk5"}}}} with this error: 08-12 23:59:48.936: E/AndroidRuntime(409): FATAL EXCEPTION: main 08-12 23:59:48.936: E/AndroidRuntime(409): Process: com.example.manyexampleapp, PID: 409 08-12 23:59:48.936: E/AndroidRuntime(409): java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: com.facebook.model.GraphObject. Forgot to register a type adapter? 08-12 23:59:48.936: E/AndroidRu…
has answer: http://stackoverflow.com/a/25274128
linked to: http://stackoverflow.com/q/4802887
tagged with: android
tagged with: facebook
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25298582
has answer: http://stackoverflow.com/a/25299402
tagged with: filenotfoundexception
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/39429222
duplicate of: http://stackoverflow.com/q/19307622
type: UnansweredQuestion
tagged with: printwriter
has comment: http://stackoverflow.com/comment/39429245
upvote count: 6
has body: I am trying to create a new file and print data to said file using the printwriter class. My code looks like this File Fileright = new File("C:\\GamesnewOrder.txt"); PrintWriter pw = new PrintWriter(Fileright); for(int i =0;i&lt;=Games2.length-1;i++) { pw.println(Games2[i]); } pw.close(); I do have the main method with a throwsIOException. The error java.iofilenotfound exception keeps appearing at the line where I am creating the printwriter. So is the printwriter not creating the file?
has answer: http://stackoverflow.com/a/25298788
has title: how to use printwriter to create and write to a file
has comment: http://stackoverflow.com/comment/39429169
linked to: http://stackoverflow.com/q/11496700
has comment: http://stackoverflow.com/comment/39429214
tagged with: java
linked to: http://stackoverflow.com/q/19307622
tagged with: file
has comment: http://stackoverflow.com/comment/39429333
has comment: http://stackoverflow.com/comment/39429335
downvote count: 1
duplicate of: http://stackoverflow.com/q/11496700
favorite count: 0
type: Question

http://stackoverflow.com/q/25334395
tagged with: android-activity
type: Question
has answer: http://stackoverflow.com/a/25335108
tagged with: android-layout
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has body: I have already managed to store image files into parse. My question lies in retrieving it. In the sense that in the registration process users are asked to upload a profile picture, and where the image is later stored into parse as an image. My issue lies in retrieving it, where along with pulling information like name, headline, age for a potential match, I also want to be able to retrieve the picture. Below is the code, where I retrieve string information, but where I would want to retrieve files as well. public class MatchingActivity extends Activity { private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ListView usersListView; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.matching); logoutButton = (Button) findViewById(R.id.logoutButton); logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ParseUser.logOut(); Intent intent = new Intent(getApplicationContext(), LoginActivity.class); startActivity(intent); } }); setConversationsList(); } private void setConversationsList() { currentUserId = ParseUser.getCurrentUser().getObjectId(); names = new ArrayList&lt;String&gt;(); // String userActivitySelectionName = null; ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); // query.whereEqualTo("ActivityName",userActivitySelectionN…
has answer: http://stackoverflow.com/a/25338479
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39496613
has title: Retrieving files on Parse - Images
tagged with: java
has comment: http://stackoverflow.com/comment/39496972

http://stackoverflow.com/a/25386657
has comment: http://stackoverflow.com/comment/39592336
has body: The problem is actually caused by the open reader and writer. This should work: private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { String selected = (String) jList1.getSelectedValue(); BufferedReader reader = null; BufferedWriter writer = null; try { File passwords = new File("/users/aak7133/desktop/passwords.txt"); File temp = File.createTempFile("temp", ".txt", new File("/users/aak7133/desktop/")); reader = new BufferedReader(new FileReader(passwords)); writer = new BufferedWriter(new FileWriter(temp)); String line; System.out.println(selected); while ((line = reader.readLine()) != null) { // trim newline when comparing with lineToRemove // String trimmedLine = line.trim(); if (line.contains(selected)) { continue; } writer.write(line + "\n"); } if (passwords.canWrite()) { try { reader.close(); reader = null; } catch (IOException ignore) {} try { writer.close(); writer = null; } catch (IOException ignore) {} String path = passwords.getAbsolutePath(); passwords.delete(); boolean successful = temp.renameTo(new File(path)); System.out.println(successful); } } catch (Exception e) { } finally { if (reader != null) { try { reader.close(); } catch (IOException ignore) {} } if (writer != null) { try { writer.close(); } catch (IOException ignore) {} } } updateList(); clearFields(); }
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25385952
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25385952

http://stackoverflow.com/comment/39500723
score: 0
type: Comment
type: QuestionComment
has text: Can you change the Input/Output of each one to illustrate a single Input and the required Output after all steps.
comment on: http://stackoverflow.com/q/25336620

http://stackoverflow.com/comment/39576313
has text: try `String[].class`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25378144
score: 0

http://stackoverflow.com/comment/39452754
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25310904
type: Comment
has text: So, when you get an exception of type `ServiceException`, your handler isn't invoked? It just bubbles up to the `DispatcherServlet`?

http://stackoverflow.com/q/25379814
tagged with: java
has answer: http://stackoverflow.com/a/25479241
answer count: 1
score: 1
tagged with: eclipse
favorite count: 0
type: Question
tagged with: linux
has comment: http://stackoverflow.com/comment/39583884
has body: I get an error on Core.NATIVE_LIBRARY_NAME like so: Stacktrace: Exception in thread "main" java.lang.Error: Unresolved compilation problem: NATIVE_LIBRARY_NAME cannot be resolved or is not a field at MyVideoCap.main(MyVideoCap.java:7) I had settled the NativLibrary path at the following location. /home/.../OpenCV/opencv-2.4.5/build/lib I had followed the instruction on https://www.openshift.com/blogs/day-12-opencv-face-detection-for-java-developers but it doesn't creates any opencv2.4.9.jar file I am working on ubuntu 12 and eclipse with opencv api suppoert. so help me if you can to generating and building the jar file in the build directory in ubuntu. thanks in advance...
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39579072
tagged with: opencv
has title: 0 NATIVE_LIBRARY_NAME cannot be resolved or is not a field with Linux + Eclipse + Java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25479241

http://stackoverflow.com/a/25320422
answers question: http://stackoverflow.com/q/25320400
type: Answer
has comment: http://stackoverflow.com/comment/39469830
score: 0
has comment: http://stackoverflow.com/comment/39469818
has body: In Windows, the proper way to run a daemon is as a service. You can use procrun (part of Apache Commons Daemon) to install your Java program as a Windows service.

http://stackoverflow.com/a/25400491
answers question: http://stackoverflow.com/q/25386103
has body: Ok, here is a solution that uses a modified version of the font "Arial". I just deleted the "-" character. This is the code: private static final double[] xSeries = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; private static final double[] ySeries = { 0, -1.3, -2.0, -3.9, -5.6, -4.1, -5.3, -7.0, -3.9, -3.6, -1.1, 0 }; private static Font font; /** * The main method. * * @param args * the arguments */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Dive Profile"); shell.setSize(500, 400); shell.setLayout(new FillLayout()); display.loadFont("baz.ttf"); font = new Font(display, "Baz", 12, SWT.NONE); createChart(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); font.dispose(); } /** * create the chart. * * @param parent * The parent composite * @return The created chart */ static public Chart createChart(Composite parent) { // create a chart Chart chart = new Chart(parent, SWT.NONE); // set titles chart.getTitle().setText("Dive profile"); chart.getAxisSet().getXAxis(0).getTitle().setText("Time"); chart.getAxisSet().getYAxis(0).getTitle().setText("Depth"); chart.getAxisSet().getYAxis(0).getTick().setFont(font); chart.getAxisSet().getXAxis(0).getTick().setFont(font); // create scatter series ILineSeries series = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "series"); series.setLineStyle(LineStyle.SOLID); series.enableArea(true); series.setXSeries(xSeries); series.setYSeries(ySeries); // adjust the axis range chart.getAxisSet().adjustRange(); return chart; } And this is the font (you can create your own if you want): https://dl.dropboxusercontent.com/u/498403/baz.ttf Looks like this: Update As an alternative, you can always use JFreeChart in SWT using a ChartComposite. Her is a tutorial.
type: Answer
has comment: http://stackoverflow.com/comment/39621701
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25386103
has comment: http://stackoverflow.com/comment/39621877

http://stackoverflow.com/q/25344813
tagged with: rx-java
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25351105
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/25351105
type: Question
tagged with: android
has title: How can I implement the RxJava equivalent of INotifyPropertyChanged to make an Observable data model?
has comment: http://stackoverflow.com/comment/39514695
upvote count: 7
has body: I'm new to Java and new to Rx. I'm in at the deep end. I'm at very early stages of writing an android app that will use an MVC (Model-View-Controller) pattern and I'm experimenting with various ways of doing that, in particular RxJava. My idea is to make my Model an Observable and my View the Observer. The model (or a wrapper class) would then emit a new copy of the model each time its data changes. In .net I'd be thinking about using INotifyPropertyChanged. I think I need to implement a custom Observable - but how? There's plenty of documentation about how to convert collections into observables, but this doesn't fit my use-case as I don't have a collection - just a single item, the data model. Is there a way to do this? Remember I'm developing for Android so I can't use lambdas or anything fancy like that. [Update] Thanks to André Staltz's answer, I think I am off the starting blocks. I came up with this class: import rx.Observable; import rx.subjects.BehaviorSubject; public class ObservableModel&lt;TModel&gt; { private TModel modelData; private BehaviorSubject&lt;TModel&gt; modelStream; private boolean disposed = false; public ObservableModel(TModel modelData) { this.modelData = modelData; modelStream = BehaviorSubject.create(modelData); } public TModel getModelData() { if (disposed) { throw new UnsupportedOperationException("The object has been disposed"); } return modelData; } public void setModelData(TModel modelData) { if (disposed) { throw new UnsupportedOperationException("The object has been disposed"); } this.modelData = modelData; modelStream.onNext(this.modelData); } public Observable&lt;TModel&gt; getObservable() { return modelStream; } public void close() { modelStream.onCompleted(); modelStream = null; modelData = null; disposed = true; } }
has comment: http://stackoverflow.com/comment/50797784
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/39517231
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39515978

http://stackoverflow.com/a/25366818
answers question: http://stackoverflow.com/q/25365255
has comment: http://stackoverflow.com/comment/39554311
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39554475
has comment: http://stackoverflow.com/comment/39613924
has body: You'll find using streams more efficient. StreamRDF instances are sent triples as they are encountered. You can then rewrite as appropriate. Streams use the SPI level of jena -- nodes, triples and quads rather than statements, resources, etc -- which lack some niceities but for tasks like this they are ideal. Given what you've written I suspect writing out fixed N-Triples is what you want? Here's an example that will do that. All it does is 1) create a stream to output triples, 2) create a stream that waits for triples, corrects the object (if needed), and writes the results and 3) starts the whole parse going: final String wkt = "http://www.opengis.net/ont/geosparql#wktLiteral"; // Stream result to stdout final StreamRDF outputHandler = StreamRDFLib.writer(System.out); StreamRDF inputHandler = new StreamRDFBase() { @Override public void triple(Triple triple) { // Got a triple Node object = triple.getObject(); Node transformed; // if object is literal and has wkt type if (object.isLiteral() &amp;&amp; wkt.equals(object.getLiteralDatatypeURI())) { // Make a new node, suitably modified transformed = NodeFactory.createLiteral( "&lt;http://www.opengis.net/def/crs/EPSG/0/4326&gt; " + object.getLiteralLexicalForm(), object.getLiteralDatatype()); } else { // Do nothing transformed = object; } // Write out with corrected object outputHandler.triple( Triple.create( triple.getSubject(), triple.getPredicate(), transformed )); } }; // Parse RDFDataMgr.parse(inputHandler, RDFDataMgr.open("file"));
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25365255
has comment: http://stackoverflow.com/comment/39554355
has comment: http://stackoverflow.com/comment/39592453

http://stackoverflow.com/q/25315405
has body: I need some help creating a regex. The String value is: {"meta":[{"this_id":"111111"},{"this_id":"222222"},{"this_id":"333333"}],"type":"Account"} I want to create a list with all the ids, so element[0] would be 111111, element[1] would be 222222, for example. I would also like to at least be able to isolate the type and set that to a String. Can I receive some help on this? I tried to do String[] tokens = stringToBreakUp.split(":"); Then I was just focused on all the tokens after the 2nd element in that list. I am not sure how to search list based on a key. I think I need some sort of key. But I am new at doing these things.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25315459
upvote count: 0
has comment: http://stackoverflow.com/comment/39460116
accepted answer: http://stackoverflow.com/a/25315459
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/25315602
possible better answer: http://stackoverflow.com/a/25315602
tagged with: java
has answer: http://stackoverflow.com/a/25316353
tagged with: string
has comment: http://stackoverflow.com/comment/39460333
has title: Regex for entire words
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39460132
score: -2
tagged with: regex

http://stackoverflow.com/comment/39893345
comment on: http://stackoverflow.com/q/25296554
has text: @AndreaLigios if i had any say in it, i would. i'm interested in learning more about the security issue, though. can you tell me more?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/39383772
type: Comment
type: AnswerComment
has text: sorry, could you clarify why I am wrong? Your example is a proof that this is the case. Actually, I'm pointing out the same as @Dalton. Passing empty strings does not help in your case, so, pass null values instead. If you receive empty strings at the back end, simply do an if checking it out and set the attribute to null. If you are sending json to the backend, simply do not the field in the json and you'll receive a null in the maping
score: 0
comment on: http://stackoverflow.com/a/25270609

http://stackoverflow.com/a/25296659
has comment: http://stackoverflow.com/comment/39433566
type: Answer
answers question: http://stackoverflow.com/q/25294990
score: 0
has body: Your option 3 sounds reasonable. If you want to cleanly detect when all requests have completed, one simple approach is to create a new SettableFuture to represent completion. When your callback tries to take the next request from the queue, and finds it to be empty, you can call set() on the future to notify anything that's waiting for all requests to complete. Propagating exceptions from the individual request futures is left as an exercise for the reader.

http://stackoverflow.com/comment/39424897
type: Comment
has text: Re: "no correctly written program would use String..." There's a difference between "correct" and "reasonable" or "pretty" or even "remotely sane." A _correct_ program is a program that does what it's supposed to do. It would be trivially easy to take a correct program that uses naked `Object` instances as locks and change it into a correct program that uses `String` instances as locks.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25296023

catch-block
tag name: catch-block
type: Tag
tags question: http://stackoverflow.com/q/25349243

http://stackoverflow.com/comment/89735133
type: Comment
has text: If i close the dataSource rather closing the connection by calling shutdown() what will the impact of that?
type: AnswerComment
comment on: http://stackoverflow.com/a/25367496
score: 1

http://stackoverflow.com/comment/39382626
comment on: http://stackoverflow.com/a/25273084
has text: Please use `e.getStackTrace()` in your `catch`s, so you'll know where exactly the NPE is thrown. (And eventually, edit your initial post to include the full stacktrace)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39577954
comment on: http://stackoverflow.com/q/25243345
score: 2
has text: If you're using Oracle JDBC and BIRT 4.3 or newer, you may be hitting a BIRT bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=407299
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25354112
has comment: http://stackoverflow.com/comment/39530983
upvote count: 5
linked to: http://stackoverflow.com/q/11126866
has title: Instance-controlled classes and multithreading
has body: In Effective Java Chapter 2, Item 1 Bloch suggests to consider static factory methods instead of constructors to initalize an object. On of the benefits he mentions is that this pattern allows classes to return the same object from repeated invocations: The ability of static factory methods to return the same object from repeated invocations allows classes to maintain strict control over what instances exist at any time. Classes that do this are said to be instance-controlled. There are several reasons to write instance-controlled classes. Instance control allows a class to guarantee that it is a singleton (Item 3) or noninstantiable (Item 4). Also, it allows an immutable class (Item 15) to make the guarantee that no two equal instances exist: a.equals(b) if and only if a==b. How would this pattern work in a multi threaded environment? For example, I have an immutable class that should be instance-controlled because only one entity with the given ID can exist at a time: public class Entity { private final UUID entityId; private static final Map&lt;UUID, Entity&gt; entities = new HashMap&lt;UUID, Entity&gt;(); private Entity(UUID entityId) { this.entityId = entityId; } public static Entity newInstance(UUID entityId) { Entity entity = entities.get(entityId); if (entity == null) { entity = new Entity(entityId); entities.put(entityId, entity); } return entity; } } What would happen if I call newInstance() from separated threads? How can I make this class thread-safe?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/47767005
accepted answer: http://stackoverflow.com/a/25354133
answer count: 2
score: 5
linked to: http://stackoverflow.com/q/11165852
tagged with: multiton
has answer: http://stackoverflow.com/a/25354133
tagged with: java
tagged with: multithreading
downvote count: 0
has comment: http://stackoverflow.com/comment/39553874
has comment: http://stackoverflow.com/comment/39530662
possible better answer: http://stackoverflow.com/a/25354210
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25354210

http://stackoverflow.com/comment/39354450
comment on: http://stackoverflow.com/a/25244627
has text: @user3505725 well, I think you will import only necessary classes, not the entire .jar. Where is the problem in that? In this particular case, you could use another method, but do you really want to write **every** 10-liner instead of use an existing method? How long will you write it - half an hour? Five minutes? Why not know the libraries and do this in 10 seconds? Where is the point in writing an existing snippet once again?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39367376
type: Comment
comment on: http://stackoverflow.com/a/25251563
type: AnswerComment
score: 0
has text: Basically the user is going to select an "expense type" and also put in an amount and a date for the expense. So there will be two values for each "expense type", the amount and the date.

http://stackoverflow.com/comment/39526518
score: 2
comment on: http://stackoverflow.com/q/25351490
has text: Could you try with a newer version of java, say 8?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39408460
type: QuestionComment
comment on: http://stackoverflow.com/q/25287619
has text: Can you post what data you get within "json" please from this line: jObj = new JSONObject(json); My guess is that would you should have is jObj = new JSONObject("{"json"}"); You should have the curly braces returned in the php though
score: 0
type: Comment

http://stackoverflow.com/a/25252053
type: Answer
answers question: http://stackoverflow.com/q/25251945
has body: Yes you can. It is called class shadowing. But I would advice against it most of the times. You only need to let the jvm load your class before the plugin class.
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39393385
has text: Like this: http://pastebin.com/R7yV3yBG You can then no longer access the variables in a static way (e.g. Skeleton.sY), but you have to define getters as in the example.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25279463
type: Comment

http://stackoverflow.com/comment/39389282
comment on: http://stackoverflow.com/a/25277179
score: 0
has text: as per OP `displays= Wed Aug 7 18:06:40 EDT 46475`
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40429883
score: 0
type: Comment
type: QuestionComment
has text: @hectorg87, not yet fri
comment on: http://stackoverflow.com/q/25257128

http://stackoverflow.com/comment/39338897
type: Comment
type: AnswerComment
has text: Thank you everyone who answered my question :). I accidentally deleted the line to initialize my ListView thats why it stopped working lol thank you again for your help ^_^
score: 0
comment on: http://stackoverflow.com/a/25248972

http://stackoverflow.com/a/25276233
has comment: http://stackoverflow.com/comment/39387564
has body: The Problem lies with your code: The if block is never executed, as the largest palindrome obtained by multiplying two 3-digit numbers is 906609 which is obtained when 993 is multiplied by 913 The previous solution given below is a wrong one and I am sorry about that: package stackoverflow; public class Palindrome { public static void main(String[] args) { int palindrome = 0; for(int i = 101; i &lt; 999; i++) { for(int j=101; j&lt;999; j++) { System.out.println("inside for loop"); int num = i * 999; String numString = Integer.toString(num); String numString_reverse = new StringBuilder(numString).reverse().toString(); if(numString.equals(numString_reverse)) { System.out.println("inside if block"); palindrome = Integer.parseInt(numString); System.out.println(palindrome); break; } } } } } And Here is the true solution: package stackoverflow; public class Palindrome2 { public static void main(String[] args) { int palindrome; for(int i=900; i&lt;999; i++) { for(int j=901; j&lt;999; j++) { int value=i*j; String result=Integer.toString(value); String revResult=new StringBuffer(result).reverse().toString(); if(result.equals(revResult)) { System.out.println(i); System.out.println(j); palindrome=Integer.parseInt(result); System.out.println(palindrome); } } } } }
score: 0
has comment: http://stackoverflow.com/comment/39387655
has comment: http://stackoverflow.com/comment/39387610
has comment: http://stackoverflow.com/comment/39387571
has comment: http://stackoverflow.com/comment/39387532
upvote count: 1
has comment: http://stackoverflow.com/comment/39387549
answers question: http://stackoverflow.com/q/25276098
downvote count: 1
has comment: http://stackoverflow.com/comment/39387542
has comment: http://stackoverflow.com/comment/39387632
type: Answer
has comment: http://stackoverflow.com/comment/39387614
has comment: http://stackoverflow.com/comment/39387630
has comment: http://stackoverflow.com/comment/39387612

http://stackoverflow.com/comment/39488698
comment on: http://stackoverflow.com/q/25330187
score: 1
type: QuestionComment
has text: A stack trace would be useful, if you could add it to your question.
type: Comment

http://stackoverflow.com/comment/39497534
has text: Don't have any error now in the code, but the score is always -1
type: Comment
comment on: http://stackoverflow.com/a/25334536
score: 0
type: AnswerComment

http://stackoverflow.com/a/36109027
has body: My data format is : "array": [ { "id": "1", "name": "peter", "text": "hie peter" }, { "id": "5", "name": "rina", "text": "hey rina" }, { "id": "12", "name": "parx", "text": "hey bro" } ] I tried this one and it works : Object obj = parser.parse(new FileReader("/home/hp2/json.json")); JSONObject jsonObject = (JSONObject) obj; JSONArray array = (JSONArray) jsonObject.get("array"); // it should be any array name Iterator&lt;Object&gt; iterator = array.iterator(); while (iterator.hasNext()) { System.out.println("if iterator have next element " + iterator.next()); }
upvote count: 0
answers question: http://stackoverflow.com/q/25346512
has comment: http://stackoverflow.com/comment/71604456
downvote count: 1
type: Answer
score: -1

http://stackoverflow.com/a/25354924
answers question: http://stackoverflow.com/q/25354465
accepted answer of: http://stackoverflow.com/q/25354465
type: AcceptedAnswer
has body: Picking the groups apart in Scala (which uses Java regex): scala&gt; val r = """(\w{3})-(\p{Alpha})(\d+)-(\w+) \(\d+\)|Conf (\w{3}) (\w+) (\p{Alpha})(\d+)|(.+)""".r scala&gt; def f(s: String) = s match { case r(city, bld, flr, name, _*) if city != null =&gt; s"$name ($city $bld${flr.toInt})" | case r(_, _, _, _, city, name, bld, flr, _*) if city != null =&gt; s"$name ($city $bld${flr.toInt})" case x =&gt; x } f: (s: String)String scala&gt; f("Conf DFW Alpha D04") res8: String = Alpha (DFW D4) scala&gt; f("DFW-D04-Alpha (10)") res9: String = Alpha (DFW D4) scala&gt; f("Something else") res10: String = Something else Where named groups comes in handy: scala&gt; val r = """(?&lt;city&gt;\w{3})-(?&lt;bld&gt;\p{Alpha}\d+)-(?&lt;name&gt;\w+) \(\d+\)|Conf (?&lt;city2&gt;\w{3}) (?&lt;name2&gt;\w+) (?&lt;bld2&gt;\p{Alpha}\d+)|(.+)""".r r: scala.util.matching.Regex = (?&lt;city&gt;\w{3})-(?&lt;bld&gt;\p{Alpha}\d+)-(?&lt;name&gt;\w+) \(\d+\)|Conf (?&lt;city2&gt;\w{3}) (?&lt;name2&gt;\w+) (?&lt;bld2&gt;\p{Alpha}\d+)|(.+) scala&gt; val m = r.pattern matcher "DFW-D04-Alpha (10)" m: java.util.regex.Matcher = java.util.regex.Matcher[pattern=(?&lt;city&gt;\w{3})-(?&lt;bld&gt;\p{Alpha}\d+)-(?&lt;name&gt;\w+) \(\d+\)|Conf (?&lt;city2&gt;\w{3}) (?&lt;name2&gt;\w+) (?&lt;bld2&gt;\p{Alpha}\d+)|(.+) region=0,18 lastmatch=] scala&gt; if (m.matches &amp;&amp; m.group("city") != null) "%s (%s %s)".format(m.group("name"), m.group("city"), m.group("bld")) res16: Any = Alpha (DFW D04) Or add a suffix to the group names if needed: scala&gt; val gs = List("name", "city", "bld") gs: List[String] = List(name, city, bld) scala&gt; val r = """(?&lt;city&gt;\w{3})-(?&lt;bld&gt;\p{Alpha}\d+)-(?&lt;name&gt;\w+) \(\d+\)|Conf (?&lt;city2&gt;\w{3}) (?&lt;name2&gt;\w+) (?&lt;bld2&gt;\p{Alpha}\d+)|(?&lt;other&gt;.+)""".r r: scala.util.matching.Regex = (?&lt;city&gt;\w{3})-(?&lt;bld&gt;\p{Alpha}\d+)-(?&lt;name&gt;\w+) \(\d+\)|Conf (?&lt;city2&gt;\w{3}) (?&lt;name2&gt;\w+) (?&lt;bld2&gt;\p{Alpha}\d+)|(?&lt;oth…
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/39632272
has text: @immibis yes, I meant its own, non-inherited methods.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25355041
type: QuestionComment

http://stackoverflow.com/comment/39573719
score: 0
type: AnswerComment
has text: @greppz Seriously going to need more context, may be a running example with test data would help...
comment on: http://stackoverflow.com/a/25376529
type: Comment

http://stackoverflow.com/q/25356401
has comment: http://stackoverflow.com/comment/39535598
tagged with: swing
has comment: http://stackoverflow.com/comment/39535310
has comment: http://stackoverflow.com/comment/39535806
type: Question
has answer: http://stackoverflow.com/a/25356412
has comment: http://stackoverflow.com/comment/39535255
has answer: http://stackoverflow.com/a/25357017
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39535956
has comment: http://stackoverflow.com/comment/39535030
has comment: http://stackoverflow.com/comment/39535474
has title: Assign int value to JCheckBox
tagged with: integer
has answer: http://stackoverflow.com/a/25356426
tagged with: boolean
score: 0
has body: Im trying to set a value to five different JCheckbox's but having a little trouble doing so. I have set the checkbox's to a boolean type data within the main class before any methods: boolean s1 = solarPanel.isSelected(); boolean s2 = ducted.isSelected(); boolean s3 = homeTheatre.isSelected(); boolean s4 = spa.isSelected(); boolean s5 = swimming.isSelected(); Now im trying to assign an int value to each of the checkbox through the function: private void options() { if (s1 == true){ s1 = 7500; } if (s2 == true){ s2 = 5000; } if (s3 == true){ s3 = 8000; } if (s4 == true){ s4 = 3500; } if (s5 == true){ s5 = 12000; } } But getting an 'incompatible types' error. From here I will be calling the 'options' function within another function so a final price can be calculated. Thanks in Advance!
has comment: http://stackoverflow.com/comment/39534859
answer count: 3
tagged with: java
tagged with: user-interface

http://stackoverflow.com/q/25323202
has comment: http://stackoverflow.com/comment/39475267
favorite count: 0
has comment: http://stackoverflow.com/comment/39474759
type: Question
has comment: http://stackoverflow.com/comment/39474976
tagged with: c#
has comment: http://stackoverflow.com/comment/39474942
has comment: http://stackoverflow.com/comment/39479510
has comment: http://stackoverflow.com/comment/39500294
downvote count: 17
has comment: http://stackoverflow.com/comment/39474855
has comment: http://stackoverflow.com/comment/39475200
has answer: http://stackoverflow.com/a/25323426
accepted answer: http://stackoverflow.com/a/25323426
has comment: http://stackoverflow.com/comment/39474802
has comment: http://stackoverflow.com/comment/39475193
has comment: http://stackoverflow.com/comment/39475182
has comment: http://stackoverflow.com/comment/39474829
tagged with: php
has comment: http://stackoverflow.com/comment/39475029
has title: C++ and PHP vs C# and Java - unequal results
answer count: 4
has comment: http://stackoverflow.com/comment/39475239
has answer: http://stackoverflow.com/a/25323589
tagged with: c++
has comment: http://stackoverflow.com/comment/39475096
type: AnsweredQuestion
tagged with: expression-evaluation
has body: I found something a little strange in C# and Java. Let's look at this C++ code: #include &lt;iostream&gt; using namespace std; class Simple { public: static int f() { X = X + 10; return 1; } static int X; }; int Simple::X = 0; int main() { Simple::X += Simple::f(); printf("X = %d", Simple::X); return 0; } In a console you will see X = 11 (Look at the result here - IdeOne C++). Now let's look at the same code on C#: class Program { static int x = 0; static int f() { x = x + 10; return 1; } public static void Main() { x += f(); System.Console.WriteLine(x); } } In a console you will see 1 (not 11!) (look at the result here - IdeOne C# I know what you thinking now - "How that is possible?", but let's go to the following code. Java code: import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { static int X = 0; static int f() { X = X + 10; return 1; } public static void main (String[] args) throws java.lang.Exception { Formatter f = new Formatter(); f.format("X = %d", X += f()); System.out.println(f.toString()); } } Result the same as in C# (X = 1, look at the result here). And for the last time let's look at the PHP code: &lt;?php class Simple { public static $X = 0; public static function f() { self::$X = self::$X + 10; return 1; } } $simple = new Simple(); echo "X = " . $simple::$X += $simple::f(); ?&gt; Result is 11 (look at the result here). I have a little theory - these languages (C# and Java) are making a local copy of static variable X on the stack (are they ignoring the static keyword?). And that is reason why result in those languages is 1. Is somebody here, who have other versions?
has comment: http://stackoverflow.com/comment/39509564
has comment: http://stackoverflow.com/comment/39474835
tagged with: java
has comment: http://stackoverflow.com/comment/39474780
has answer: http://stackoverflow.com/a/25323699
score: 29
has comment: http://stackoverflow.com/comment/39475166
has comment: http://stackoverflow.com/comment/39475631
has comment: http://stackoverflow.com/comment/39475110
has comment: http://stackoverflow.com/comment/39475074
has answer: http://stackoverflow.com/a/25324088
possible better answer: http://stackoverflow.com/a/25324088
has comment: http://stackoverflow.com/comment/39483676
upvote count: 46

http://stackoverflow.com/q/25294836
type: Question
has answer: http://stackoverflow.com/a/25294868
has comment: http://stackoverflow.com/comment/39422421
has comment: http://stackoverflow.com/comment/39422554
has comment: http://stackoverflow.com/comment/39421924
answer count: 6
has comment: http://stackoverflow.com/comment/39423960
has answer: http://stackoverflow.com/a/25294969
has body: I know that by default, String varaibles are immutable in Java. But is there some way to set a String variable, or some special way (when passing said String variable) to make it mutable? Or at least temporarily allow that Stirng to be changed? I realize that I can change the value of a String by just assigning the modified immutable variable to the original variable, like show: String A = "Test"; A.toUpperCase(); //will make A upper case, but not save the new upper case string to a variable Sring A = A.toUpperCase; //will give me TEST and save it to A, replacing A Is there some way to tell Java "Hey, for this one String specifically, treat it as mutable"?
has comment: http://stackoverflow.com/comment/39422570
tagged with: immutability
has answer: http://stackoverflow.com/a/25294940
type: AnsweredQuestion
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39422490
accepted answer: http://stackoverflow.com/a/25294868
tagged with: java
linked to: http://stackoverflow.com/q/11146255
has comment: http://stackoverflow.com/comment/39421976
has answer: http://stackoverflow.com/a/25295111
has answer: http://stackoverflow.com/a/25294921
has comment: http://stackoverflow.com/comment/39421921
possible better answer: http://stackoverflow.com/a/25294921
tagged with: string
has comment: http://stackoverflow.com/comment/39423912
has comment: http://stackoverflow.com/comment/39421938
has comment: http://stackoverflow.com/comment/39421929
has title: Is there some way to pass a String to a method as mutable?
has answer: http://stackoverflow.com/a/25294941
has comment: http://stackoverflow.com/comment/39421958
favorite count: 0

http://stackoverflow.com/comment/56399196
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25344809
has text: With regards to copying to the output stream, the following might be of value too: http://stackoverflow.com/a/23252476/640539
type: Comment

http://stackoverflow.com/q/25375272
tagged with: java
has comment: http://stackoverflow.com/comment/39571293
score: 1
linked to: http://stackoverflow.com/q/11700320
has comment: http://stackoverflow.com/comment/39571175
type: Question
has comment: http://stackoverflow.com/comment/39571083
has comment: http://stackoverflow.com/comment/39570904
has comment: http://stackoverflow.com/comment/39592042
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25375426
answer count: 1
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39571338
favorite count: 0
has body: I was asked this question somewhere : In String s=new String("abc"); how to programmatically prove that the String literal "abc" will be added to the String pool? PS: I know the JLS says - All String literals(Strings enclosed between "") are added to the String pool. Also, I looked at the Byte code generated, but in Byte code , I can see only Class Constants pool not Strings Constant pool.
has comment: http://stackoverflow.com/comment/39571280
has title: How to programmatically prove that String s = new String("abc") adds the literal String "abc" to the String pool
has comment: http://stackoverflow.com/comment/39571346

http://stackoverflow.com/q/25274688
answer count: 4
accepted answer: http://stackoverflow.com/a/25312116
has answer: http://stackoverflow.com/a/25296304
type: Question
possible better answer: http://stackoverflow.com/a/25295953
tagged with: ejb
has answer: http://stackoverflow.com/a/25295953
linked to: http://stackoverflow.com/q/11487647
tagged with: glassfish
has body: I have EJB bean Interface: package com.xlab.ice.ejb.sessionbean; import javax.ejb.Remote; @Remote public interface Session { public String getMessage(); } Bean: package com.xlab.ice.ejb.sessionbean; import javax.ejb.Stateless; @Stateless public class SessionBean implements Session { public SessionBean() { } public String getMessage() { return "Hello!"; } } It is successfully deployed into Glassfhish 4. But I cannot access it via simple client: package com.xlab.ice.ejb.sessionbean; import javax.ejb.EJB; public class Client { @EJB private static SessionBean sessionBean; public void getMsg() { System.out.print(sessionBean.getMessage()); } public static void main(String[] args) { new Client().getMsg(); } } When I'm trying to run it via: appclient -client SessionBeanClient.jar I'm getting error. Here is stack trace - http://pastebin.com/JuHRcQp5 What I'm doing wrong?
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25312116
linked to: http://stackoverflow.com/q/3195365
tagged with: java
has answer: http://stackoverflow.com/a/25279422
has title: EJB. Cannot inject session bean

http://stackoverflow.com/comment/39535366
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25356597
has text: Its there, see https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/os/UserHandle.java

http://stackoverflow.com/q/25386414
has title: Dependency Injection using @produce in Tomcat 7 [Injectin object not found]
upvote count: 1
has comment: http://stackoverflow.com/comment/43749390
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39591966
tagged with: cdi
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/39591847
answer count: 0
has comment: http://stackoverflow.com/comment/39594024
type: UnansweredQuestion
has body: I asked this question before,but I have done some major changes from my previous code.I am trying to Inject an object in web-app using the @Inject annotation from Java EE 6.I am injecting a String object using the @Produce,further I am using @Qualifier.I am running this in Tomcat 7,which I read that doesnt support CDI as it is mainly a servlet container and not a full fledge Java EE container,So i tried adding the Weld into it. Class where I inject using @Inject @Path("login") public class Login{ @Inject @Config private String name; //do somthing with String name } My Producer Class import javax.enterprise.inject.Produces; public class ConfigurationFactory { @Produces @Config public String getName() { return "XYZ"; } } I used a Qualifier @Target( { TYPE, METHOD, PARAMETER, FIELD }) @Retention(RUNTIME) @Qualifier public @interface Config { } I read in many post in stackoverflow and outside materials and Java EE 6 specifications.I followed this structure but I still get this error org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee Since tomcat doesn't support CDI, I added the weld using this POM depedency This is my Pom.xml org.jboss.weld.servlet weld-servlet 1.1.10.Final javax.servlet javax.servlet-api 3.0.1 provided I added an empty Beans.xml file under the WEB-INF directory as suggested in the oracle site. I am not sure why this occurred,so I tried to analyze the problem and added a empty bean.xml file in under the WEB-INF directory and also I tried binding the resource file "ConfigurationFactory" using astractBinder .Any suggestion?
score: 1
tagged with: java-ee-6
tagged with: java
downvote count: 0

http://stackoverflow.com/comment/39495151
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25333690
has text: "Questions asking for homework help must include a summary of the work you've done so far to solve the problem, and a description of the difficulty you are having solving it."
score: 1

http://stackoverflow.com/a/25337324
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25337241
has body: From java.text.SimpleDateFormat: Letter Date or Time Component Presentation Examples y Year Year 1996; 96 Y Week year Year 2009; 09 You are asking for Week year instead of year in your call to SimpleDateFormat()

http://stackoverflow.com/comment/39364409
score: 0
type: Comment
type: AnswerComment
has text: Uhm... if I understand you, you're suggesting to move the generic type declaration to the class declaration instead of using a particular argument type, is that right?
comment on: http://stackoverflow.com/a/25263713

http://stackoverflow.com/a/48442472
answers question: http://stackoverflow.com/q/25272543
type: Answer
has body: In my case, spring threw this because i forgot to make an inner class static. When you found that it doesnt help even adding a no-arg constructor, please check your modifier.
has comment: http://stackoverflow.com/comment/115291886
score: 15
upvote count: 15
downvote count: 0

bit
tag name: bit
tags question: http://stackoverflow.com/q/25366168
tags question: http://stackoverflow.com/q/25245534
type: Tag

http://stackoverflow.com/q/25274949
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25276314
downvote count: 0
upvote count: 1
has body: I am working on Maven RPM Plugin and I have my directory structure as below dir1 dir2 dir3 src pom.xml dir1,dir2,dir3 directories contain my custom files and the src directory has my Java source code. I want to create the Jar file by building the Java application and then bundle everything to an RPM(dir1,dir2,dir3,src, jar file generated). I have tried the below 4.0.0 xyz abc 0.0.1-SNAPSHOT jar xyz http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <build.number>1</build.number> <maven.rpm.plugin.version>2.0.1</maven.rpm.plugin.version> rpm true org.codehaus.mojo rpm-maven-plugin ${maven.rpm.plugin.version} generate-rpm rpm ${project.artifactId} XYZ ${build.number} DOC/COD /tmp com.googlecode.json-simple json-simple 1.1 junit junit 3.8.1 test The target directory is being created with the JAR file of the Java source code but the RPM is not getting created. It throws the below error Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (generate-rpm) on project xyz: RPM query for default vendor returned: '127' executing '/bin/sh -c rpm -E '%{_host_vendor}'' -> [Help 1] Please let me know if I am in the right direction and how to proceed on this.
tagged with: maven-2
favorite count: 0
type: Question
tagged with: rpm
has comment: http://stackoverflow.com/comment/39409076
type: UnansweredQuestion
tagged with: jar
has comment: http://stackoverflow.com/comment/39388557
tagged with: maven
has comment: http://stackoverflow.com/comment/39386181
has comment: http://stackoverflow.com/comment/39408396
has comment: http://stackoverflow.com/comment/39412498
has comment: http://stackoverflow.com/comment/39389458
has comment: http://stackoverflow.com/comment/39406552
has comment: http://stackoverflow.com/comment/39415038
has title: Maven - generate an RPM and Jar using a single POM file
score: 1
has comment: http://stackoverflow.com/comment/39388679

http://stackoverflow.com/q/25372649
linked to: http://stackoverflow.com/q/2163544
tagged with: swing
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39569394
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39569267
downvote count: 0
tagged with: graphics2d
tagged with: java
has answer: http://stackoverflow.com/a/25374569
accepted answer: http://stackoverflow.com/a/25374569
has comment: http://stackoverflow.com/comment/39596775
answer count: 1
has body: Can you suggest a method of identifying the source of a rendering error from a debugger? Misko Hevery classifies bugs into three categories: Logical Wiring Rendering Its clear to me that my problem is a rendering bug. I have a Swing application with a Panel that contains multiple layers. Rendering all the layers can take a significant amount of time so the application uses a thread pool to render layers and tiles from layers into BufferedImages. When it comes time for the Event Dispatch Thread to render the panel the most-recently rendered BufferedImages are drawn to the screen. This setup has performed adequately. A new feature requires that a certain layer type support transparency. Something, somewhere isn't preserving the transparency. The error could be in a number of places, possibly in the implementation of the objects to be rendered, the error could possibly be in the offline rendering thread implementation. Its possible that the many BufferedImages aren't combined together correctly in the EDT rendering code. I'm not asking anyone to look at the code and tell me where the error is. What I want to know is what techniques people have found particularly effective in troubleshooting a Graphics2D rendering issue. I'm a big supporter of unit tests but I'd prefer to start with another technique. Is there a method or trick to visually inspect a BufferedImage or Graphics2D object from the debugger? In the Netbeans Variables and Watches windows Netbeans sometimes uses PropertyEditors to display variable values. In this example image the value of foregroundColor and backgroundColor are shown as small swatches of the Color's value. Is there an easy way to add/enable a Netbeans PropertyEditor which would display the contents of a BufferedImage? I could temporarily sprinkle the code with method calls to write the various BufferedImages encountered to the disk such that they could then be inspected offline. It might work but it would be tediious to match the file on disk …
favorite count: 0
type: Question
tagged with: debugging
has title: How can I effectively find a Graphics2D rendering error?

http://stackoverflow.com/a/25340903
has body: You need to get access to your current Hibernate session and use doWork to execute a native SQL command: session.doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { Statement s = null; try { s = conn.createStatement(); s.executeUpdate("SET work_mem TO '100MB';"); } finally { s.close(); } } }); And then you can continue with your Hibernate query.
type: Answer
answers question: http://stackoverflow.com/q/25339608
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/116446601
has text: @AbhishekNayak If I used your updated solution for One-to-one mapping. The Foreign key `company_id` is not getting inserted inside `Address` table. Can you help.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25376602

http://stackoverflow.com/comment/39512593
type: Comment
score: 4
has text: Investigating Maven. First problem: I can create a Maven project, or an Android project, but not both :( Installed Maven and discovered I need an Android plugin. Downloaded the samples provided with the android plugin, they fail to compile. I am losing the will to live.
comment on: http://stackoverflow.com/q/25342106
type: QuestionComment

http://stackoverflow.com/q/25341934
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39519688
tagged with: spring-security
type: Question
accepted answer: http://stackoverflow.com/a/25360308
tagged with: angularjs
has body: I am using spring security to secure my app with the below configuration to try and display Spring default login page: spring-security.xml <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <intercept-url pattern="/**" access="ROLE_USER" /> <authentication-manager> <authentication-provider> <user name="test.account" password="123456" authorities="ROLE_USER" /> </authentication-provider> </authentication-manager> </beans:beans> My problem is that all resources are succesfully authenticated excpet the Angular file (localhost:8080/#/notification) which is always open to public. Edit 1: I've tried to run the above spring security configuration on Jetty server and it works great. The problem only appears when using Google AppEngine even after adding true to appengine-web.xml. Thank you in advance.
has comment: http://stackoverflow.com/comment/39509859
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25360308
has title: Can not secure AngularJS page using Spring Security
has comment: http://stackoverflow.com/comment/39538852
tagged with: spring
has comment: http://stackoverflow.com/comment/39509823
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39512850
score: 0

http://stackoverflow.com/comment/39317379
type: Comment
score: 0
type: AnswerComment
has text: I wouldn't use an implementation which violates the official documentation... In this particular case you can perform the same check which results in file copy: check the file system providers and if they are different, act as you would in the `AtomicMoveNotSupportedException` case.
comment on: http://stackoverflow.com/a/25238400

http://stackoverflow.com/q/25276987
has body: I have written a simple mapreduce program and am now trying to run it. Someone gave me this command to run: hadoop jar &lt;out jar&gt; &lt;main class&gt; &lt;arg1&gt; &lt;arg2&gt; My jar is called IntCount.jar and the program file is called IntCount.java. There is also a file in my directory called IntCount.class. However, when I tried hadoop jar IntCount.jar IntCount input output I got Exception in thread "main" java.lang.ClassNotFoundException: IntCount Help is appreciated.
has comment: http://stackoverflow.com/comment/39388776
type: UnansweredQuestion
tagged with: java
type: Question
has title: MapReduce Program Command Error
has comment: http://stackoverflow.com/comment/39425287
tagged with: mapreduce
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/39389915
answer count: 0
has comment: http://stackoverflow.com/comment/39393573

http://stackoverflow.com/q/25331379
has comment: http://stackoverflow.com/comment/39490820
has comment: http://stackoverflow.com/comment/39490630
has comment: http://stackoverflow.com/comment/39491003
has comment: http://stackoverflow.com/comment/39490503
has comment: http://stackoverflow.com/comment/39490685
type: Question
has title: how to start a activity clicking a list item in listactivity class
has comment: http://stackoverflow.com/comment/39490595
type: UnansweredQuestion
has body: i want start activities based on the list item i click. i created a listactivity class and i have already done the arrayadpter stuff and all but in the i want to start an activity based on the item i clicked. like if the item name is Menu and i click on it, it should start the menuactivity class. same goes for the rest. i tried this @Override public void onListItemClick(ListView l, View v, int position, long id){ // getting the position and launching the activity associated with it switch(position){ startActivity(new Intent(MainActivity.this, MenuList.class)); break; default: break; } } All it does is, go blank and return me back to the MainActivity class. somebody help me here. In the list is MenuList, Beverages, drinks and contact and i want when i click on each list item, it launches the activity associated with it
tagged with: android
has answer: http://stackoverflow.com/a/25331571
has comment: http://stackoverflow.com/comment/39490560
has comment: http://stackoverflow.com/comment/39490802
score: 0
has comment: http://stackoverflow.com/comment/39490709
linked to: http://stackoverflow.com/q/21941182
tagged with: java
has comment: http://stackoverflow.com/comment/39490861
answer count: 1
has comment: http://stackoverflow.com/comment/39490665
has comment: http://stackoverflow.com/comment/39490851

http://stackoverflow.com/comment/39395452
type: QuestionComment
comment on: http://stackoverflow.com/q/25280665
score: 0
has text: General rule: never put a return statement in a finally block.
type: Comment

http://stackoverflow.com/a/55732445
has body: This is a working example that returns true for output 1 and false for output 0, (throws Exception in all other cases). I also added setting a working path and an environment variable, which is not required for your particular example so you can delete it. You can copy paste this code as a class, compile it to jar and run it. It is verified in WSL Ubuntu 16.04. Setting the workdirectory is verified by setting binaryCommand[0]="touch";and binaryCommand[1]="1";, re-compiling and running the .jar file. import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Map; import java.util.StringJoiner; public class GenerateOutput { /** * This code can execute a command and return the binary value of it's output if it * is actually binary. * * compile this project into a .jar and run it with for example: * java -jar readOutputOfCommand.jar * * @param args * @throws Exception */ public static void main(String[] args) throws Exception { boolean answerYes = false; // no yes answer to any command prompts is needed. // to execute a command with spaces in it in terminal, put them in an array of Strings. String[] binaryCommand = new String[2]; // write a command that gives a binary output: binaryCommand[0] = "echo"; binaryCommand[1] = "1"; // pass the commands to a method that executes them System.out.println("The output of the echo command = "+executeCommands(binaryCommand,answerYes)); } /** * This executes the commands in terminal. * Additionally it sets an environment variable (not necessary for your particular solution) * Additionally it sets a working path (not necessary for your particular solution) * @param commandData * @param ansYes * @throws Exception */ public static boolean executeCommands(String[] commands,Boolean ansYes) throws Exception { String capturedCommandOutput = null; System.out.prin…
type: Answer
answers question: http://stackoverflow.com/q/25238013
score: 0

http://stackoverflow.com/comment/39395872
type: Comment
type: QuestionComment
has text: If you need relation mapping, maybe better use some ORM framework, Hibernate for example. You can do mapping by hand in Spring JDBC but it may cause N+1 Select problem or you should rewrite carefully all queries and join entity with dependency, plus mapper will be much more complicated.
comment on: http://stackoverflow.com/q/25280815
score: 1

http://stackoverflow.com/q/25289105
has title: Logback - Logging multiple levels to one file
tagged with: logging
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/25301772
tagged with: java
tagged with: logback
has answer: http://stackoverflow.com/a/25301772
type: AnsweredQuestion
has body: I need to create a file that only logs TRACE and DEBUG events, but I'm unable to make it work (don't know if it's even possible). Already tried searching for an option to invert the ThresholdFilter or a way to specify multiple levels on a LevelFilter, but with no success. The only way that I'm thinking to make this work is to create 2 appende, exactly the same from one to another, but with the LevelFilter in one specified to TRACE and the other to DEBUG. Is there any other way to accomplish this? Because I'm not a big fan of duplicating code/configuration.
answer count: 1

http://stackoverflow.com/comment/39483951
comment on: http://stackoverflow.com/a/25328021
type: AnswerComment
has text: thanks so much! I have a question though: if i parseint, does it change it to an integer completely and thats why the if statement can't be executed?
score: 0
type: Comment

http://stackoverflow.com/comment/39475631
has text: JavaScript - `var x = 0;function f(){x = x + 10;return 1;}console.log(x + f());` outputs `1`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25323202
score: 0

http://stackoverflow.com/comment/39516109
has text: After mvn - version i got Apache Maven 2.2.1 (rdebian-8) Java version: 1.6.0_38 Java home: /usr/lib/jvm/jdk1.6.0_38/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "3.5.0-23-generic" arch: "i386" Family: "unix"
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25235574
type: QuestionComment

http://stackoverflow.com/comment/39381246
has text: instance boolean variable is by default initialized with `false` value. There is no need of `this (false);` and `binary = false;`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25272784
score: 0

http://stackoverflow.com/q/25380969
has answer: http://stackoverflow.com/a/25381448
tagged with: java
has answer: http://stackoverflow.com/a/25381135
tagged with: eclipse
has answer: http://stackoverflow.com/a/25381172
tagged with: src
has comment: http://stackoverflow.com/comment/39581213
has body: I try to recompile the eclipse src to use the ide ui for a new language or other interest). how can I do it ?
type: Question
tagged with: rebuild
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39580968
tagged with: ide
has title: How get Eclipse src and rebuild (compile) it for a new language?
has comment: http://stackoverflow.com/comment/39581398
score: 0
answer count: 3

http://stackoverflow.com/comment/39322564
type: QuestionComment
comment on: http://stackoverflow.com/q/25241384
has text: Where is the code that actually writes the entities to the DB? Have you committed the transaction?
type: Comment
score: 1

http://stackoverflow.com/comment/39502162
has text: the sform is created dynamically so field names are not static. i need the entire array to printed in servlet.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25306506

http://stackoverflow.com/q/25377355
has comment: http://stackoverflow.com/comment/39575067
has answer: http://stackoverflow.com/a/25377564
has comment: http://stackoverflow.com/comment/39574798
has title: ProcessBuilder cannot run bat file with spaces in path
score: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25377564
tagged with: batch-file
has comment: http://stackoverflow.com/comment/39574982
downvote count: 0
tagged with: java
answer count: 1
upvote count: 4
favorite count: 0
has body: I have the following code segment to run a bat file: String workingDir = System.getProperty("user.dir"); ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "\"" + workingDir + File.separator + "midl.bat\""); Process ddsBuildProc = pb.start(); ddsBuildProc.waitFor(); The workingDir includes spaces in the path. Eventhough I use quotes to enclose the workingDir+fileName string, the shell still splits the workingDir and doesn't run the bat file. If a try and copy-paste-execute the bat file path string in the Windows command window manually, it works as expected. What can be the problem here? Also, please do not close this question as duplicate because I tried all the solutions in the other questions with no success.
type: Question

http://stackoverflow.com/q/25265799
tagged with: bouncycastle
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29979627
score: 0
has title: Java7, BouncyCastle, OSX vs Redhat: "UnrecoverableKeyException"
has body: At my institution we have a script that has been encrypting and decrypting passwords for about 10 years from a database (please, let's not get into the best-practices of doing that or not; it's a healthy debate in my own community but the business requires it). It's been doing that running on Java 1.3 using BouncyCastle. So, essentially, I have a very old keystore with very old passwords, and I need to use those but in an updated codebase running on an upgraded machine with new Java. We decided to rewrite the codebase surrounding that functionality, which basically requires rewriting this piece as well. Basically, though, the encryption part of the code is identical. Now we are deploying it to Java 1.7 on Redhat. This is where we ran into problems. My development machine: OSX, Java 1.7 (build 8) My test machine: Redhat, Java 1.7 (build 9) The new code executes just fine on my local development machine. But when I tried to deploy it to our test machine I got "UnrecoverableKeyException: no match". So on our test machine I tried to deploy it using Java 1.6 -- and lo and behold, that works fine. I then acquired Java 1.7 build 8 (thinking build 9 was the issue) and tried that, but same error as on build 9. So it would seem that BouncyCastle: on an OSX machine it will run on Java 1.7 on a Redhat machine it won't run on Java 1.7 but does run on Java 1.6 and below. My question is this: does anyone know if there is in fact a problem with Java 1.7 and BouncyCastle? I tried looking through the BC website but aside from stating that the latest BC jars are compatible with Java 1.7, the rest of the site seems pretty broken (lot's of 404s). I tried googling, but almost everything related to this exception is referencing Android and seems unrelated. Or is there something I'm missing about getting it to run on Java 1.7? I'm certainly not well-versed in BC, PGP, or anything related to encryption and am mostly winging it to be honest. LOL More detail: I am using the bcpg-jdk15on-151.j…
tagged with: java
answer count: 1
type: Question

http://stackoverflow.com/a/25349294
has body: You can use a set intersection: "[\\p{ASCII}&amp;&amp;[^\\p{Alnum}]]" Read: Reference - What does this regex mean?
has comment: http://stackoverflow.com/comment/39522292
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39522269
answers question: http://stackoverflow.com/q/25349213
downvote count: 0

http://stackoverflow.com/comment/39468546
score: 0
type: Comment
has text: This gives the raw seconds, not minutes.
type: AnswerComment
comment on: http://stackoverflow.com/a/25314669

http://stackoverflow.com/q/25241635
favorite count: 0
tagged with: post
has answer: http://stackoverflow.com/a/25241717
type: Question
possible better answer: http://stackoverflow.com/a/25241968
upvote count: 0
has answer: http://stackoverflow.com/a/25241890
has body: I need to insert post request data into array. I will get three sets of JSON information and I want to insert each JSON result in a String array. Here is the code I am currently using. URL url = new URL("http://localhost:9090/service.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuffer response = new StringBuffer(); int i = 0; ArrayList&lt;String&gt; arr = new ArrayList&lt;String&gt;(); while ((line = reader.readLine()) != null) { response.append(line); arr.add(response.toString()); System.out.println(arr.get(i)); i++; } If input like: abc def ghi This code outputs like: abc abcdef abcdefghi But I need output like input.
score: -1
accepted answer: http://stackoverflow.com/a/25241717
type: AnsweredQuestion
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25241968
has title: How do I put data I have received from a Http request into an array?
downvote count: 1

http://stackoverflow.com/q/25297912
tagged with: web-services
tagged with: spring
has answer: http://stackoverflow.com/a/25298413
type: AnsweredQuestion
has body: We have a requirement to allow users to generate search result exports in various formats. The problem is that the size of the exports can vary and take several seconds to minutes to complete. I want to allow users to be able to fire the request and continue doing other things while it runs, but I don't want to impair the web application server's performance by using background threads if necessary. My initial idea is to decouple the web application and the generation process. I could use JMS with a message driven bean (MDB) that handles the file generation that is deployed separately from the web application; allowing to scale them individually based on future needs. Technically, I see the web application maintaining a list of requests that it has started and sent JMS messages for. As the MDB completes, it sends updates back to a queue the web application listens on and updates the list of requests accordingly with status and perhaps file URI information. When user want to download a generated file they requested, the file is streamed to the browser and then removed. As an added precaution, the MDB would also fire a delayed message into a cleanup queue that after the delay has expired, the MDB checks the URI of the generated file and if it continues to exist, removes the file and notifies the web application so it may update it's internal list accordingly perhaps by removing it or marking it as having been automatically removed. The beauty here is if I need to increase the number of concurrent export jobs, I can easily spawn up another JMS client process or tweak the existing processes to run more concurrent MDB handlers without having to touch the web application itself. I'm curious if there are other alternatives I could be overlooking, concerns I should be considering, or whether this is a solid decoupled solution that has worked for others in the past.
has title: Using JMS for long running file creation process for web application
tagged with: activemq-classic
score: 1
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25298413
tagged with: jms
favorite count: 0
type: Question
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39630009
type: AnswerComment
has text: All that I did was rename the project, based on comments given earlier to this question.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25386892

http://stackoverflow.com/q/25248449
tagged with: java
answer count: 1
has title: How to can process xlsx file (from template) in Java?
has comment: http://stackoverflow.com/comment/39362456
tagged with: excel
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25248700
score: 0
has body: In my application we generate Excel files using JExcel API which allows us to use XLS templates file. Now we must also manage XLSX format, but JExcel can not handle this format. What other API can be used ? I wanted to use POI but it does not take into account the templates. This forces us to change the code to fully recreated a file each time. Thank's.
tagged with: apache-poi
tagged with: jexcelapi

http://stackoverflow.com/a/25385788
type: Answer
has body: You are adding one of the taxes twice : totalprice = (price1 + taxprice); if (item.contains("imported")) { price1 = Double.parseDouble(price); ftax = price1 * .05; totalprice = (totalprice + taxprice + ftax); } Should be : totalprice = (price1 + taxprice); if (item.contains("imported")) { ftax = price1 * .05; totalprice = (price1 + taxprice + ftax); } Or : totalprice = (price1 + taxprice); if (item.contains("imported")) { ftax = price1 * .05; totalprice = (totalprice + ftax); } Oh, and there's no need to parse price1 from the String again. It already contains the correct value.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25385632
has comment: http://stackoverflow.com/comment/39590395

http://stackoverflow.com/a/25345944
has body: All classes live in application context, Struts object factory creates instances of classes and returns them when they are referenced. default stack is overridden by you when you specify it. So default Stack is unavailable for the actions in that package. Part 1: When you specify interceptor-ref name= login When you specify somestring in name attribute, it parses that string then it gets object from StrutsObjectFactory then it creates its list in memory. Then InterceptorBuilder class creates list of references. This class returns list of mappings. Part 2: When you write default-interceptor-ref Why XML showing error? &lt;default-interceptor-ref &gt; is used to define default stack of interceptors, xml is showing error because you are specifying interceptor instead of interceptor-stack. As per DTD it is invalid. As per DTD it is expecting a type of interceptor-stack. How to remove XML error? You can disable xml check to remove that error, or can specify valid configuration by creating stack and specifying stack to it, as you showed in second part. Why it is working with single interceptor ref also? It is working because the implementation accepts single interceptor reference also. Actually that configuration is passing the reference. So if you pass stack, it will have reference to collection, if you are passing single interceptor, it will pass the reference of the single interceptor only. Now in struts2 there is source code available on internet. InterceptorStackConfig is the class that builds list and uses InterceptorlistHolder interface. InterceptorStackConfig implements this interface in builder and adds interceptors mapping references from interceptor mappings one by one to list. It means that it deals only with mapping and get reference. You can see it has InterceptorListHolder interface which creates list of interceptors for your stacks, it accepts both single interceptor mapping and list of interceptor mappings for adding interceptor mappping to list. Intercept…
type: Answer
accepted answer of: http://stackoverflow.com/q/25343558
upvote count: 3
score: 3
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25343558

http://stackoverflow.com/a/25303668
has comment: http://stackoverflow.com/comment/39439847
answers question: http://stackoverflow.com/q/25303565
has comment: http://stackoverflow.com/comment/39438645
has body: Don't define the Util class and you can avoid some of the string creation overhead. Quite apart from anything else you're isInfoEnabled check is completely pointless as logger itself will do the check. Use: logger.log(Level.INFO, "Message {0} with {1}", new Object[] { param1, param2 }); And you will avoid most of the string creation overhead as it will only toString() param1 and param2 and construct the final message if the INFO level is turned on. There is the cost of allocating the new Object[] array but that is tiny
has comment: http://stackoverflow.com/comment/39438403
has comment: http://stackoverflow.com/comment/39439080
upvote count: 4
has comment: http://stackoverflow.com/comment/39439026
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/q/25238855
tagged with: java
has comment: http://stackoverflow.com/comment/39318893
has comment: http://stackoverflow.com/comment/39318659
has answer: http://stackoverflow.com/a/25239373
has comment: http://stackoverflow.com/comment/39318042
linked to: http://stackoverflow.com/q/2545214
type: Question
linked to: http://stackoverflow.com/q/4416454
score: 0
has comment: http://stackoverflow.com/comment/39318157
type: UnansweredQuestion
answer count: 1
has title: How does the opaque property work in Swing?
tagged with: swing
tagged with: opacity
has comment: http://stackoverflow.com/comment/39318032
has body: This a simple application I got from here this answer to How to set a Transparent Background of JPanel that's supposed to explain how setOpaque() works. public class TwoPanels { public static void main(String[] args) { JPanel p = new JPanel(); // setting layout to null so we can make panels overlap p.setLayout(null); CirclePanel topPanel = new CirclePanel(); // drawing should be in blue topPanel.setForeground(Color.blue); // background should be black, except it's not opaque, so // background will not be drawn topPanel.setBackground(Color.black); // set opaque to false - background not drawn topPanel.setOpaque(false); topPanel.setBounds(50, 50, 100, 100); // add topPanel - components paint in order added, // so add topPanel first p.add(topPanel); CirclePanel bottomPanel = new CirclePanel(); // drawing in green bottomPanel.setForeground(Color.green); // background in cyan bottomPanel.setBackground(Color.cyan); // and it will show this time, because opaque is true bottomPanel.setOpaque(true); bottomPanel.setBounds(30, 30, 100, 100); // add bottomPanel last... p.add(bottomPanel); // frame handling code... JFrame f = new JFrame("Two Panels"); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 300); f.setLocationRelativeTo(null); f.setVisible(true); } // Panel with a circle drawn on it. private static class CirclePanel extends JPanel { // This is Swing, so override paint*Component* - not paint protected void paintComponent(Graphics g) { // call super.paintComponent to get default Swing // painting behavior (opaque honored, etc.) super.paintComponent(g); int x = 10; int y = 10; int width = getWidth() - 20; int height = getHeight() - 20; g.fillArc(x, y, width, height, 0, 360); } } } The thing the I don't get is how come he is adding the opaque layer on top of transparent layer? shouldn't be the other way around? The way that I picture how it should work is by adding the transparent layer on top of the opaque one, kinda of like how you put…

http://stackoverflow.com/a/25277640
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25277575
has body: The javadoc of ServletRequest#getRequestDispatcher(String) states a RequestDispatcher object that acts as a wrapper for the resource at the specified path, or null if the servlet container cannot return a RequestDispatcher It seem the path you are providing does not exist or cannot be resolved the way you expect.

http://stackoverflow.com/q/25291133
has answer: http://stackoverflow.com/a/25292072
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39415626
has body: In a spring mvc application using hibernate over a MySQL database, I have an AccessLog entity that records the activities performed by various types of actors on various types of target resources. For simplicity, I am using polymorphism to store all the actor ids in one column and all the target resource ids in another column, regardless of their type. But how do I query the target entities and actor entities later? Here is the AccessLog entity. It currently uses an actor_type string property to indicate the type of the entity whose id is stored in actorentity_id, and another string property target_type to indicate the type of entity whose id is stored in targetentity_id. But this could get messy because it relies on logic in the application's business layer to manage all the string type values. I could add a type property to BaseEntity, but that would still involve managing the type values in the business layer. How can I set things up so that this is designed most elegantly? @Entity @Table(name = "accesslogs") public class AccessLog extends BaseEntity{ @ManyToOne @JoinColumn(name = "actorentity_id") private BaseEntity actor_entity; @ManyToOne @JoinColumn(name = "targetentity_id") private BaseEntity target_entity; @Column(name="actorentity_type")//this could get messy private String actor_type; @Column(name="targetentity_type")//this could get messy private String target_type; @Column(name="action_code") private String action; @Column(name="access_date") @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") private DateTime accessdate; //getters and setters } Here is the BaseEntity @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE) protected Integer id; public void setId(Integer id) {this.id = id;} public Integer getId() {return id;} } Here are a couple of examples of types of actor entities that extend BaseEntity, and which could be stored in the AccessLog.…
answer count: 1
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39415811
has title: retrieving polymorphic entities with hibernate and mysql
accepted answer: http://stackoverflow.com/a/25292072

http://stackoverflow.com/a/25248348
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25234679
answers question: http://stackoverflow.com/q/25234679
type: Answer
has body: The comment is probably outdated. I do not see any calls to Unsafe.unpark from either JDK or HotSpot natives. Moreover, LockSupport.unpark calls Unsafe.unpark directly. At the same time LockSupport is public API, so it must be safe.
upvote count: 1

http://stackoverflow.com/comment/39370996
score: 0
type: Comment
type: AnswerComment
has text: @CL Well, thank you for the link (SQLFiddle) - It's embarassing how it conflicts with all my knowledge of SQL (using **not delimited spaces** and **unknown datatypes**)!!
comment on: http://stackoverflow.com/a/25266984

http://stackoverflow.com/q/25371379
tagged with: microsoft-sync-framework
answer count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39563586
linked to: http://stackoverflow.com/q/271610
accepted answer: http://stackoverflow.com/a/25371774
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39564307
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25371774
tagged with: java
has title: is there something like microsoft sync framework in java?
tagged with: servlets
score: 2
upvote count: 4
tagged with: data-synchronization
has body: I am building an centralized inventory system using java(swing and servlets). I have local data stored in desktop application which needs to be in sync with an server. Requirement is:- 1) When local stores are online ,data must be synchronized with server in real time. 2) Local store will have access to their data even if they go offline, but when they go online all local changes must be reflected on server. I got across microsoft sync framework which is exactly what I need. Is there something equivalent in java?
has comment: http://stackoverflow.com/comment/39564356
downvote count: 2

http://stackoverflow.com/comment/39407627
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25287297
has text: What android version are you supporting?

http://stackoverflow.com/a/25356239
has comment: http://stackoverflow.com/comment/39534919
has body: Without using any external libraries and without knowing any more than you have an OutputStream and an InputStream, you can use something like this. byte[] buf = new byte[ 1024 ]; int read = 0; while( ( read = in.read( buf ) ) != -1 ) { out.write( buf, 0, read ); } This gives you the benefits of block moves, instead of single byte moves as in the code you posted. This can be improved if we had more information on the types of IO streams you are using. You could look at Java.NIO which can provide much quicker block moves in the case of files or sockets.
answers question: http://stackoverflow.com/q/25356004
type: Answer
has comment: http://stackoverflow.com/comment/39534946
has comment: http://stackoverflow.com/comment/39534611
score: 0
has comment: http://stackoverflow.com/comment/39534600

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/25359655

http://stackoverflow.com/comment/39527749
score: 0
type: AnswerComment
has text: no, actually if I override it inside myClass then always that method will be get called; other wise the implementation in abstract class will be called.
comment on: http://stackoverflow.com/a/25352463
type: Comment

module
tags question: http://stackoverflow.com/q/25240911
type: Tag
tag name: module

http://stackoverflow.com/comment/39441894
comment on: http://stackoverflow.com/q/25292485
has text: See : http://stackoverflow.com/questions/2274378/add-soapheader-to-org-springframework-ws-webservicemessage. Seems there is no easy way. Note that, since you compiled your schema to objects, there certainly is a way to have JAXB generate a DOM tree and insert it into the header : http://stackoverflow.com/questions/17078308/how-to-marshal-a-jaxb-object-to-org-w3c-dom-document
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25331797
tagged with: android
tagged with: java
tagged with: eclipse
has title: java.lang.NoClassDefFoundError: android.support,v4.app.Notification
has comment: http://stackoverflow.com/comment/39491730
downvote count: 0
has body: Following a reboot my Eclipse Android project was damaged, with the vast majority of my import statements being removed. I've managed to recover it using the "Source...Organize Imports" option, but now I get the above error in a previously-working piece of code which uses NotificationCompat. I found and followed the advice from this question: Could not find class &#39;android.app.Notification$Builder I have import android.support.v4.app.NotificationCompat; at the top of my class, and have both android-support-v4.jar and android-support-v7-appcompat.jar in the lib folder of my project. I still get the error above however. What else can I try to resolve this?
answer count: 0
has comment: http://stackoverflow.com/comment/39491415
upvote count: 1
type: UnansweredQuestion
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/21887816
tagged with: notifications
has comment: http://stackoverflow.com/comment/39491449
score: 1

http://stackoverflow.com/comment/39312249
comment on: http://stackoverflow.com/q/25230909
type: Comment
score: 0
type: QuestionComment
has text: It almost sounds like you want an image as the background of the panel that has a button on it. If so, there's plenty of examples here, such as: http://stackoverflow.com/questions/5912913/how-can-i-put-a-jbutton-on-an-image?lq=1

http://stackoverflow.com/a/25250834
has comment: http://stackoverflow.com/comment/39341998
has comment: http://stackoverflow.com/comment/39342449
downvote count: 0
has body: Yes, the idea is: match a whitespace, followed by any number of 1) quoted strings or 2) non-quotes up to the end. Example in python: import re text = """ { "my key name": "my key value", "foo": ["b a r", "b a z"] } """ rx = r"""(?x) \s (?= ( " [^"]* " | [^"] ) * $ ) """ print re.sub(rx, '', text) # {"my key name":"my key value","foo":["b a r","b a z"]} I see the java tag has been added... I don't know java, but the portable form of the above regex \s(?=("[^"]*"|[^"])*$) should work there too.
answers question: http://stackoverflow.com/q/25250553
type: Answer
has comment: http://stackoverflow.com/comment/39342655
has comment: http://stackoverflow.com/comment/39341201
has comment: http://stackoverflow.com/comment/39342904
score: 3
upvote count: 3

http://stackoverflow.com/a/25303791
type: AcceptedAnswer
score: 3
upvote count: 3
downvote count: 0
has body: From Spring 2.5 to 4.0 is quite a big jump. And Spring DID deprecate that method. If you look at the API for Spring 3, that method has been marked as deprecated and removed completely in Spring 4. Even more, in Spring 2.5 it was, also, deprecated, see here. So, in your Spring 2.5.6 project you were already using a deprecated method.
type: Answer
answers question: http://stackoverflow.com/q/25296615
accepted answer of: http://stackoverflow.com/q/25296615

http://stackoverflow.com/q/25315479
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/25347108
has body: I have a java project and when I remove a directory with some classes I can not identify in the git repository was removed, I can only identify that all classes have been removed. I need to identify it because I have a tool that makes transferring files to another directory. You can identify the deletion of the directory? I am using the API JGit. Thank you.
tagged with: gitblit
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
tagged with: git
favorite count: 0
type: Question
has title: Identify excluded directory in git
tagged with: jgit

http://stackoverflow.com/a/25314217
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25271753
accepted answer of: http://stackoverflow.com/q/25271753
type: Answer
upvote count: 1
has body: This is my solution @Override public int insert(Map&lt;String, String&gt; valueMap, String table) throws SQLException { // TODO Auto-generated method stub Connection conn = Database.getInstance().getConnection(); String val = ""; String query = ""; String question = ""; Integer mapsize = valueMap.size(); Integer x = 1; for (Map.Entry&lt;String, String&gt; entry : valueMap.entrySet()) { val += entry.getKey(); question += "?"; if (x &lt; mapsize) { val += ", "; question += ", "; } mapsize--; } query = "insert into " + table + "(" + val + ") values ("+question+")"; PreparedStatement add = conn.prepareStatement(query); for(Map.Entry&lt;String, String&gt; entry : valueMap.entrySet()){ add.setObject(x,entry.getValue()); x+=1; } int addtotable = add.executeUpdate(); add.close(); return addtotable; }

http://stackoverflow.com/q/25260456
has answer: http://stackoverflow.com/a/25261113
has comment: http://stackoverflow.com/comment/39358147
has answer: http://stackoverflow.com/a/25260997
answer count: 5
tagged with: sharedpreferences
score: 1
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/39358288
has body: I need to save my Json Array into SharedPreferences and access it later in different Activity. here is the example of my Json: Array ( [status] =&gt; success [reason] =&gt; success [version] =&gt; 1 [total] =&gt; Array ( [category_1] =&gt; 3 [category_2] =&gt; 3 [category_3] =&gt; 3 ) [title] =&gt; Array ( [category_1] =&gt; Food [category_2] =&gt; Drink [category_3] =&gt; Dessert ) [data] =&gt; Array ( [category_1] =&gt; Array ( [0] =&gt; Array ( [content_id] =&gt; 123456 [name] =&gt; Name1 [title] =&gt; This is title one [desc] =&gt; This is title description [thumb] =&gt; http://image.jpg ) [1] =&gt; Array (... ) [category_2] =&gt; Array ( [0] =&gt; Array ( [content_id] =&gt; 123456 [name] =&gt; Name1 [title] =&gt; This is title one [desc] =&gt; This is title description [thumb] =&gt; http://image.jpg ) [1] =&gt; Array (... ) [category_3] =&gt; Array ( [0] =&gt; Array ( [content_id] =&gt; 123456 [name] =&gt; Name1 [title] =&gt; This is title one [desc] =&gt; This is title description [thumb] =&gt; http://image.jpg ) [1] =&gt; Array ( ... ) ) ) MainActivity: ... try { JSONObject jObject = new JSONObject(result); String status = jObject.getString("status"); if (status.equals("success")) { // Log.e("status",status); JSONObject jObject_data = new JSONObject(jObject.getString("data")); JSONArray jArray_data_category_1 = new JSONArray(jObject_data.getString("category_1")); JSONArray jArray_data_category_2 = new JSONArray(jObject_data.getString("category_2")); //JSONArray jArray_data_category_3 = new JSONArray(jObject_data.getString("category_3")); //Log.e("category_1 *****************************************", jArray_data_category_1.toString()); vc.insertCategory_1Pref(jArray_data_category_1.toString()); This is my SharedPrefInput.java: ... public class SharedPrefInput { public static final String CATEGORY_1 = "CATEGORY_1"; public static final String CATEGORY_2 = "CATEGORY_2"; public static final String CATEGORY_3 = "CATEGORY_3"; ... Here is VarController ... //categor…
has answer: http://stackoverflow.com/a/25260928
type: Question
has answer: http://stackoverflow.com/a/25279754
has title: How to save a JSON array into SharedPreferences and read again in a different activity. Android
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39358560
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25261006
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/25365417
has answer: http://stackoverflow.com/a/25365832
favorite count: 0
has answer: http://stackoverflow.com/a/25365459
type: Question
has body: I am trying to make a program that every count of 2 it changes the value to "Open" or "1". 1-2-3-4-5-6-7-8-9-10 0-1-0-1-0-1-0-1-0-1 ** Something like this ** and after that in every three count it changes into "Open" or "1". but if the box is already "open" or "1". It should "close" or "0". and so on up to 150 count. my problem is that i cant make the output show into one array.I have no problem doing it if it was a different array..Help... int[] box = new int [150]; int b = 0; for (a = 1; a &lt; box.length; a++) { if (a % 2 == 0) { box[b] = 1; } else { box[b] = 0; } } for (int c = 1; c &lt; box.length; c++) { if (c % 3 == 0) { if (box[b] == 1) { box[b] = 0; } else { box[b] = 1; } } else { box[b] = 0; } System.out.print(box[b]); //putting the result here only result in 001001001; } /*System.out.print(box[b]); -- Putting it outside results in just zero. How can I combine the two for-loops into one array? I hope this makes sense to all of you. A different approach is also okay as long as the for loop and array are used. Output program should be 011101011101 something like this when the two are together... This is the 2nd program i did now please check cause i was suppose to add all the "0"'s and all the "1"'s after the program is executed i just want to know how to add it.Putting it inside the loop will loop it to 150 times int box [] = new int [150]; int ones= 0; int zero= 0; for(int a= 0;a&lt;box.length;a = a+2){ box[a] = 1; for(int b =0;b&lt;box.length;b = b+3){ if(box[b]==1){ box[b] = 0; zero++; } else{ box[b] = 1; one++; } System.out.print("No. of ones : " + one); /* putting it here loops the additions to up to 150 and resulting to thousands of ones */ } System.out.print(No. of ones: " + one); /* putting it here will result to 0 and loops up to 150 counting up to thousands of zero */ } for(int i =0; i &lt; box.length; i++){ System.out.print(box[i]); Resulting to 00111 - up to 150 /* the next count is by 4 is this enough to for loops to add it by 5 the next and th…
tagged with: java
score: -1
downvote count: 1
has title: Using 1 array to implement 2 for loop programs
has answer: http://stackoverflow.com/a/25365799
upvote count: 0
answer count: 3
type: UnansweredQuestion

http://stackoverflow.com/a/25301674
downvote count: 0
has body: The menu id for the File menu is just file not 'org.eclipse.ui.file' For example this is the menu contribution for 'File > Restart':
type: Answer
answers question: http://stackoverflow.com/q/25300098
score: 3
upvote count: 3

http://stackoverflow.com/a/25430163
type: Answer
has comment: http://stackoverflow.com/comment/39674571
answers question: http://stackoverflow.com/q/25387387
has comment: http://stackoverflow.com/comment/39690651
has body: You can implement Slide Navigation Menu for the list of themes to be chosen . Save the value of the theme selected in a Share Preferrence and then register onshareprefernceschangelistener in your activity. and implement onsharedpreferncechangelistener. then update your UI in the onsharedpreferencechangelistener. Or if You want to just detect the click from your preference activity then don,t implement Side navigation menu and just implement sharedpreferencechange listener
score: 0
has comment: http://stackoverflow.com/comment/39675394
has comment: http://stackoverflow.com/comment/39676583
has comment: http://stackoverflow.com/comment/39674806
has comment: http://stackoverflow.com/comment/39696140
has comment: http://stackoverflow.com/comment/39677377

http://stackoverflow.com/comment/39472120
has text: I already have checked the path and its fine.And about that isolating the retrieval,i didnot get that.Can you be more elaborate....
comment on: http://stackoverflow.com/a/25308379
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25355022
answer count: 3
has comment: http://stackoverflow.com/comment/39549009
tagged with: internet-explorer
has answer: http://stackoverflow.com/a/25355292
upvote count: 3
score: 3
has answer: http://stackoverflow.com/a/25359140
tagged with: java
has answer: http://stackoverflow.com/a/25356798
has body: I am new to selenium. My application is only IE compatible. I know that we can run test cases in any any browsers using respective drivers but is there any way that we can use to record test case using selenium IDE in Internet Explorer ??
favorite count: 0
tagged with: selenium-webdriver
type: Question
has title: how to record testcase using selenium in IE
has comment: http://stackoverflow.com/comment/39533674
type: UnansweredQuestion
downvote count: 0
tagged with: selenium
tagged with: javascript

http://stackoverflow.com/comment/39386910
has text: Hi dikkini, I saw your chat with @ipinyol and I am going to recommend the same. Just check if the string is empty, and if it is, set it to null.
comment on: http://stackoverflow.com/a/25270605
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25288607
has body: This is not a Sort algorithm - it is more of a rearrangement to minimise a metric (the distance between consecutive points). I'd attempt some kind of heuristic algorithm - something like: Pick three consecutive points a, b, c. If distance(a,c) &lt; distance(a,b) then swap(a,b). Repeat from 1. It should be possible to calculate how many times you should need to cycle this to achieve a minimal arrangement or perhaps you could detect a minimal arrangement by finding no swaps during a run. You may need to alternate the direction of your sweeps rather like the classic optimisation of bubble-sort. Added Experiment shows that this algorithm doesn't work but I've found one that does. Essentially, for each entry in the list find the closest other point and move it up to the next location. private static class Point { final int x; final int y; public Point(int x, int y) { this.x = x; this.y = y; } public String toString() { return "(" + x + "," + y + ")"; } public double distance(Point b) { int dx = x - b.x; int dy = y - b.y; // Simple cartesian distance. return Math.sqrt(dx * dx + dy * dy); } } // Sample test data - forms a square. Point[] points = new Point[]{ new Point(0, 0), new Point(0, 1), new Point(0, 2), new Point(0, 3), new Point(0, 4), new Point(0, 5), new Point(0, 6), new Point(0, 7), new Point(0, 8), new Point(0, 9), new Point(1, 9), new Point(2, 9), new Point(3, 9), new Point(4, 9), new Point(5, 9), new Point(6, 9), new Point(7, 9), new Point(8, 9), new Point(9, 9), new Point(9, 8), new Point(9, 7), new Point(9, 6), new Point(9, 5), new Point(9, 4), new Point(9, 3), new Point(9, 2), new Point(9, 1), new Point(9, 0), new Point(8, 0), new Point(7, 0), new Point(6, 0), new Point(5, 0), new Point(4, 0), new Point(3, 0), new Point(2, 0), new Point(1, 0),}; public void test() { System.out.println("Hello"); List&lt;Point&gt; test = Arrays.asList(Arrays.copyOf(points, points.length)); System.out.println("Before: " + test); Collections.shuffle(test); System.out.println("S…
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25287834
type: Answer

tiles-3
tag name: tiles-3
tags question: http://stackoverflow.com/q/25359480
tags question: http://stackoverflow.com/q/25260469
type: Tag

http://stackoverflow.com/comment/39548556
has text: thank you so much for your response. It has helped resolved much issue, however, I have an issue with the following line: ParseFile image = object.getParseFile("ProfilePicture"); The method getParseFile(String) is undefined for the type List<ParseObject>
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25363779
score: 0

http://stackoverflow.com/comment/39565235
type: AnswerComment
has text: Given that I'm writing all the annotations with the assumption that they'll eventually implement those profiles, and the fact that my Map really shouldn't contain any null values, maybe I'll just go ahead and annotate the value as NonNull, and view the fact that the get method isn't recognized as Nullable as yet another analysis bug/limitation that needs to be fixed before I enable this stuff by default.
type: Comment
comment on: http://stackoverflow.com/a/25371836
score: 0

http://stackoverflow.com/comment/39313379
score: 0
type: AnswerComment
has text: It's hard to say without seeing some code. Can you edit your post to provide some context? And no custom library needed for JSON -- it's a global object. You can read more about it [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)
comment on: http://stackoverflow.com/a/25235635
type: Comment

http://stackoverflow.com/comment/39460409
comment on: http://stackoverflow.com/a/25315471
has text: Ok I did it. Now there is a problem with R. I import it but there is an error with setContentView(R.layout.activity_main); The error is: Multiple markers at this line - R cannot be resolved to a variable - activity_main cannot be resolved or is not a field Even if R is imported
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39511003
has text: @OliCharlesworth I can to use google. Since, I can read about precendce, for instance, in Wikipedia. But I'm interested in formal explanation, as I've already said.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25342619
score: 0

http://stackoverflow.com/comment/39561916
score: 0
has text: Removing things one at a time would be easy if I was seeing the error at compile time. Since I'm getting it at runtime I have to include the projects to build, making it difficult to remove one at a time and isolate the issue. If there's a way to do this I apologize for not knowing it.
comment on: http://stackoverflow.com/q/25368935
type: Comment
type: QuestionComment

spring
tags question: http://stackoverflow.com/q/25273268
tags question: http://stackoverflow.com/q/25342074
tags question: http://stackoverflow.com/q/25298427
tags question: http://stackoverflow.com/q/25323388
tags question: http://stackoverflow.com/q/25264619
tags question: http://stackoverflow.com/q/25310632
tags question: http://stackoverflow.com/q/25328038
tags question: http://stackoverflow.com/q/25377301
tags question: http://stackoverflow.com/q/25335302
tags question: http://stackoverflow.com/q/25247228
tags question: http://stackoverflow.com/q/25311536
tags question: http://stackoverflow.com/q/25237664
tags question: http://stackoverflow.com/q/25310904
tags question: http://stackoverflow.com/q/25355237
tags question: http://stackoverflow.com/q/25317539
tags question: http://stackoverflow.com/q/25310197
tags question: http://stackoverflow.com/q/25371200
tags question: http://stackoverflow.com/q/25258263
tags question: http://stackoverflow.com/q/25340879
tags question: http://stackoverflow.com/q/25252220
tags question: http://stackoverflow.com/q/25241462
tags question: http://stackoverflow.com/q/25301240
tags question: http://stackoverflow.com/q/25328155
tags question: http://stackoverflow.com/q/25302372
tags question: http://stackoverflow.com/q/25316165
tags question: http://stackoverflow.com/q/25317477
tags question: http://stackoverflow.com/q/25262577
tags question: http://stackoverflow.com/q/25320011
tags question: http://stackoverflow.com/q/25252374
tag name: spring
tags question: http://stackoverflow.com/q/25250104
tags question: http://stackoverflow.com/q/25288143
tags question: http://stackoverflow.com/q/25255451
tags question: http://stackoverflow.com/q/25239158
tags question: http://stackoverflow.com/q/25306271
tags question: http://stackoverflow.com/q/25236748
tags question: http://stackoverflow.com/q/25339946
tags question: http://stackoverflow.com/q/25293615
tags question: http://stackoverflow.com/q/25330713
tags question: http://stackoverflow.com/q/25301119
tags question: http://stackoverflow.com/q/25329175
tags question: http://stackoverflow.com/q/25282026
tags question: http://stackoverflow.com/q/25331213
tags question: http://stackoverflow.com/q/25362316
tags question: http://stackoverflow.com/q/25306508
tags question: http://stackoverflow.com/q/25272144
tags question: http://stackoverflow.com/q/25370221
tags question: http://stackoverflow.com/q/25284011
tags question: http://stackoverflow.com/q/25321919
tags question: http://stackoverflow.com/q/25300995
tags question: http://stackoverflow.com/q/25356188
tags question: http://stackoverflow.com/q/25246981
tags question: http://stackoverflow.com/q/25374178
tags question: http://stackoverflow.com/q/25261820
tags question: http://stackoverflow.com/q/25320756
tags question: http://stackoverflow.com/q/25384073
tags question: http://stackoverflow.com/q/25309381
tags question: http://stackoverflow.com/q/25374480
tags question: http://stackoverflow.com/q/25342489
tags question: http://stackoverflow.com/q/25247482
tags question: http://stackoverflow.com/q/25279423
tags question: http://stackoverflow.com/q/25367566
tags question: http://stackoverflow.com/q/25285710
tags question: http://stackoverflow.com/q/25290935
tags question: http://stackoverflow.com/q/25265984
tags question: http://stackoverflow.com/q/25388407
tags question: http://stackoverflow.com/q/25294165
tags question: http://stackoverflow.com/q/25249737
tags question: http://stackoverflow.com/q/25244689
tags question: http://stackoverflow.com/q/25276260
tags question: http://stackoverflow.com/q/25359692
tags question: http://stackoverflow.com/q/25340315
tags question: http://stackoverflow.com/q/25308524
tags question: http://stackoverflow.com/q/25237357
tags question: http://stackoverflow.com/q/25243211
tags question: http://stackoverflow.com/q/25358665
tags question: http://stackoverflow.com/q/25345395
tags question: http://stackoverflow.com/q/25351817
tags question: http://stackoverflow.com/q/25366767
tags question: http://stackoverflow.com/q/25232117

http://stackoverflow.com/q/25236845
has comment: http://stackoverflow.com/comment/39314970
has body: I am new to swing core functionalities. I have experience in web designing. There is id for uniqueness and class for commonality. &lt;div class="x" id="div1"&gt;&lt;/div&gt; &lt;div class="x" id="div2"&gt;&lt;/div&gt; If i want to set property for all the divs, i ll use class x. .x { } or via javascript or jquery If i want to access single div, i ll make use of id. Because it is unique. In the same way is there anything in java swing buttons?Assume i have 2D array of jbuttons. Tried so far I found putClientProperty and getClientproperty. It sets and returns id. btnName.putClientproperty('id',value); My first question: Is it correct way to set Unique id's? Is there any other ways? JButton[][] btns = new JButton[5][5]; for(int i=0; i&lt;5; i++) { for(int j=0;j&lt;5;j++) { btns[i][j] = new JButton("Button"+i+j); } } The above code will create 25 buttons with names. My Second Question: I am unaware of it.How to set classes so that i can enable or disable them with single line code? I meant All the 25 buttons has a common class let it be tiles JButton.find('tiles').setEnabled(false); Is there anything similarly in java? I know the way to iterate and do it. But i want to reduce the number of lines, function calls. That's why i posted this question. Please let me know
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39314427
tagged with: swing
has comment: http://stackoverflow.com/comment/39314478
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25237191
has comment: http://stackoverflow.com/comment/39314499
has comment: http://stackoverflow.com/comment/39314316
has answer: http://stackoverflow.com/a/25236995
has comment: http://stackoverflow.com/comment/39315020
linked to: http://stackoverflow.com/q/13531346
has comment: http://stackoverflow.com/comment/39314422
has comment: http://stackoverflow.com/comment/39314528
tagged with: arrays
has comment: http://stackoverflow.com/comment/39314711
has comment: http://stackoverflow.com/comment/39314701
has comment: http://stackoverflow.com/comment/39314836
has comment: http://stackoverflow.com/comment/39314855
has title: Common property for JButtons
possible better answer: http://stackoverflow.com/a/25236995
tagged with: jbutton
has comment: http://stackoverflow.com/comment/39314594
has answer: http://stackoverflow.com/a/25237191
has comment: http://stackoverflow.com/comment/39314933
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39314810
has comment: http://stackoverflow.com/comment/39315041
has comment: http://stackoverflow.com/comment/39314916
answer count: 2
has comment: http://stackoverflow.com/comment/39314633
downvote count: 0

http://stackoverflow.com/comment/39354180
comment on: http://stackoverflow.com/q/25257829
has text: I got the solution with your help. Thanks piet.t
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/39457703
type: Comment
comment on: http://stackoverflow.com/a/25311812
type: AnswerComment
has text: Isn't this answer providing an answer to a different question? The different question would be *"How can I check an incorrect certificate used in my android app is being rejected by nodejs server"*.
score: 0

http://stackoverflow.com/a/25234144
answers question: http://stackoverflow.com/q/25234032
has comment: http://stackoverflow.com/comment/39334587
score: 0
has body: I think you should use String.split(" ") which seems to do the same thing
type: Answer

http://stackoverflow.com/q/25340423
tagged with: android-ndk
favorite count: 0
has body: I am using Android Studio. I am using e-POS-Print.jar in my app. Whenever I run the code I get this error: java.lang.ExceptionInInitializerError at com.stc.printer.MyActivity.onCreate(MyActivity.java:48) at android.app.Activity.performCreate(Activity.java:5163) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4895) 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:994) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.UnsatisfiedLinkError: Couldn't load eposprint: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:365) at java.lang.System.loadLibrary(System.java:535) at com.epson.eposprint.Print.&lt;clinit&gt;(Print.java:18) at com.stc.printer.MyActivity.onCreate(MyActivity.java:48) My code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); System.out.println("started"); printerName = getString(R.string.printername_t81ii); language = Builder.MODEL_SOUTHASIA; //bellow is line no. 48 Print newPrinter = new Print(getApplicationContext()); try{ newPrinter.openPrinter(deviceType, openDeviceName, enabled, interval); }catch(Exception e){ System.out.println("Error"); e.printStackTrace(); newPrinter = null; } setPrinter(newPrinter); } The sample project from Epson is having one native f…
type: Question
linked to: http://stackoverflow.com/q/9037966
has answer: http://stackoverflow.com/a/25347930
accepted answer: http://stackoverflow.com/a/25347930
tagged with: java-native-interface
tagged with: android
score: 4
upvote count: 4
tagged with: shared-libraries
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39517969
tagged with: java
has title: java.lang.UnsatisfiedLinkError: Couldn't load eposprint: findLibrary returned null
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/39375258
type: QuestionComment
score: 0
has text: Holy cow, you were right @James_D...Post that as an answer and I will accept it
comment on: http://stackoverflow.com/q/25269247
type: Comment

http://stackoverflow.com/comment/39576054
type: QuestionComment
comment on: http://stackoverflow.com/q/25377102
score: 1
type: Comment
has text: Note that the usual name for this construct is "ternary", as in ternary logic or ternary content-addressable memory (TCAM). The third state is variously referred to as indeterminate, unknown, or "don't care" (especially for netmasks).

http://stackoverflow.com/q/25275246
has comment: http://stackoverflow.com/comment/39386091
has comment: http://stackoverflow.com/comment/39386123
accepted answer: http://stackoverflow.com/a/25275281
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39386329
tagged with: generics
has comment: http://stackoverflow.com/comment/39386149
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39386125
has comment: http://stackoverflow.com/comment/39385862
answer count: 1
downvote count: 0
has title: Java interface generics, return type depending on argument generic
has answer: http://stackoverflow.com/a/25275281
upvote count: 1
has body: I have several objects all implementing a concrete interface Op that need to be mapped to arbitrary types. I'm trying to solve the problem with a double-dispatch approach: interface Mapper&lt;R&gt; { R process(Op1 op1); R process(Op2 op2); } interface Op&lt;T&gt;{ &lt;R&gt; R process(Mapper&lt;R&gt; mapper); } class Op1 implements Op&lt;String&gt; { @Override public &lt;R&gt; R process(Mapper&lt;R&gt; mapper) { return mapper.process(this); } } class Op2 implements Op&lt;String&gt; { @Override public &lt;R&gt; R process(Mapper&lt;R&gt; mapper) { return mapper.process(this); } } I create a mapper with methods for the specified Ops, mapping to String: Mapper&lt;String&gt; mapper = new Mapper&lt;String&gt;() { @Override public String process(Op1 op1) { return "1"; } @Override public String process(Op2 op2) { return "2"; } }; Problem When I try to map an Op to String: Op op = new Op1(); String i = op.process(mapper); The return type of process is Object and not String. If I change the Op interface, removing the generic, the code works like intended: interface Op{ &lt;R&gt; R process(Mapper&lt;R&gt; mapper); } Why is the compiler not accepting the generics definition in Op interface?
type: AnsweredQuestion

http://stackoverflow.com/q/25361877
tagged with: image
has comment: http://stackoverflow.com/comment/39693941
accepted answer: http://stackoverflow.com/a/25497085
score: 0
tagged with: java
answer count: 1
has title: No ONE Here to help me !... Frustated about Different Size but same result when rendered
has body: Update : I am sorry, i earned tumbleweed badge before, and this thread also has been quiet for a whole day... I am editing whole my question as it might not so clear for others to help. Take a look at this game image I am modifying super jumper game (Mario Zechner's Beginning Android Game) , i've come to stuck in this issue: if you look at my image link above, you could see that my character image rendered in same size with the spring image. i'm using texture atlas 1024x1024 px, spring = new TextureRegion(items, 980, 90, 32, 40); charJump = new Animation(0.2f, new TextureRegion(items,charX+32, charY, 64,160), new TextureRegion(items, charX+150, charY, 64, 160)); //char anim. I am using photoshop and put all the texture region required in my Atlas. For each character image frame has the size of 64x150 while the spring image only has the size of 30x40 the world class camera width and height = 11f x 14f the world renderer class camera width and height also = 11f x 14f Please give me some clue, what important knowledge i am missing here ? thank you.
tagged with: opengl-es
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39631590
has answer: http://stackoverflow.com/a/25497085
tagged with: android
tagged with: textures
has comment: http://stackoverflow.com/comment/39711951

http://stackoverflow.com/comment/39551447
type: QuestionComment
has text: ucp.jar, ons.jar and oracle jdbc driver jar all reside in tomcat lib directory.
score: 0
comment on: http://stackoverflow.com/q/25365013
type: Comment

http://stackoverflow.com/comment/39356425
score: 0
type: Comment
type: AnswerComment
has text: got this -> groovy.lang.MissingPropertyException: No such property: delegate for class: com.sun.proxy.$Proxy4
comment on: http://stackoverflow.com/a/25233717

http://stackoverflow.com/comment/39450873
score: 0
type: Comment
has text: That is true Chris but the time is the same on the "classic" HDD.
type: QuestionComment
comment on: http://stackoverflow.com/q/25308650

http://stackoverflow.com/a/25357748
answers question: http://stackoverflow.com/q/25357666
type: Answer
has body: Not possible with regular expressions at all, sorry. If you want to count opening and closing parantheses, regular expressions are, in general, not good enough. The language you are trying to parse is not a regular language. Of course, there may be ways around that limitation. We cannot know that if you give us as little context as you did.
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/25329480
score: 0
tagged with: java
tagged with: junit
has title: How to execute / import Selenium Web Driver Tests written in Java to Selenium IDE
type: Question
has answer: http://stackoverflow.com/a/25329985
has body: I tried to get answer to this question using the Selenium documentation and also stack exchange search and google search but I couldn't find an answer. I am new to Selenium so there might be a simple answer to it. We have developed some test cases using Eclipse IDE and JUnit with Selenium. We would like to execute these test cases using Selenium IDE. The scenario is that a techy QA analyst used Java to create the test cases. Now, we need other QA / functional team to be able to execute these tests using their browsers. How do we accomplish this using Selenium tool set? Thank you for your help.
type: UnansweredQuestion
answer count: 1
tagged with: selenium

http://stackoverflow.com/comment/39316189
type: QuestionComment
has text: Well, since it's a server-side error, what does the server log say?
score: 0
comment on: http://stackoverflow.com/q/25237380
type: Comment

http://stackoverflow.com/q/25380855
type: Question
tagged with: object-oriented-analysis
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25381291
has comment: http://stackoverflow.com/comment/39580975
tagged with: design-patterns
has title: Improve design of class hierarchy for a object formatter api
has comment: http://stackoverflow.com/comment/39580855
score: 0
has comment: http://stackoverflow.com/comment/39580980
tagged with: oop
has answer: http://stackoverflow.com/a/25381158
tagged with: java
has answer: http://stackoverflow.com/a/25381348
has body: While learning object oriented design I'm judging my own design critically. This framework should be able to print objects in either XML, or JSON, I've stubbed in a basic implementation to avoid getting into details of XML and Json parser apis for now. So I made the Formatter be the base class. But with my current design, all derivatives of this base class would need to know that they have to call: getFormattedValue() to get output. Also I don't feel comfortable with all of those if else statements in the Formatter constructor. The clients would need to know to pass in either an "xml" or "json" in all derivatives of this class. How can I improve this design to conform to all Object oriented design Principles? Thanks in advance.. public class Formatter { private String output; public Formatter(Object object, String formatType){ if(formatType.equals("xml")){ output = getXMLFormat(object); } else if(formatType.equals("json")) { output = getJSONFormat(object); } } private String getXMLFormat(Object object){ return "&lt;title&gt;"+object.toString()+"&lt;title&gt;"; // simplified } private String getJSONFormat(Object object){ return "{"+object.toString()+"}"; // simplified } protected String getFormattedValue(){ return output; } } The derivative class: public class ItemFormatter extends Formatter { public ItemFormatter(Employee item, String formatOutput) { super(item, formatOutput); } public void printItem(){ System.out.println(getFormattedValue()); } }
has answer: http://stackoverflow.com/a/25381411
answer count: 4

http://stackoverflow.com/comment/39362550
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25262792
score: 0
has text: Thank you for your response! This is making much more sense now. I have one final question and I believe I will fully understand what's going on. What do you mean by "first field" and what is the significance of retrieving the size of "first"?

http://stackoverflow.com/comment/39558228
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59527/discussion-between-user1754307-and-hot-licks).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25365930

trigonometry
tags question: http://stackoverflow.com/q/25350272
tags question: http://stackoverflow.com/q/25367430
type: Tag
tags question: http://stackoverflow.com/q/25383322
tag name: trigonometry

http://stackoverflow.com/q/25329110
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
answer count: 0
has body: I am a JAVA develper and I use Linux. I have an issue using HttpClient to connec to a REST API. But I have to connect to a proxy to get internet connection. The problem is i need to authenticate through a PROXY using the NTLM Windows protocol. The problem is how can I test my client to connect through NTLM. I use a simple authentication using UsernamePasswordCredentials, but when people try in their network they recive this message: "Credentials cannot be used for NTLM authentication" My questions again is, How can i test the situation? How can emulate this situation? Best Regards!
score: 1
tagged with: ntlm
tagged with: java
has title: How to test JAVA Aplication that connect through NTLM to a PROXY Server?
tagged with: apache-commons-httpclient
upvote count: 1

http://stackoverflow.com/q/25295987
has comment: http://stackoverflow.com/comment/39424499
has comment: http://stackoverflow.com/comment/39424799
has comment: http://stackoverflow.com/comment/39424387
answer count: 0
has body: I am making a simple java application using SWT GUI to save a txt file to a user defined location. When a button is clicked, I open the directories like this: DirectoryDialog directoryDialog = new DirectoryDialog(shell); directoryDialog.setFilterPath(selectedDir); directoryDialog.setMessage("Please select a directory and click OK"); String dir = directoryDialog.open(); Now I need to be able to make a file and save it to that location. How can I make and save to the user given location?
score: 0
tagged with: java
tagged with: swt
type: Question
has title: Saving txt file to a user-defined location in Java SWT
type: UnansweredQuestion

http://stackoverflow.com/comment/39358664
score: 1
comment on: http://stackoverflow.com/a/25260656
type: Comment
type: AnswerComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ - *yes*. Considering the fact that a *Happens-before* is not guaranteed *within* a synchronized block :)

http://stackoverflow.com/comment/39385371
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25231323
type: Comment
has text: I downloaded the latest source code 5.5.2. In com.itextpdf.text.pdf.PdfDiv, I just don't see there is any code that handles PdfDiv.Position = ABSOLUTE. I see code that handles PdfDiv.Position = RELATIVE, but not for ABSOLUTE, STATIC or FIX.

http://stackoverflow.com/a/25363398
upvote count: 274
type: AcceptedAnswer
downvote count: 2
accepted answer of: http://stackoverflow.com/q/25362540
has comment: http://stackoverflow.com/comment/108384176
has comment: http://stackoverflow.com/comment/57371235
has comment: http://stackoverflow.com/comment/133507842
has comment: http://stackoverflow.com/comment/115101215
score: 272
answers question: http://stackoverflow.com/q/25362540
has body: The spring data JPA query needs the "%" chars as well as a space char following like in your query, as in @Query("Select c from Registration c where c.place like %:place%"). Cf. http://docs.spring.io/spring-data/jpa/docs/current/reference/html. You may want to get rid of the @Queryannotation alltogether, as it seems to resemble the standard query (automatically implemented by the spring data proxies); i.e. using the single line List&lt;Registration&gt; findByPlaceContaining(String place); is sufficient.
has comment: http://stackoverflow.com/comment/115106044
has comment: http://stackoverflow.com/comment/135555822
has comment: http://stackoverflow.com/comment/95181558
type: Answer
has comment: http://stackoverflow.com/comment/60969294

http://stackoverflow.com/a/25371072
upvote count: 3
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/39563323
type: Answer
answers question: http://stackoverflow.com/q/25371014
has comment: http://stackoverflow.com/comment/39564201
has body: JLS $ 15.28. Constant Expressions A compile-time constant expression is an expression denoting a value of primitive type or a String that does not complete abruptly and is composed using only the following: Literals of primitive type and literals of type String (§3.10.1, §3.10.2, §3.10.3, §3.10.4, §3.10.5) Casts to primitive types and casts to type String (§15.16) The unary operators +, -, ~, and ! (but not ++ or --) (§15.15.3, §15.15.4, §15.15.5, §15.15.6) The multiplicative operators *, /, and % (§15.17) The additive operators + and - (§15.18) The shift operators &lt;&lt;, >>, and >>> (§15.19) The relational operators &lt;, &lt;=, >, and >= (but not instanceof) (§15.20) The equality operators == and != (§15.21) The bitwise and logical operators &amp;, ^, and | (§15.22) The conditional-and operator &amp;&amp; and the conditional-or operator || (§15.23, §15.24) The ternary conditional operator ? : (§15.25) Parenthesized expressions (§15.8.5) whose contained expression is a constant expression. Simple names (§6.5.6.1) that refer to constant variables (§4.12.4). Qualified names (§6.5.6.2) of the form TypeName . Identifier that refer to constant variables (§4.12.4). Compile-time constant expressions of type String are always "interned" so as to share unique instances, using the method String.intern. A compile-time constant expression is always treated as FP-strict (§15.4), even if it occurs in a context where a non-constant expression would not be considered to be FP-strict. Compile-time constant expressions are used in case labels in switch statements (§14.11) and have a special significance for assignment conversion (§5.2) and initialization of a class or interface (§12.4.2). They may also govern the ability of a while, do, or for statement to complete normally (§14.21), and the type of a conditional operator ? : with numeric operands.

http://stackoverflow.com/q/25377608
has body: Here's a basic question about multi-threading in Java: I have a very big mutable data structure (a tree, to be exact) and I understand that if I want to modify this data structure concurrently from two different threads, I need to use locks and/or other kinds of thread safety. However, in my case, the two threads don't need to modify the data structure at the same time; rather, thread A, which normally owns the data structure, should temporarily pass the latter to thread B, and thread B should pass the data structure back to thread A after having done some long-running modifications on it. Is it thread-safe to pass this mutable data structure back and forth between threads, if it's guaranteed that the threads do not modify the data at the same time?
score: 17
has comment: http://stackoverflow.com/comment/39575494
tagged with: concurrency
has answer: http://stackoverflow.com/a/25400563
possible better answer: http://stackoverflow.com/a/25377678
has comment: http://stackoverflow.com/comment/39575408
type: Question
has comment: http://stackoverflow.com/comment/39575182
has answer: http://stackoverflow.com/a/25377678
has answer: http://stackoverflow.com/a/25377700
tagged with: multithreading
downvote count: 0
has answer: http://stackoverflow.com/a/25377741
answer count: 7
has comment: http://stackoverflow.com/comment/39581036
has answer: http://stackoverflow.com/a/25378159
has title: Passing mutable data between threads
favorite count: 0
upvote count: 17
accepted answer: http://stackoverflow.com/a/25377711
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25377688
has answer: http://stackoverflow.com/a/25377711
tagged with: java

http://stackoverflow.com/comment/39415326
score: 0
type: Comment
type: QuestionComment
has text: Because Eclipse maven integration is terrible. Eclipse thinks it needs to know about every plugin that you use and if it doesn't it causes issues. I recommend going Netbeans or IntelliJ for maven projects (which is sad).
comment on: http://stackoverflow.com/q/25276747

http://stackoverflow.com/comment/39453519
comment on: http://stackoverflow.com/a/25311725
type: Comment
has text: You know for "Collections.sort(students, new CompareObj());" does it create a new sorted instance of the student list?
type: AnswerComment
score: 0

google-cloud-datastore
tags question: http://stackoverflow.com/q/25255667
tags question: http://stackoverflow.com/q/25238132
tags question: http://stackoverflow.com/q/25347100
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/25250458
type: Tag
tags question: http://stackoverflow.com/q/25234213
tags question: http://stackoverflow.com/q/25244539
tags question: http://stackoverflow.com/q/25323987

http://stackoverflow.com/q/25292734
has comment: http://stackoverflow.com/comment/39418826
has comment: http://stackoverflow.com/comment/39417800
has body: I'm writing an app that uses a "native library" (an executable with a .so filename so Android will put it in the correct spot), but it isn't being placed into the nativeLibraryDir given by getApplicationInfo.nativeLibraryDir (/data/app-lib/com...) or anywhere else on the phone. The location of the file inside the apk is /lib/armeabi/hello.so . The file was was packaged into the apk by placing it in app/src/main/jniLibs. Am I doing something wrong? EDIT: I'm using Gradle with Android Studio 0.8.4
score: 0
answer count: 0
tagged with: java
has title: Native libraries in apk aren't being put anywhere on phone
has comment: http://stackoverflow.com/comment/39418949
type: Question
has comment: http://stackoverflow.com/comment/39419137
has comment: http://stackoverflow.com/comment/39418454
has comment: http://stackoverflow.com/comment/39418118
has comment: http://stackoverflow.com/comment/39418072
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/25332976
downvote count: 0
has body: The last for loop should have a &lt; in its condition: for (int i = 0; i &lt; stockArr.length; i++){
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39493854
upvote count: 4
answers question: http://stackoverflow.com/q/25332951

http://stackoverflow.com/a/25377295
answers question: http://stackoverflow.com/q/25377224
type: Answer
has body: if you add View dynamically then it haven't id.id generate for make relation between xml widget and java you can set tag for your spinner and then getTag.
score: 0
has comment: http://stackoverflow.com/comment/39574786
has comment: http://stackoverflow.com/comment/39574941

http://stackoverflow.com/q/25255183
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39350904
tagged with: uuid
type: UnansweredQuestion
tagged with: jpa
linked to: http://stackoverflow.com/q/10950202
has comment: http://stackoverflow.com/comment/39349122
has comment: http://stackoverflow.com/comment/39349901
has body: I use varbinary(36) to save UUID in MySql as primary keys. And I use EclipseLink to auto gen my data objects. It gens primary key as String. I inserted data as below. When I use JPA to select * from country, the COUNTRY_ID becames: '66653565373765302D663832312D313165332D613361632D303830303230306339613636'. What am I doing wrong? INSERT INTO `didicity`.`country` (`COUNTRY_ID`, `NAME`, `SHORT_NAME`) VALUES ('fe5e77e0-f821-11e3-a3ac-0800200c9a66', 'United State', 'USA' ); @Id @Column(name = "COUNTRY_ID") private String countryId;
has comment: http://stackoverflow.com/comment/39349723
score: 0
answer count: 0
tagged with: eclipselink
has title: JPA changes UUID value
tagged with: java

http://stackoverflow.com/a/25307209
score: 0
answers question: http://stackoverflow.com/q/25307117
has body: The &amp; operator performs a bitwise AND operation. To use the logical AND operation, you have to use the &amp;&amp; operator. Your code should look like this: if(word.charAt(1)!='t' &amp;&amp; word.chatAt(2)!='t' &amp;&amp; word.chatAt(3)!='t' &amp;&amp; word.chatAt(4)!='t' &amp; word.chatAt(5)!='t' &amp;&amp; word.chatAt(6)!='t' &amp;&amp; word.chatAt(7)!='t' { guessesLeft--; }
type: Answer

http://stackoverflow.com/a/25277424
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39389576
accepted answer of: http://stackoverflow.com/q/25277337
type: Answer
answers question: http://stackoverflow.com/q/25277337
score: 2
upvote count: 2
has body: It works fine for me. Your system may not be outputting to UTF-8 as a default. You should always specify when you are using OutputStreamWriter. Change it to look like this: bw= new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"));

http://stackoverflow.com/q/25326423
has comment: http://stackoverflow.com/comment/39482474
downvote count: 0
has comment: http://stackoverflow.com/comment/39482428
favorite count: 0
has comment: http://stackoverflow.com/comment/39481294
type: Question
has comment: http://stackoverflow.com/comment/39482883
has comment: http://stackoverflow.com/comment/39482256
answer count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4795104
tagged with: encryption
tagged with: android
has comment: http://stackoverflow.com/comment/39483002
has comment: http://stackoverflow.com/comment/39481290
has title: Stream Audio File During Decryption with Mediaplayer in Android
has comment: http://stackoverflow.com/comment/39482445
has body: I have some locally stored mp3 files which are already encrypted. I want to play (stream) the files while they're decrypting rather than waiting for them to finish decrypting, then stream. However, when I use the FileDescriptor and attempt to stream the content, I get an IOException: Unable to to create media player setDataSourceFD failed.: status=0x80000000 java.io.IOException: setDataSourceFD failed.: status=0x80000000 at android.media.MediaPlayer.setDataSource(Native Method) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:976) How can I resolve this issue and stream content as it decrypts? P.S. I'm able to play already the already decrypted files, but I want them to play during the process of decryption to reduce the time taken before audio can play
score: 2
tagged with: audio
has comment: http://stackoverflow.com/comment/39483286
tagged with: java

ejb-3.0
tags question: http://stackoverflow.com/q/25312916
tag name: ejb-3.0
type: Tag
tags question: http://stackoverflow.com/q/25242882

http://stackoverflow.com/comment/39511185
comment on: http://stackoverflow.com/a/25342643
type: AnswerComment
has text: @OliCharlesworth Well, to be fair, I like the minutiae from time to time .. (but not here, where it adds little/no value)
score: 1
type: Comment

http://stackoverflow.com/comment/39329952
score: 0
comment on: http://stackoverflow.com/q/25245098
type: Comment
type: QuestionComment
has text: i've fixed it so that DATAOUT() no longer returns null but now whenever either option is selected no code is excecuted @CommonsWare

notifications
tags question: http://stackoverflow.com/q/25366653
tags question: http://stackoverflow.com/q/25331797
tag name: notifications
type: Tag
tags question: http://stackoverflow.com/q/25373200

http://stackoverflow.com/comment/39549990
type: QuestionComment
score: 0
has text: You bet. There is no straightforward mechanism to do that. When you compile class the field definitions became constant. So if you would like to change this, you would need to change bytecode. When you do such tricks with JSon you are using some kind of preprocessor - all in all something has to process your annotations. Still, modifications are done with POJOS - eg. lets modify key name in map - simple. But here, you want to change definition of class on runtime, so the javaassist would be the way to do it
comment on: http://stackoverflow.com/q/25364095
type: Comment

http://stackoverflow.com/comment/39545043
type: Comment
type: QuestionComment
has text: You should use executeQuery() method that returns ResultSet and check that if it contains any records. ANd by the way this is really bad practice to have code like that in the JSP...
score: 2
comment on: http://stackoverflow.com/q/25361974

http://stackoverflow.com/comment/39541232
comment on: http://stackoverflow.com/q/25359818
has text: Are you sure that it said to always use Vector and not to never use Vector?
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39586566
type: QuestionComment
has text: I guess you need to get another book.
score: 4
type: Comment
comment on: http://stackoverflow.com/q/25383863

selenium
tags question: http://stackoverflow.com/q/25288087
tags question: http://stackoverflow.com/q/25264767
tags question: http://stackoverflow.com/q/25386295
tags question: http://stackoverflow.com/q/25329480
tags question: http://stackoverflow.com/q/25386598
tags question: http://stackoverflow.com/q/25354989
tags question: http://stackoverflow.com/q/25367028
tags question: http://stackoverflow.com/q/25261658
tags question: http://stackoverflow.com/q/25232239
tags question: http://stackoverflow.com/q/25249000
tags question: http://stackoverflow.com/q/25267835
tags question: http://stackoverflow.com/q/25355364
tags question: http://stackoverflow.com/q/25363689
tags question: http://stackoverflow.com/q/25261217
tags question: http://stackoverflow.com/q/25268131
tags question: http://stackoverflow.com/q/25339025
tags question: http://stackoverflow.com/q/25264701
tags question: http://stackoverflow.com/q/25355022
tags question: http://stackoverflow.com/q/25241773
tags question: http://stackoverflow.com/q/25285439
tags question: http://stackoverflow.com/q/25286515
tags question: http://stackoverflow.com/q/25315196
tags question: http://stackoverflow.com/q/25383394
tags question: http://stackoverflow.com/q/25233804
tags question: http://stackoverflow.com/q/25323403
tags question: http://stackoverflow.com/q/25268957
tags question: http://stackoverflow.com/q/25296569
tags question: http://stackoverflow.com/q/25295089
tags question: http://stackoverflow.com/q/25230226
type: Tag
tags question: http://stackoverflow.com/q/25251083
tags question: http://stackoverflow.com/q/25239024
tags question: http://stackoverflow.com/q/25327340
tags question: http://stackoverflow.com/q/25284715
tags question: http://stackoverflow.com/q/25373346
tag name: selenium
tags question: http://stackoverflow.com/q/25296181
tags question: http://stackoverflow.com/q/25281161
tags question: http://stackoverflow.com/q/25321275
tags question: http://stackoverflow.com/q/25295943
tags question: http://stackoverflow.com/q/25271376
tags question: http://stackoverflow.com/q/25332591

http://stackoverflow.com/comment/39520523
score: 0
has text: Why is the speed of initialisation critical? That's a rather strange constraint. Usually it's the other way around. Reading all your configurations from a file is the straightforward thing to do.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25348388

http://stackoverflow.com/q/25281616
answer count: 2
has body: I want to get the date interval for each month in a given month.I have three Edit Text .I have enter date in 1st EditText and i have enter 30 days in 2nd Edit Text and I want to display that date after 30 days in 3rd Edit Text. After that 30 days it should be display in 3rd Edit Text date in 1st EditText.Can someone help me please. Thanks to appreciate. Like 1 Oct -> 1 Nov, 2 Nov -> 1 dec, 2 dec -> 1 jan, 2 Jan -> 1 feb Here is my Activity Code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_details); // Get current date by calender final Calendar c = Calendar.getInstance(); year = c.get(Calendar.YEAR); month = c.get(Calendar.MONTH); day = c.get(Calendar.DAY_OF_MONTH); etReplacementDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(month + 1).append("-").append(day).append("-") .append(year).append(" ")); etInterval_Date.setText(new StringBuilder() // Month is 0 based, just add 1 .append(month + 1).append("-").append(day).append("-") .append(year).append(" ")); etReplacementDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(DATE_OF_REPLACEMENT); } }); etInterval_Date.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(DATE_OF_INTERVAL); } }); @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_OF_REPLACEMENT: return new DatePickerDialog(this, pickerListenerReplacement, year, month, day); case DATE_OF_INTERVAL: return new DatePickerDialog(this, pickerListenerInterval, year, month, day); } return null; } private DatePickerDialog.OnDateSetListener pickerListenerReplacement = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. @Override public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { year = selectedYe…
has comment: http://stackoverflow.com/comment/39398626
possible better answer: http://stackoverflow.com/a/25281787
upvote count: 1
has answer: http://stackoverflow.com/a/25281822
has answer: http://stackoverflow.com/a/25281787
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25281822
downvote count: 1
has title: How to get Interval Date in Android?
favorite count: 0
linked to: http://stackoverflow.com/q/11727933
type: Question

http://stackoverflow.com/comment/39546340
comment on: http://stackoverflow.com/q/25306743
type: QuestionComment
has text: I don't think it's a question of importance. So all of this sounds like additional software? I thought to just solve it with my Java application. Filters or interceptors that handle it...
score: 0
type: Comment

http://stackoverflow.com/a/25231944
accepted answer of: http://stackoverflow.com/q/25231571
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25231571
has comment: http://stackoverflow.com/comment/79294869
has body: The package name for Google Play Books is com.google.android.apps.books (the end of the URL). Using that, you can launch the app using code such as: String PLAY_BOOKS_PACKAGE_NAME = "com.google.android.apps.books"; PackageManager packageManager = context.getPackageManager(); Intent launchIntent = packageManager .getLaunchIntentForPackage(PLAY_BOOKS_PACKAGE_NAME); if (launchIntent != null) { startActivity(launchIntent); } else { Toast.makeText(context, "Google Books is NOT Installed", Toast.LENGTH_SHORT).show(); }
type: Answer
has comment: http://stackoverflow.com/comment/79295018
score: 0
has comment: http://stackoverflow.com/comment/79295106

http://stackoverflow.com/q/25312377
score: 0
upvote count: 1
tagged with: java
has title: Which Layout should be used?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39454709
answer count: 2
has answer: http://stackoverflow.com/a/25312512
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25312706
downvote count: 1
has comment: http://stackoverflow.com/comment/39454602
has comment: http://stackoverflow.com/comment/39454477
has body: I'm kind of new to the whole "how to arrange your components" thing in JAVA and I couldn't figure out how to realise the following JFrame (I can't post images so I just put the link) I tried to be as precise as possible about what I already did. I would like your advice about how to arrange the green part. Thanks! EDIT: as some people rightfully said, I didn't put the code of what I did. Here it is: public Frame(){ this.setTitle("Small application"); this.setSize(445, 500); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); this.setResizable(false); JPanel container = new JPanel(); container.setLayout(new BorderLayout()); //Title JLabel title = new JLabel("Welcome to this application"); title.setHorizontalAlignment(JLabel.CENTER); title.setPreferredSize(new Dimension(200,50)); title.setFont(new Font("Courrier",Font.BOLD,20)); container.add(title, BorderLayout.NORTH); //Center part JPanel centerPart = new JPanel(); JLabel cell1 = new JLabel("Enter all measurements:"); cell1.setPreferredSize(new Dimension(150,20)); JLabel cell2 = new JLabel("Please, select the files..."); cell2.setPreferredSize(new Dimension(150,20)); cell2.setBackground(Color.white); cell2.setBorder(BorderFactory.createLineBorder(Color.black)); cell2.setOpaque(true); JButton cell3 = new JButton("Browse"); cell3.setPreferredSize(new Dimension(100,20)); centerPart.add(cell1); centerPart.add(cell2); centerPart.add(cell3); container.add(centerPart, BorderLayout.CENTER); /* * I need your help here :) * I can't figure out how to put the image and the text next to it */ //Bottom part JPanel bottom = new JPanel(); JButton graph = new JButton("Graph"); JButton exit = new JButton("Exit"); bottom.add(graph); bottom.add(exit); container.add(bottom, BorderLayout.SOUTH); this.setContentPane(container); }

http://stackoverflow.com/comment/118075153
comment on: http://stackoverflow.com/a/25337448
has text: This works much better than the other solution, especially since I have extra demands that OP didn't have and it still worked for me.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39576061
comment on: http://stackoverflow.com/q/25377565
type: Comment
score: 0
type: QuestionComment
has text: I think you are not closing cursors, that is why you see this error. Try to add statement "CLOSE Get_EmpInfo;" before procedure end.

http://stackoverflow.com/q/25302277
type: Question
has comment: http://stackoverflow.com/comment/39435854
tagged with: eclipse-rcp
tagged with: debugging
tagged with: java
has title: How to find out which process eats up CPU?
score: -1
linked to: http://stackoverflow.com/q/2362107
has body: I have an eclipse RCP application, which, after some reproducible events occur eats up 100 % of CPU. I can connect to it from another Eclpse instance in debug mode. Does the Eclipse debugger allow to find out where exactly the problem is (what thread consumes the CPU power) ?
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25302336
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39549718
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25302336
favorite count: 0

jna
tags question: http://stackoverflow.com/q/25303737
tags question: http://stackoverflow.com/q/25325365
type: Tag
tags question: http://stackoverflow.com/q/25274826
tags question: http://stackoverflow.com/q/25246353
tags question: http://stackoverflow.com/q/25286519
tags question: http://stackoverflow.com/q/25250754
tag name: jna
tags question: http://stackoverflow.com/q/25387238

http://stackoverflow.com/a/25312950
answers question: http://stackoverflow.com/q/25312797
upvote count: 3
downvote count: 0
has body: Imagine the two threads executing in parallel: thread1 thread2 ----------------------------------- ----------------------------------- enter alphonse.bow(gaston) enter gaston.bow(alphonse) - acquire lock on alphonse - acquire lock on gaston gaston.bowBack(alphonse) alphonse.bowBack(gaston) - try to acquire lock on gaston; - try to acquire lock on alphonse; blocked because of gaston.bow() blocked because of alphonse.bow() At this point, both threads are waiting for the other to release a lock, and neither can complete the synchronized method so that it'll release the lock (because it's waiting for the other).
type: Answer
score: 3

http://stackoverflow.com/comment/39339637
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25250127
has text: It is not exactly clear what you help you are trying to get on SO. Since the only thing you are looking for is to be able to call a function it is *theoretically* possible. Would it be good idea - likely not, especially since you have no source/supported way to call it. You may want to either consider it educational exercise and build your own native library to learn on. You will know what fails and will be able to make this question more generic but with complete code. Alternatively drop this idea altogether as it will likely cause you even more pain in the future.
score: 0

http://stackoverflow.com/comment/39519042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25347564
score: 2
has text: Yes, you can. It will not be easy, and it probably won't give you a performance improvement over threads. (in fact it will probably make things slower)

http://stackoverflow.com/comment/39434841
comment on: http://stackoverflow.com/a/25301313
score: 0
type: Comment
type: AnswerComment
has text: hehehe i also dont know in deep but using that key i can generate application id and will missuse it in any kind of ways actually it is unique key assoicated with your machine so if that key will get to know anyone else (hacker) then he knows what to do with it hehehe

http://stackoverflow.com/comment/39442986
type: Comment
has text: Yes, 8 concentric circles based on the radii and centers are all in the middle of the square. Gray color is for circle perimeters. The size of the circle varies according to the values. When the size of the circles increases, i need variation in the gray color according to the increasing factor, that is radius of the circle.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25305280

http://stackoverflow.com/a/25248561
score: 0
has body: You should test for the "empty" case. Supposing an array named "elements": if elements.isEmpty() { deleteButton.disable(); } The best is to disable the delete button when there is no elements in the array.
type: Answer
answers question: http://stackoverflow.com/q/25248419

storage
tag name: storage
tags question: http://stackoverflow.com/q/25276398
type: Tag

http://stackoverflow.com/q/25258243
has body: I have a rich client application based on eclipse-plugins/rcp/swt which is being used on windows 8 touch screen tablets. As tablets have screen rotation feature with Portrait and Landscape modes, I want to change some part of the UI based on the screen mode so that UI looks better according to the current mode. Is there any way to listen to the screen rotation events in swt?
answer count: 0
downvote count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: swt
tagged with: windows-8.1
has comment: http://stackoverflow.com/comment/39378889
has title: Is there any way to listen to the screen rotation events in swt based desktop applications for windows 8 Tablets?
tagged with: eclipse-plugin
favorite count: 0
type: Question
tagged with: eclipse-rcp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39394969

http://stackoverflow.com/comment/39413429
type: AnswerComment
has text: @AngryJuice: do you have any prove for your “multiple times slower than they should”? The cost of synchronization are often over-estimated.
comment on: http://stackoverflow.com/a/25290011
score: 1
type: Comment

http://stackoverflow.com/a/25299575
has comment: http://stackoverflow.com/comment/107068361
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25298691
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25298691
has body: You may use Files Utility of Guava , and use the method of Files.getFileExtension(String String fullName) System.out.println(Files.getFileExtension("C:\\fileName.txt")); The output is: txt The source code is pretty simple though, public static String getFileExtension(String fullName) { checkNotNull(fullName); String fileName = new File(fullName).getName(); int dotIndex = fileName.lastIndexOf('.'); return (dotIndex == -1) ? "" : fileName.substring(dotIndex + 1); }
score: 14
upvote count: 14

http://stackoverflow.com/q/25306883
has body: I am getting the following error with my maven in eclipse. The container 'Maven Dependencies' references non existing library '.....\.m2\repository\sun\jdk\jconsole\jdk\jconsole-jdk.jar' I do not have a reference for jconsole-jdk.jar file in my pom.xml . My pom.xml is avaialble at http://pastebin.com/tdxmtHqN Appreciate the help. I am stuck because of this issue. Update: I removed all the dependencis and added it one by one. I got the error when I added the following depenency. org.wildfly wildfly-spec-api 8.1.0.Final pom test Regards -Albin
has answer: http://stackoverflow.com/a/27191203
has answer: http://stackoverflow.com/a/25307032
score: 1
has answer: http://stackoverflow.com/a/39905223
has title: The container 'Maven Dependencies' references non existing library jconsole-jdk.jar
tagged with: java
linked to: http://stackoverflow.com/q/25362127
downvote count: 0
has answer: http://stackoverflow.com/a/32087513
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: maven
answer count: 4

http://stackoverflow.com/comment/39454972
comment on: http://stackoverflow.com/q/25312296
type: QuestionComment
type: Comment
has text: Have you set a breakpoint in HibernateTransactionManager to check if your program is entering the transactional AOP?
score: 0

http://stackoverflow.com/comment/39339298
type: Comment
type: AnswerComment
has text: @Jens To be brief I am working on restful services, my third party API is returning date in long format. I am following CST time. My target is to convert the long date (20140811) to today datetime format with minutes, second and milliseconds then store it in database.
comment on: http://stackoverflow.com/a/25249942
score: 0

http://stackoverflow.com/a/25298812
has comment: http://stackoverflow.com/comment/39430169
answers question: http://stackoverflow.com/q/25298769
has body: You can get the price by CSS selector: Element price = doc.select("div#regionalized-price &gt; p.offer-price").first(); System.out.println(price.text()); div#regionalized-price &gt; p.offer-price means: give me the p tag with class offer-price that is right inside the div element with id="regionalized-price". But, the actual problem is that the price is loaded asynchronously via an XHR request to http://www.homedepot.ca/async-fetch-regional-price?storeId=9999&amp;pnList=907316 which returns an XML: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; &lt;mdata:Response xmlns:mdata="http://www.endeca.com/MDEX/data/IR600"&gt; &lt;mdata:UntypedResult&gt; &lt;product-price partnumber="907316" reg-price="69.98" promo-price="69.98" price-msg=""/&gt; &lt;/mdata:UntypedResult&gt; &lt;/mdata:Response&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; You would need to simulate this additional request and get the price from the product-price element.
has comment: http://stackoverflow.com/comment/39430316
accepted answer of: http://stackoverflow.com/q/25298769
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39429716
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/25320541
has title: Junit Test for a class which has abstract class object
type: AnsweredQuestion
score: 0
tagged with: java
has body: i am writing a Junit test case for a class which has an object of an another abstract class. i tried to define the beans for both classes in my application context but it gives Could not instantiate bean class: Is it an abstract class?; nested exception is java.lang.InstantiationException here's the situation. my Abstract class : public abstract class classA{ public returnType methodA{//method logic} public returnType methodB{//method logic} } another class which uses abstract class object public class classB { @Autowired classA classa; public returnType methodB{ variable c = classa.methodA(); variable d = somelogic(c); return d } } my applicationContextTest is &lt;bean id="classa" name="classa" class="package.classA"/&gt; &lt;bean id="classb" class="package.classB"&gt; &lt;property name="classa" ref="classa"&gt;&lt;/property&gt; &lt;/bean&gt; and i have not written this classes so i have no idea why the author has not extended the abstract class and i can not make any changes in class definitions. Autowiring works perfectly fine in application and i have enabled component scan for beans in application. but for test application context i define bean definitions manually.
answer count: 1
tagged with: junit
accepted answer: http://stackoverflow.com/a/25321408
has answer: http://stackoverflow.com/a/25321408
type: Question
tagged with: dependency-injection
tagged with: spring

http://stackoverflow.com/a/25332979
has comment: http://stackoverflow.com/comment/39493880
has body: Check your run-condition for the second for-loop: for (int i = 0; i &gt; stockArr.length; i++){ if(stockArr[i].equals("BusinessContact")){ System.out.println("test"); } } I think you rather meant for (int i = 0; i &lt; stockArr.length; i++){ if(stockArr[i].equals("BusinessContact")){ System.out.println("test"); } }
answers question: http://stackoverflow.com/q/25332951
downvote count: 0
type: Answer
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39493848

http://stackoverflow.com/q/25353414
has comment: http://stackoverflow.com/comment/39529468
has comment: http://stackoverflow.com/comment/39529777
has comment: http://stackoverflow.com/comment/39529618
duplicate of: http://stackoverflow.com/q/2307688
has comment: http://stackoverflow.com/comment/39529634
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39529397
has comment: http://stackoverflow.com/comment/39529383
linked to: http://stackoverflow.com/q/21290104
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39529654
has title: Android: NullPointerException, ArrayList, Initialized, Compatible Types
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/2307688
has body: Running into a really strange thing here. I have an array list, that is initialized to the proper object class. I create an instance of that class. When I call the ArrayList.add method(s), I get a non-catchable NullPointerException. (I put it alone in between a try/catch, and still it doesn't work). IDE: Eclipse; developing an android app. Here's sample code: ArrayList&lt;ClassName&gt; items = new ArrayList&lt;ClassName&gt;(); ClassName item = new ClassName(); items.add(item); -- or -- items.add(0, item); I've isolated that this is the only line of code that is throwing the non-catchable NullPointerException. Furthermore, there is no "caused by" line showing up in the stack trace; it just jumps to NullPointerException after outputting a process ID with my package name. Is there a known bug in Android with handling NullPointerExceptions? Also, of note, though it crashed the activity from view, it can still run in the background. I've inspected the XML files and put them as bare as I can. Cleaning the project didn't help, either. EDIT: (added stack trace): 08-17 13:41:51.200: D/jdwp(4000): Got wake-up signal, bailing out of select 08-17 13:41:51.200: D/dalvikvm(4000): Debugger has detached; object registry had 1 entries 08-17 13:41:51.210: D/dalvikvm(4026): Late-enabling CheckJNI 08-17 13:41:51.210: I/ActivityManager(752): Start proc com.example.packagename for activity com.example.packagename/.MainActivity: pid=4026 uid=10081 gids={50081} 08-17 13:41:51.220: I/MicrophoneInputStream(1457): mic_close fib@42ef1210 08-17 13:41:51.290: I/HotwordRecognitionRnr(1457): Stopping hotword detection. 08-17 13:41:51.290: I/HotwordRecognitionRnr(1457): Hotword detection finished 08-17 13:41:51.300: I/System.out(4026): addItem: this.items [], 0 08-17 13:41:51.300: I/System.out(4026): addItem: item com.example.packagename.ClassName@42eee1c8 08-17 13:41:51.330: I/Adreno-EGL(4026): &lt;qeglDrvAPI_eglInitialize:320&gt;: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbD…
has comment: http://stackoverflow.com/comment/39529417
score: 0
has comment: http://stackoverflow.com/comment/39529427
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39529529

http://stackoverflow.com/a/53038356
type: Answer
answers question: http://stackoverflow.com/q/25356545
score: 0
has body: Through the reflection to solve this problem fun setUserRequired() { var state = Environment.getExternalStorageDirectory() if ("mounted".equals(state)) { try { var environmentcls = Class.forName("android.os.Environment"); var setUserRequiredM = environmentcls.getMethod("setUserRequired", Boolean::class.java); setUserRequiredM.invoke(null, false); } catch (e: Exception) { e.printStackTrace() } } }

http://stackoverflow.com/comment/39552258
has text: @chrisapotek in fact, akka utilizes netty, so likely your question is similar to "what is the difference between wheel and vehicle?"
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25365556
score: 2

http://stackoverflow.com/q/25367999
accepted answer: http://stackoverflow.com/a/25368275
has comment: http://stackoverflow.com/comment/39556969
has answer: http://stackoverflow.com/a/25368275
has body: I was looking at the Java code implementing a binary search tree shown here and I thought that it would be better if the inner class Node was in fact turned into a static nested class. However, adding the static keyword in front (I thought I could do this since the inner class does not in fact anywhere use the instance of the enclosing class -- the one I can access in the Node inner class as BST.this -- that is bound to it) resulted in multiple errors which were not extremely helpful. As far as I'm aware, java.util.LinkedList and similar also used static nested classes to define the nodes stored inside and are also parameterized (and, of course, work without any problems). Anyone care to elaborate? Thanks.
type: AnsweredQuestion
score: 3
has title: Static nested class inside parameterized class
upvote count: 3
tagged with: java
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39557140
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39556843

http://stackoverflow.com/comment/39512386
has text: thanks for the answer. but can you please tell me why it works for Orange but not for Green?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25343531
score: 0

http://stackoverflow.com/comment/39438122
score: 0
has text: @RuchiraGayanRanaweera This is just a matter of definition.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25303024

http://stackoverflow.com/a/25360679
answers question: http://stackoverflow.com/q/25360534
has body: I think this is because you have not used try-catch or throw in your code. Use try- catch block in your code. And then check if the problem is solved..
score: 0
type: Answer

http://stackoverflow.com/comment/39443425
comment on: http://stackoverflow.com/a/25266709
type: AnswerComment
score: 0
has text: it was a pleasure to help you :) sign you issue as solved with accepted answer :)
type: Comment

http://stackoverflow.com/q/25329332
downvote count: 1
has answer: http://stackoverflow.com/a/25330593
favorite count: 0
has title: How to fix this deadlock code in java?
has comment: http://stackoverflow.com/comment/39486755
type: Question
score: 3
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39487403
linked to: http://stackoverflow.com/q/25312797
has comment: http://stackoverflow.com/comment/39487063
upvote count: 4
linked to: http://stackoverflow.com/q/749641
tagged with: deadlock
has answer: http://stackoverflow.com/a/25329947
answer count: 2
has body: I got this deadlock sample codes from oracle. class Thread_Test { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } public synchronized void bow(Friend bower) { System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName()); bower.bowBack(this); } public synchronized void bowBack(Friend bower) { System.out.format("%s: %s" + " has bowed back to me!%n", this.name, bower.getName()); } } public static void main(String[] args) { final Friend alphonse = new Friend("Alphonse"); final Friend gaston = new Friend("Gaston"); new Thread(new Runnable() { public void run() { alphonse.bow(gaston); } }).start(); new Thread(new Runnable() { public void run() { gaston.bow(alphonse); } }).start(); } } If I change function bow like below, I can resolve the deadlock issue. public void bow(Friend bower) { synchronized(this) { System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName()); } bower.bowBack(this); } Can I use other approaches to resolve this deadlock issue. Especially, I wonder that Thread.sleep() can be a solution for deadlock and how I can use it. Could you let me know about the possibility of Thread.sleep() and other approaches? Thanks alot

http://stackoverflow.com/comment/39395201
type: QuestionComment
has text: This works because Java support this.
comment on: http://stackoverflow.com/q/25280665
score: 0
type: Comment

http://stackoverflow.com/comment/39407961
comment on: http://stackoverflow.com/a/25287424
has text: but i want to provide that data out of application also.So is there any other option for that?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25237176
has answer: http://stackoverflow.com/a/25240145
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/59631475
tagged with: download-manager
score: 1
tagged with: android
tagged with: java
has title: Download Manager Unable to Resume Download in case of Internet Disconnection and System Reboot
has body: I have created a simple application which is supposed to download large zip files. After some R&amp;D I came to the conclusion that I have to use Download Manager to achieve this. I want the download to resume automatically if the device is restarted or in case of unstable internet connectivity. Right now, the code is able to download large files as expected, but in case of internet connectivity fluctuations or system restart, it stops downloading. The activity: public class MainActivity extends ActionBarActivity { String Download_path = "http://wickedbrains.com/map/mumbai.zip"; String Download_ID = "DOWNLOAD_ID"; SharedPreferences preferenceManager; DownloadManager downloadManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); preferenceManager = PreferenceManager.getDefaultSharedPreferences(this); downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE); Button btnDownload = (Button)findViewById(R.id.download); btnDownload.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { // Locate storage location String filepath = ""; File folder = new File( Environment.getExternalStorageDirectory() + "/osmdroid"); boolean success = true; if (!folder.exists()) { success = folder.mkdir(); } if (success) { // Do something on success filepath = Environment.getExternalStorageDirectory() .getPath() + "/osmdroid"; // Deleting if zip file exists File folder2 = Environment.getExternalStorageDirectory(); String fileName = folder2.getPath() + "/osmdroid/mumbai.zip"; File myFile = new File(fileName); if(myFile.exists()) myFile.delete(); } //Starting download manager to download file Uri Download_Uri = Uri.parse(Download_path); DownloadManager.Request request = new DownloadManager.Request(Download_Uri); long download_id = downloadManager.enqueue(request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |DownloadManager.Request.NETWORK_…
type: AnsweredQuestion
tagged with: android-download-manager
answer count: 3
accepted answer: http://stackoverflow.com/a/25237522
possible better answer: http://stackoverflow.com/a/25240145
downvote count: 0
has answer: http://stackoverflow.com/a/25237522
upvote count: 1

http://stackoverflow.com/comment/39434591
type: Comment
type: QuestionComment
has text: Wouldn't it be better to just select the timeslot? Now you are querying all timeslots to only display one.
score: 1
comment on: http://stackoverflow.com/q/25298526

http://stackoverflow.com/comment/39580296
score: 0
type: Comment
has text: And why do you want to change your configuration to XML?
type: QuestionComment
comment on: http://stackoverflow.com/q/25378910

http://stackoverflow.com/comment/39308989
score: 3
comment on: http://stackoverflow.com/q/25234029
type: Comment
type: QuestionComment
has text: BTW, your class hierarchy doesn't make much sense. A Kitchen is not a House. A Bathroom is not a House. They shouldn't be sub-classes of House. They should probably be sub-classes of Room, and House should contain a Collection of Rooms.

http://stackoverflow.com/comment/39572771
has text: override `toString` method
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25376220
type: Comment

http://stackoverflow.com/comment/39475075
has text: I tried a similar case and it worked well for me. Maven 3.0.5, Compiler plugin 2.3.2.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25323258
type: QuestionComment

http://stackoverflow.com/comment/39394394
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25280135
has text: Basically you will need to replace lines you labeled 1-9 with something similar to what I posted in my second code block. You will need to change variable names though, as in "in" would be "fileInputStream" and "out" would be "dos".
type: Comment

http://stackoverflow.com/comment/39502771
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25337883
has text: WOW! I get it now. Thank you so much for your help, I'm done with my assignment.

http://stackoverflow.com/q/25334793
has answer: http://stackoverflow.com/a/25337249
has comment: http://stackoverflow.com/comment/39498534
tagged with: producer-consumer
has comment: http://stackoverflow.com/comment/39498566
has body: I am currently doing a producer consumer problem with multiple threads. There are 1000 bytes available at first and 500 have been taken up by using the RAM nad drivers, leaving me to work with 500 for the threads. There are to be 4 producers, as follows: A thread to start a BubbleWitch2 session of 10 seconds, which requires 100 bytes of RAM per second A thread to start a Spotify stream of 20 seconds, which requires 250 bytes of RAM per second. System and management threads, which, together, require 50 bytes of RAM per second, and execute for a random length of time, once invoked. A thread to install a new security update of 2 KB, which will be stored to disk, and requires 150 bytes of RAM per second while installing. Assume sufficient disk capacity in the system to support this thread. The program is meant to cease execution when the security update has finished. Ideally, this should be achieved without setting priorities on the threads. It was working earlier but now when I run the program, the security thread is finishing in the middle and spotify is finishing laugh. Are there any mistakes that may be causing this? I have included my code below. I have yet to assign all of the byte sizes to the threads and buffer. My main method. /** * Created by User on 10/08/2014. */ public class ProducerConsumerTest { public static void main(String[] args) throws InterruptedException { Buffer c = new Buffer(); BubbleWitch2 p1 = new BubbleWitch2(c, 1); Processor c1 = new Processor(c, 2); Spotify p2 = new Spotify(c, 3); SystemManagement p3 = new SystemManagement(c,4); securityUpdate p4 = new securityUpdate(c,5, p1,p2,p3); p1.setName("BubbleWitch2 "); p2.setName("Spotify "); p3.setName("System Management "); p4.setName("Security Update "); c1.start(); p1.start(); p2.start(); p3.start(); p4.start(); p2.join(); p3.join(); p4.join(); System.exit(0); } } My buffer/cubbyhole class /** * Created by User on 10/08/2014. */ class Buffer { private int contents; private boolean available = f…
has title: java producer consumer issue-make thread wait until others have finished before completing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39498547
score: 2
possible better answer: http://stackoverflow.com/a/25337249
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39499564
accepted answer: http://stackoverflow.com/a/25337325
has comment: http://stackoverflow.com/comment/39497935
has answer: http://stackoverflow.com/a/25337325
downvote count: 1
tagged with: synchronization
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39499109
tagged with: time
linked to: http://stackoverflow.com/q/25373149
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39498644
has comment: http://stackoverflow.com/comment/39498656

http://stackoverflow.com/a/25363007
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39546995
accepted answer of: http://stackoverflow.com/q/25362984
has comment: http://stackoverflow.com/comment/39547106
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39547452
has comment: http://stackoverflow.com/comment/39547161
has comment: http://stackoverflow.com/comment/39546974
has body: FacesServlet doesn't extend from HttpServlet class containing a.o. doGet(). It just implements Servlet interface which offers the base service() method. Look here. JSF is designed to be compatible with both servlets and portlets. Portlets doesn't use HttpServlet, but PortletServlet which shares the common Servlet interface.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39547382
answers question: http://stackoverflow.com/q/25362984

http://stackoverflow.com/comment/39303889
score: 0
comment on: http://stackoverflow.com/q/25230927
type: Comment
type: QuestionComment
has text: Show us your code. We can't explain why code doesn't work without seeing the code.

http://stackoverflow.com/a/25242527
has comment: http://stackoverflow.com/comment/39325674
has body: The problems seems to be that you added style="display: none;" to the wrapping div, hence they are not displayed in the browser. &lt;div class="panel panel-default" id="pj" style="display: none;"&gt; If you remove the style the fields should just show up.
type: Answer
answers question: http://stackoverflow.com/q/25241462
score: 0

http://stackoverflow.com/comment/39562390
type: Comment
type: QuestionComment
has text: In order to see what version of openGL I had, I was instructed to enter System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION)); under the code I had to call the display method, and I received OpenGL version: 2.1 NVIDIA-8.26.26 310.40.45f01 In the console.
comment on: http://stackoverflow.com/q/25370670
score: 0

http://stackoverflow.com/a/25388068
has comment: http://stackoverflow.com/comment/137967533
score: 230
has comment: http://stackoverflow.com/comment/112908019
has comment: http://stackoverflow.com/comment/103368223
upvote count: 230
has comment: http://stackoverflow.com/comment/118733805
has body: The trick is to simply delimit the properties you want to sort by using the direction keywords Asc and Desc. So what you probably want in your query method is something like: …OrderByProgDateAscStartTimeAsc Note, how we conclude the first property definition by Asc and keep going with the next property. Generally speaking, we recommend switching to @Query based queries, once method names exceed a certain length or complexity. The main reason being that it's awkward for clients to call these very long methods. With @Query you rather get the full power of the query language plus a reasonably sized method name that might be of higher level language to express the intent of the query.
type: Answer
has comment: http://stackoverflow.com/comment/81686563
accepted answer of: http://stackoverflow.com/q/25380984
answers question: http://stackoverflow.com/q/25380984
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39604605
score: 0
comment on: http://stackoverflow.com/q/25382930
type: Comment
type: QuestionComment
has text: That's the best solution right now so thanks for that!

http://stackoverflow.com/a/25268639
has comment: http://stackoverflow.com/comment/39374517
has comment: http://stackoverflow.com/comment/39374286
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39373646
answers question: http://stackoverflow.com/q/25268370
has comment: http://stackoverflow.com/comment/39374036
score: 5
has comment: http://stackoverflow.com/comment/39374555
has body: public static long pow(long m,long n) { if (n &lt;= 0) { return 1; // Be lazy first } else if (n % 2 == 1) { return m * pow(m, n - 1); // Normal slow strategy } else { // n even long root = pow(m, n / 2); // Do not evaluate twice return root * root; } }
downvote count: 0
has comment: http://stackoverflow.com/comment/39374768
has comment: http://stackoverflow.com/comment/39374858
has comment: http://stackoverflow.com/comment/39374126
has comment: http://stackoverflow.com/comment/39373366

string-concatenation
tags question: http://stackoverflow.com/q/25340654
type: Tag
tag name: string-concatenation

wsdl
tags question: http://stackoverflow.com/q/25257801
tags question: http://stackoverflow.com/q/25284078
tags question: http://stackoverflow.com/q/25249893
tags question: http://stackoverflow.com/q/25377944
tags question: http://stackoverflow.com/q/25316691
tags question: http://stackoverflow.com/q/25298969
tags question: http://stackoverflow.com/q/25260939
type: Tag
tag name: wsdl

http://stackoverflow.com/comment/39478668
score: 0
type: AnswerComment
has text: Unfortunately i never really used that, i'm more a fan of database settings either local or through WCF service whenever i can. you should google `loading multiple setting files`
comment on: http://stackoverflow.com/a/25325047
type: Comment

http://stackoverflow.com/comment/39490515
has text: @Jashaszun http://ideone.com/ there's no excuse now :)
comment on: http://stackoverflow.com/q/25331328
type: Comment
type: QuestionComment
score: 0

jena-rules
tags question: http://stackoverflow.com/q/25342195
type: Tag
tag name: jena-rules

http://stackoverflow.com/q/25354944
type: UnansweredQuestion
tagged with: hashset
tagged with: string
duplicate of: http://stackoverflow.com/q/7632126
has comment: http://stackoverflow.com/comment/39532228
has comment: http://stackoverflow.com/comment/39532677
linked to: http://stackoverflow.com/q/7632126
tagged with: java
has comment: http://stackoverflow.com/comment/39560809
has title: Hashsets and size method
type: Question
score: 0
answer count: 0
has body: Well I have a hashset of strings and I want to use size() the problem is i dont know if hashsets size can be bigger then 2,147,483,647 and if i can get their size using bigint not int "so i wont be limited to 2,147,483,647" ? the point I am asking is not the size only , but i want to know if i can get it's size using big int since a limit of a hashset can be memory

http://stackoverflow.com/q/25243210
has comment: http://stackoverflow.com/comment/39326032
favorite count: 0
type: Question
type: UnansweredQuestion
score: 1
tagged with: java
has title: Forcing annotations in methods implementing abstract methods
linked to: http://stackoverflow.com/q/2056012
downvote count: 0
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39325855
has body: How can I force method implementing abstract method to use defined set of annotations? For example: public abstract class Foo { @Test @OtherAnnotation() public abstract void doSomething(int a); } public class Bar extends Foo { @Override // Question: How to force programmer to place annotations here? public void doSomething(int a) { ... } } Thank You for answers and comments. To extend my question and separate it from other similar ones: Would it be possible if it was testNG-related class?
has answer: http://stackoverflow.com/a/25243304

http://stackoverflow.com/a/43477504
type: Answer
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25356260
score: 3
has body: VisualVM counts a thread as using CPU time whenever the JVM thinks it's runnable. This means that any thread not waiting on a lock is considered runnable, more or less, including threads waiting for I/O in the kernel! This is where the large amount of CPU usage in com.myql.jdbc.utils.ReadAheadInputStream.fill() is coming from. So instead of a CPU problem you have an I/O problem. There are some things you can do on the JVM side, but not a lot of straightforward optimizing: Tweak the connection pool size. 1,000 concurrent queries is a lot. Unless your MySQL instance is truly massive it's going to have trouble handling that level of load, and eat up a lot of time just switching between queries. Try dropping the pool size, to 250 or even 50, and benchmark there. Do fewer or smaller queries. If your app is small it might be trivially obvious that every row from every query is necessary, but maybe your app is bigger than that. Are the different places that query the same data, or can two different queries be combined into one that will satisfy both?

http://stackoverflow.com/comment/39594706
type: AnswerComment
comment on: http://stackoverflow.com/a/25387223
score: 0
type: Comment
has text: Thanks for your help! I have edited my code. The error in line 55 is resolved and is not shown in my logcat already. however, the application is still force closing.

http://stackoverflow.com/q/25306235
has comment: http://stackoverflow.com/comment/39538837
has comment: http://stackoverflow.com/comment/39538380
tagged with: eclipse-plugin
has title: Eclipse- Workspace closed error
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39537861
has body: I want to get the path of my workspace in Eclipse. I wrote the following code: IWorkspace myWorkspace = ResourcesPlugin.getWorkspace(); System.out.println(myWorkspace.getRoot().getFullPath()); The problem is that I get a workspace closed exception. How can I solve this ?
has comment: http://stackoverflow.com/comment/39442988
has comment: http://stackoverflow.com/comment/39538310
tagged with: java
has comment: http://stackoverflow.com/comment/39538291
has comment: http://stackoverflow.com/comment/39443233
accepted answer: http://stackoverflow.com/a/25358695
has comment: http://stackoverflow.com/comment/39538567
tagged with: eclipse
has answer: http://stackoverflow.com/a/25358695
type: Question
has comment: http://stackoverflow.com/comment/39443173
score: 0
has comment: http://stackoverflow.com/comment/39535967
has comment: http://stackoverflow.com/comment/39538344
answer count: 1

http://stackoverflow.com/comment/39441062
score: 0
has text: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source) at AudioTest.playAudio(AudioTest.java:47)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25304958

http://stackoverflow.com/q/25273658
favorite count: 0
has comment: http://stackoverflow.com/comment/39383930
tagged with: objectinputstream
type: Question
tagged with: arraylist
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39384458
has comment: http://stackoverflow.com/comment/39383634
has comment: http://stackoverflow.com/comment/39385272
has comment: http://stackoverflow.com/comment/39382884
tagged with: objectoutputstream
has body: I'm trying to move the contents of an ArrayList from the client to the server. When trying to readObject() the input I receive a ClassNotFoundException. Here is my code, along with the stack trace: Client: ArrayList&lt;Person&gt; people = new ArrayList&lt;Person&gt;(); ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream()); for (Person p : people) { output.writeObject(p); } Server: ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); ObjectInputStream input = new ObjectInputStream(socket.getInputStream()); employees = (ArrayList&lt;Employee&gt;) input.readObject(); //Line 47 Error from server: java.lang.ClassNotFoundException: Person at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.io.ObjectInputStream.resolveClass(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at Server.&lt;init&gt;(Server.java:47) at ServerGUI.main(ServerGUI.java:143)
has comment: http://stackoverflow.com/comment/39383714
has title: Java - ClassNotFound Exception when working with ObjectInputStream and ArrayList
answer count: 0
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39383470
has comment: http://stackoverflow.com/comment/39382882

http://stackoverflow.com/comment/39379933
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25266835
type: QuestionComment
has text: Thanks! Mark Vedder posted a solution that worked for me below. It had to do with the UI font.

http://stackoverflow.com/comment/39518264
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25346951
has text: How much should I use? Is the 500 threads is from my Java program or mongodb limit?
type: Comment

http://stackoverflow.com/comment/39357686
type: Comment
comment on: http://stackoverflow.com/q/25260125
has text: It is really just my practice homework, random codes given and told to solve for outputs given inputs.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39387711
comment on: http://stackoverflow.com/a/25276001
type: Comment
type: AnswerComment
score: 0
has text: I started thinking along those lines. Will update the post with details. Re authentication is the way to go.

http://stackoverflow.com/q/25278849
has body: I want to read a field on an Unknown object returned by hibernate query. I know reflection can be used here. But is there any Hibernate API available to do that? I have only the object and value of @Column annotation. For example: Let's say I've following class class Person { @Column(name = "nick_name") String name; } When Hibernate returns this object as a part of query, I want to get the value of field name using the "nick_name" name attribute. EDIT: My requirement is to fetch the value of a specific field from object returned by Hibernate. I'll explain with an example Object obj = queryHibernateForObject(); Let's say obj is of type Person and I want to fetch value of "nick_name" field from this object.
answer count: 2
type: UnansweredQuestion
tagged with: annotations
has answer: http://stackoverflow.com/a/25280586
has answer: http://stackoverflow.com/a/25279109
score: 0
tagged with: reflection
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate - is there any API to get a field's value of an unknown object?

http://stackoverflow.com/a/25360545
has comment: http://stackoverflow.com/comment/39544114
has comment: http://stackoverflow.com/comment/39542463
has comment: http://stackoverflow.com/comment/39542504
answers question: http://stackoverflow.com/q/25360121
type: Answer
score: 0
has body: You can try with Lookaround Pattern (?&lt;!')'(?!') Sample code: System.out.println(Arrays.toString("name eq 'a''b'".split("(?&lt;!')'(?!')"))); output: [name eq , a''b] Pattern explanation: (?&lt;! look behind to see if there is not: ' '\'' ) end of look-behind ' '\'' (?! look ahead to see if there is not: ' '\'' ) end of look-ahead To split based on space or single quote use *(?&lt;!')[ '](?!') * sample code: System.out.println(Arrays.toString("name eq 'a''b'".split(" *(?&lt;!')[ '](?!') *"))); output: [name, eq, a''b]
has comment: http://stackoverflow.com/comment/39543986
has comment: http://stackoverflow.com/comment/39542723

http://stackoverflow.com/comment/39302867
type: Comment
type: QuestionComment
score: 0
has text: Overloading happens in Java because of compile time polymorphism. The compiler decides which method should be called in case of a overloaded method at compile time itself.
comment on: http://stackoverflow.com/q/25231084

http://stackoverflow.com/comment/39403753
comment on: http://stackoverflow.com/a/25284912
score: 0
type: AnswerComment
has text: With all the corrections I mentioned in my answer? In all four places? And is 'crc' initialized to CRC_PRESET in the C code?
type: Comment

http://stackoverflow.com/comment/39590680
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25385880
has text: What version of eclipse are you using?
type: Comment

http://stackoverflow.com/comment/39533633
type: AnswerComment
has text: If you're going to "fix" the code, you might want to "fix" ALL the problems - have a look at [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) for more details ;)
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25355707

http://stackoverflow.com/comment/39335814
has text: I dont think you can create arrays of generic type,due to type erasure
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25245654
score: 0

http://stackoverflow.com/q/25283581
upvote count: 1
tagged with: swing
favorite count: 0
type: Question
tagged with: mousemotionlistener
accepted answer: http://stackoverflow.com/a/25283664
has answer: http://stackoverflow.com/a/25283664
type: AnsweredQuestion
has title: why swing creators created mouseDragged method?
score: 1
tagged with: java
has body: I always thought that difference between mouseMoved and mouseDragged is that you could get the button pressed in the mouseDragged event. Apparently, you can't, as I just found out. So what is the reason including/using mouseDragged method? Because as for now all my code looks like this: @Override public void mouseDragged(MouseEvent e) { mouseMoved(e); }
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25333069
has body: I have a loop counter and depending on the value of the counter I'd like to subtract 7% from 10 equal to the value of the counter. For example, if the value of the counter is 1 then I subtract 7% from 10 once. If the value of the counter is two I subtract 7% from 10 which gives me 9.3 and then subtract 7% from 9.3. And so on. I am using the following code: double ten = 10.0; double seven = 0.70; double score = ten * seven / 100.0; When this runs I can easily subtract 7% from ten. However, how can I change it so that the next time it runs it will subtract 7% from 9.3, not 10?
tagged with: counter
score: 1
has answer: http://stackoverflow.com/a/25333168
downvote count: 1
has answer: http://stackoverflow.com/a/25333129
tagged with: recursion
has answer: http://stackoverflow.com/a/25333198
has title: Subtract X Percent from Value in Java
tagged with: java
has comment: http://stackoverflow.com/comment/39494445
tagged with: subtraction
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25333439
type: Question
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/39560404
score: 0
type: Comment
type: QuestionComment
has text: ok thanks :)... so in this case, changing the array size to 5 would work [assuming that the data is of size 5]
comment on: http://stackoverflow.com/q/25369715

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/25387224
type: Tag
tags question: http://stackoverflow.com/q/25257507

http://stackoverflow.com/a/25311409
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: The final keyword in reference to a class does not state that its instances cannot be modified. It only disallows subclassing it. The final keyword should be applied to fields JLS 8.3.1.2 in order to make instances immutable. Please see JLS 8.1.1.2: A class can be declared final if its definition is complete and no subclasses are desired or required. It is a compile-time error if the name of a final class appears in the extends clause (§8.1.4) of another class declaration; this implies that a final class cannot have any subclasses. It is a compile-time error if a class is declared both final and abstract, because the implementation of such a class could never be completed (§8.1.1.1). Because a final class never has any subclasses, the methods of a final class are never overridden (§8.4.8.1). Your copy constructor is acceptable.
answers question: http://stackoverflow.com/q/25311382

http://stackoverflow.com/q/25257654
type: UnansweredQuestion
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25257715
tagged with: exception
has title: Having trouble getting java program to run scheduled or as infinite loop with sleep timer
tagged with: java
tagged with: sleep
has comment: http://stackoverflow.com/comment/39353551
tagged with: timer
has comment: http://stackoverflow.com/comment/39353640
has body: So I have written up a rather large program which in the long is supposed to look at a file, if its been updated since the last iteration, turn that file into a webpage (you can ignore the details of what its doing with all this because its functional), FTPs to my website, and then sleeps. Here is the "best" functional version of my program I have: import java.io.*; import java.util.*; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import java.sql.Timestamp; public class PrintOutConvosFtp4 { public static void main(String[] args) throws IOException, InterruptedException { boolean infiniteLoop = true; long currentLoopModified = 0; long lastLoopModified = 0; while (infiniteLoop) { currentLoopModified = new File("C:/Documents and Settings/Cuckoo/Desktop/Syss-convos.LOG").lastModified(); if (currentLoopModified > lastLoopModified) { //Read in the conversation log BufferedReader reader = new BufferedReader(new FileReader("C:/Documents and Settings/Cuckoo/Desktop/Syss-convos.LOG")); FileWriter output = new FileWriter("C:/Documents and Settings/Cuckoo/Desktop/Conversations.html"); List<String> lines = new ArrayList<String>(); String line = null; while ((line = reader.readLine()) != null) //Remove some unnecessary clutter from the log { if (!(line.contains("just hung up!!!") || line.contains("just left the Realm.") || line.contains("Hurry, I've many esoteric secrets to divulge, and welcome to BaDbOy's realm.") || line.contains("For custom MegaMud paths and additional information, check out the website:") || line.contains("Syss gossips: Discuss new ideas/issues & see the most up to date information on Facebook!") || line.contains("Syss gossips: http://www.facebook.com/groups/EsotericEdits/") || line.contains("Syss gossips: MME Dats, Megamud path files and quest walkthroughs are available at my site") || line.contains("Syss gossips: www.esoteric-edits.fhero.net") || line.contains("telepaths: @") || line.contains("I'm a bot. Try telepathing…
score: 0

http://stackoverflow.com/q/25375432
score: 1
tagged with: phpmyadmin
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39573301
has answer: http://stackoverflow.com/a/25375596
has comment: http://stackoverflow.com/comment/39571425
has comment: http://stackoverflow.com/comment/39571386
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/477816
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39571223
favorite count: 0
has title: JSON error Caused by: java.lang.NullPointerException
type: Question
has comment: http://stackoverflow.com/comment/39572187
has body: im trying to make a register page on android using JSON. everytime i press register button on avd, i get an error "unfortunately database has stopped". i have a error on my logcat that i cannot understand. this my code. please someone help me. this my register.java import android.util.Log; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.List; public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONObject getJSONFromUrl(final String url) { // Making HTTP request try { // Construct the client and the HTTP request. DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); // Execute the POST request and store the response locally. HttpResponse httpResponse = httpClient.execute(httpPost); // Extract data from the response. HttpEntity httpEntity = httpResponse.getEntity(); // Open an inputStream with the data content. is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { // Create a BufferedReader to parse through the inputStream. BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); // Declare a string builder to help with the parsing. …
has comment: http://stackoverflow.com/comment/39571700

http://stackoverflow.com/q/25306198
tagged with: android
has title: How to Fill a cursor in a for loop with sqlite query
has body: I'm trying to fill a cursor in a for loop, in loop each time query executes returns a row and cursor fill with that row but each time a new row overwrites in cursor and All2 count is always 1. I want each time query executes add a new record to All2 and not overwrite on the previous one. Random randomGenerator = new Random(); int[] randomIntNumbers = new int[12]; for (int i = 1; i &lt;= 11; ++i){ int randomInt = randomGenerator.nextInt(12); randomIntNumbers[i] = randomInt; } for(int i=0;i&lt;11;i++){ All2 = mDB.query(DatabaseOpenHelper.TABLE_NAME, DatabaseOpenHelper.columns, "L=?", new String[]{""randomIntNumbers[i]}, null, null,null); }
score: 0
tagged with: java
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/25306277
type: Question
type: UnansweredQuestion

http://stackoverflow.com/a/28935114
score: 0
has body: I've got exactly the same problem using AppFog (in front of AWS). The only way I could workaround this issue was dropping the following from my connection string: "?useUnicode=true&amp;characterEncoding=UTF-8" Off course, you should be sure that this will not affect your application requirements.
answers question: http://stackoverflow.com/q/25307825
type: Answer

http://stackoverflow.com/comment/39451127
has text: `I'm really very new to android development.` I just found that I'm unable to get any current selected value from spinner I just get NullPointerExceptionnothing else :( I used following code to get current selected value from spinner `final Spinner problems = (Spinner) findViewById((R.id.spinner_problems)); String myvalue = String.valueOf(problems.getSelectedItem());` will update question with screenshot stacktrace thanks
comment on: http://stackoverflow.com/q/25309741
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25370504
answers question: http://stackoverflow.com/q/25370483
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If you want to deal with path using your local file system, the Path class is best suited for this task. An object that may be used to locate a file in a file system. It will typically represent a system dependent file path. You can use it like so : Path path = FileSystems.getDefault().getPath("/resources/rss2-0.xml"); BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); If your really want to deal with URL, the protocol you're looking for is simply "file". So it would be file:///rss2-0.xml instead of resource:///rss2-0.xml and even file:/resources/rss2-0.xml to be exact. Note that in your case, you will indeed have to deal with URLs sooner or later, but when working on local tests, using the Path class will save you troubles. If you want another alternative, try the URI class. Since an URI is an identifier (see difference between URI and URL) it can identify either an URL or a Path an may serve as a bridge between your production code which will ultimately deal with URLs and your test code where the Path class could be best put in use. For example : public interface FeedReader { String readFeed(final URI uri); } And 2 implementations, one for testing locally : public class LocalFeedReader implements FeedReader { @Override public String readFeed(final URI uri) { // URI -&gt; Path // then dealing with Path to target local rss2-0.xml file } } And one for production code : public class WebFeedReader implements FeedReader { @Override public String readFeed(final URI uri) { // URI -&gt; URL // then dealing with URL to target real resources } }
score: 2
accepted answer of: http://stackoverflow.com/q/25370483
upvote count: 2

http://stackoverflow.com/a/25268013
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25267980
has comment: http://stackoverflow.com/comment/39372587
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39372342
accepted answer of: http://stackoverflow.com/q/25267980
downvote count: 0
has body: I'm assuming you require either of the 3 keywords. Just check all 3 keywords : if(shortMessage.getDisplayMessageBody().equals(keyword[0]) || shortMessage.getDisplayMessageBody().equals(keyword[1]) || shortMessage.getDisplayMessageBody().equals(keyword[2])) Or if each keyword has different behavior : if(shortMessage.getDisplayMessageBody().equals(keyword[0])) { } else if (shortMessage.getDisplayMessageBody().equals(keyword[1])) { } else if (shortMessage.getDisplayMessageBody().equals(keyword[2])) { } else { } In addition, consider using case insensitive keywords, i.e. use equalsIgnoreCase.
upvote count: 1

http://stackoverflow.com/comment/39543209
type: AnswerComment
comment on: http://stackoverflow.com/a/25359373
has text: Will this show me the total memory for the stack trace or specific instances of the huge strings allocated? (I'm looking for a single string instance which was allocated with 30MB of data)
score: 0
type: Comment

http://stackoverflow.com/q/25303635
score: 1
has comment: http://stackoverflow.com/comment/39438375
favorite count: 0
has title: cast date to ms to add long value of duration with criteria
has comment: http://stackoverflow.com/comment/39438240
tagged with: criteria
accepted answer: http://stackoverflow.com/a/25303882
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25303882
answer count: 1
linked to: http://stackoverflow.com/q/21842934
tagged with: timestamp
has body: I have a date and duration. I need to add the duration to date. Date's format is timestamp, duration's - Long (milliseconds). How can I wright criteria to deal this issue? Practically i have something like this: 03-17-2014 21:24:57 + 2523566;
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39438298

http://stackoverflow.com/a/25247727
score: 3
has body: It's an instance (non-static) field, so you need an instance to reference it: public static void main(String[] args) { System.out.println(new Name().b); }
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25247669
type: Answer

http://stackoverflow.com/comment/39536413
has text: @tom: Thank you for clarifying that. Can you shed a little light onto why I cant called the simple native dll I made shown in the video. I have also updatd my code to show how im calling it
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25357241
score: 0

http://stackoverflow.com/comment/39565620
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25372271
has text: @shekharsuman fair play to you then, and perhaps I shouldn't have answered. In any case it seems like the OP your fellow student has solved the challenge by defining his/her own version of `max` (I came up with a similar-looking definition of `min`), so the problem can be conceived of as "done" to all intents and purposes.

http://stackoverflow.com/comment/39589213
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25311065
type: Comment
has text: No I haven't cloned... and I don't want to. We have a master server with Gits on it and mirror servers with copies (produced by doing "git push --mirror"). If I want to compile a deleted items list as in your code example, how can I calculate the list of items in the mirror server's copy of the Git without cloning it first? Basically it comes down to this: Calling "<git>.lsRemote()" only works on a clone. Is there a way to get a list of all head and tag references without cloning the git first?

http://stackoverflow.com/q/25384442
downvote count: 0
has title: How to display print dialog in java fx and print documents (not just nodes)
tagged with: java
tagged with: javafx
answer count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I am trying to print a generated pdf file in a java fx but all the examples I have seen are for printing java fx nodes. I could have used the ordinary printing api but the print dialog it shows is swing based and is like a totally different application in both behaviour and appearance, which may confuse users. I'd like to show a dialog prior to printing so that users can choose their preferred printer and also change page setup if possible. According to the open jdk wiki this was expected in java 8 1) PrinterJob - the class that controls the printing process and provides support for * print and page setup dialogs which will be the platform native dialog at least on Windows and Mac OS X. and the related jira issue is marked as fixed However this PrinterJob class and the javafx print package has two issues(as far as I can tell): It prints only nodes. No clear way of displaying a dialog for users to choose printing attributes So how can I provide a printing dialog in java fx to help users print pdf documents? PS: I'm using Java 8 update 20 in a desktop environment (Windows 7 64 bit) Any pointers are appreciated.
has answer: http://stackoverflow.com/a/26737450
score: 2
upvote count: 2
tagged with: printing
has comment: http://stackoverflow.com/comment/39603358
tagged with: javafx-8

http://stackoverflow.com/a/25283009
has body: Based on our discussions, I think it is due to the way you create the MailContainer actor. You aren't using the SpringExtProvider and instead are using Props.create directly. This means that Spring doesn't get the opportunity to perform dependency injection on your new actor. Try changing this code: @Override public void preStart() throws Exception { System.out.println("Mail collector preStart: {} "); getContext().actorOf(Props.create(MailContainer.class, result), "one"); } to use the the SpringExtProvider like this: @Override public void preStart() throws Exception { System.out.println("Mail collector preStart: {} "); getContext().actorOf(SpringExtProvider.get(getContext().system()).props("mailContainer"), "one"); } This way you are asking the Spring extension to create the new actor and inject any required dependecnies.
has comment: http://stackoverflow.com/comment/39403575
upvote count: 3
score: 3
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39405166
accepted answer of: http://stackoverflow.com/q/25250104
has comment: http://stackoverflow.com/comment/39400875
answers question: http://stackoverflow.com/q/25250104
has comment: http://stackoverflow.com/comment/39401272
has comment: http://stackoverflow.com/comment/39401523
type: Answer
has comment: http://stackoverflow.com/comment/39403260

http://stackoverflow.com/a/25262063
accepted answer of: http://stackoverflow.com/q/25243825
type: AcceptedAnswer
has body: As @user3487063 said: public void add(LinkedList&lt;SmsEntity&gt; smsEntityList) { try { Session session = null; session = this.sessionFactory.getCurrentSession(); Iterator&lt;SmsEntity&gt; iterator = smsEntityList.iterator(); while (iterator.hasNext()) { session.save(iterator.next()); } session.flush(); save(session); } catch (Exception e) { e.printStackTrace(); } } I should flush my session before save()
answers question: http://stackoverflow.com/q/25243825
type: Answer
score: 0

http://stackoverflow.com/q/25365952
accepted answer: http://stackoverflow.com/a/25366634
score: 9
type: Question
linked to: http://stackoverflow.com/q/28050976
upvote count: 9
has answer: http://stackoverflow.com/a/52264463
has answer: http://stackoverflow.com/a/58853153
has title: NoClassDefFoundError sun/io/ByteToCharConverter with InterBase JDBC driver
has answer: http://stackoverflow.com/a/28150775
has comment: http://stackoverflow.com/comment/44782533
tagged with: interbase
has comment: http://stackoverflow.com/comment/44757543
has answer: http://stackoverflow.com/a/43501912
has comment: http://stackoverflow.com/comment/44753125
possible better answer: http://stackoverflow.com/a/43501912
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/50122471
tagged with: java-8
has answer: http://stackoverflow.com/a/25366634
favorite count: 0
type: AnsweredQuestion
has body: With InterClient 7.5.1 and 8.1.5, the creation of a new JDBC connection in Java 8 fails with java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter This class seems to be referenced or used by the InterClient JDBC library. The error does not occur with Java 7. Is there a way to work around this error? This code reproduces the problem on Java 8: package com.example.so25365952; import java.sql.DriverManager; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; public class Main { interbase.interclient.Connection conn; public static void main(String[] args) { try { Class.forName("interbase.interclient.Driver"); DriverManager.getConnection("jdbc:interbase://localhost/data/mydb.gdb", "sysdba", "password123"); } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } Output: Exception in thread "main" java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter at interbase.interclient.Connection.connect(Unknown Source) at interbase.interclient.Connection.(Unknown Source) at interbase.interclient.Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.example.so25365952.Main.main(Main.java:14) Caused by: java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more
has comment: http://stackoverflow.com/comment/45520777
tagged with: java
has answer: http://stackoverflow.com/a/28608811
tagged with: jdbc
has comment: http://stackoverflow.com/comment/45521453
has comment: http://stackoverflow.com/comment/39591739

http://stackoverflow.com/comment/39417624
type: AnswerComment
type: Comment
has text: See the comment above from @ingo-bürk. Runtime exceptions will be thrown as usual.
comment on: http://stackoverflow.com/a/25292628
score: 0

http://stackoverflow.com/q/25332240
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25332806
has comment: http://stackoverflow.com/comment/39493272
possible better answer: http://stackoverflow.com/a/44042547
linked to: http://stackoverflow.com/q/2811001
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39493140
tagged with: jsoup
has comment: http://stackoverflow.com/comment/39492661
upvote count: 2
downvote count: 0
has body: I'm getting an html response from HttpGet,the response is like following: Accept and all the above code are stored in a string variable 'response'; but now in my app i only need the JSON part of the html: {"f":"103158","p":18,"api":false,"pid":60,"t":114779,"sub":"p10315857a3f8","u":{"id":"103158","name":"xxxxxx","profile_image":"{1}","status":"1"}} so how should I parse this string to get the only the above part?
has comment: http://stackoverflow.com/comment/39492971
has title: Java/Android how to get JSON from a html response?
tagged with: html-parsing
has answer: http://stackoverflow.com/a/25332806
has answer: http://stackoverflow.com/a/44042547
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25332454
answer count: 3

http://stackoverflow.com/a/25296819
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25296335
has comment: http://stackoverflow.com/comment/39426145
has body: You probably see in logcat as below; "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?" So, Replace your code as follows. if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ Intent start = new Intent(context, MainMenu.class); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(new Intent(context, MainMenu.class)); + context.startActivity(start); }else if(intent.getAction().equals("com.example.remind.STOP")){
has comment: http://stackoverflow.com/comment/39426377
type: Answer
has comment: http://stackoverflow.com/comment/39426634
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25296335

http://stackoverflow.com/comment/39543874
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25361219
has text: Also your sample code does not contain how you add the `SimplePanel` and the `Button`. Please also post those.
type: QuestionComment

http://stackoverflow.com/a/25312706
has body: For most practical cases, you use multiple, nested containers, with a LayoutManager suited to the layout within each container. Each LayoutManager does one specific job, in practice you often want differnt regions of a UI layouted in different ways. So for each region use a separate Container (e.g. JPanel) and set a LayoutManager that suits your layout requirements. The big hurdle for beginners seems to be to get the point that LayoutManagers can (and often must) be used with nested containers.
upvote count: 1
answers question: http://stackoverflow.com/q/25312377
has comment: http://stackoverflow.com/comment/39461135
has comment: http://stackoverflow.com/comment/39456908
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39456472

http://stackoverflow.com/q/25387519
has title: Hadoop - Unsupported major.minor version 51.0
type: Question
has body: I am new to hadoop and was trying to run the WordCount tutorial. I am getting the following error: Unsupported major.minor version 51.0. I have seen some posts with the same error and I understand that the reason is that I am compiling my java with one JDK and running it with another. I already know I compile it with jdk 1.7 but how can I tell which version used to run it? Thanks in advanced.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25387931
tagged with: hadoop
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/a/25237848
answers question: http://stackoverflow.com/q/25237709
score: 3
type: Answer
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25237709
downvote count: 0
has body: In both cases, when the bottom of the frame is reached it draws the line for the last time. In the first case, it draws the line from the bottom to the top and then decrements the endY variable (which in this case isn't relevant anymore). In the second case, it decrements first, which is why the line goes above your red line. If you can't get your head around this, try to set the pixels between each line to a bigger number and then try to traverse the for loop in your head. Take a paper and write down all the variables and what number they have stored at the moment. Probably also draw the lines yourself on the paper ;)
has comment: http://stackoverflow.com/comment/39316270

http://stackoverflow.com/comment/129755910
has text: For new readers to this question I strongly recommend you don’t use `SimpleDateFormat` and `Calendar`. Those classes are poorly designed and long outdated, the former in particular notoriously troublesome. Instead use `LocalDateTime` or `ZonedDateTime` in any case along with `DateTimeFormatter`. All are from [java.time, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25287722
type: QuestionComment

http://stackoverflow.com/a/25303108
answers question: http://stackoverflow.com/q/25301724
has comment: http://stackoverflow.com/comment/39524163
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39519084
upvote count: 1
score: 1
has body: First, I know nothing about selendroid. A simple solution could be: public void waitForCondition(WebElement element){ try{ new WebDriverWait(driver, 60) .until(ExpectedConditions.visibilityOf(element)); // your condition } catch (TimeoutException e){ // do log or whatever } } Anyway, You usually do this by implementing WebDriverEventListener and register this with EventFiringWebDriver, then invoke it something like: EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(new FirefoxDriver()); MyWebDriverEventListener listener = new MyWebDriverEventListener(); eventFiringWebDriver.register(listener); where MyWebDriverEventListener is something like class MyWebDriverEventListener implements WebDriverEventListener { // .. skipped } So, basically what WebDriverWait's until method is doing, is that it is executing the driver.findElement until: Repeatedly applies this instance's input value to the given function until one of the following occurs: the function returns neither null nor false, the function throws an unignored exception, the timeout expires, the current thread is interrupted So what you could do, is implement your logging in WebDriverEventListener public void afterFindBy(By by, WebElement element, WebDriver driver) { // Do logging } This would be applyed every time element is found (not only wait, but regular driver.findElement also). Anyway, this does not cover the case when exception is thrown. You also have a chance to log in onException method, using something like if (throwable instanceof TimeoutException){ // log } I would not do it but it's your code. That being said, I usually don't do this because I do not care about such verbose log level, I just have 2 helper methods that can take care of all the waits I ever need: public void waitUntil(WebElement element) { new WebDriverWait(driver, 60) .ignoring(NoSuchElementException.class) .ignoring(StaleElementReferenceException.class) .until(ExpectedConditions.visibilityOf(element)); } public voi…
has comment: http://stackoverflow.com/comment/39536506

http://stackoverflow.com/comment/51493098
type: AnswerComment
comment on: http://stackoverflow.com/a/28445210
score: 0
has text: @marrock Have you figured it?
type: Comment

http://stackoverflow.com/comment/54458598
comment on: http://stackoverflow.com/a/25451662
type: AnswerComment
score: 0
has text: Here is a problem (IMO) with this approach: If the Post already has Comments, i.e., the POST_COMMENTS table already has rows with the Post ID for this Post, doing a PUT removes all rows in the table and adds the new row. It seems like I shouldn't have to query the resolution table first to get all existing rows and then add them back again. Unless I'm doing something wrong...
type: Comment

http://stackoverflow.com/q/25266228
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25266335
favorite count: 0
has answer: http://stackoverflow.com/a/25266373
type: Question
linked to: http://stackoverflow.com/q/413898
score: -2
has answer: http://stackoverflow.com/a/25268139
has body: I have the following code: package com.fdm.calculator; public class Calculator { public double evaluate(String expression){ return Double.parseDouble(expression); } } How do I invoke this method. For example I want to do calculator.evaluate("5"), which should return 5.0. I want the output on the screen. I am also running a j unit test case along side this, so I am not sure how that changes things.
has title: How to get output of method in java
answer count: 6
has answer: http://stackoverflow.com/a/25266306
has answer: http://stackoverflow.com/a/25266326
has answer: http://stackoverflow.com/a/25266265
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39368975
tagged with: java
linked to: http://stackoverflow.com/q/3903537

http://stackoverflow.com/comment/39330269
type: Comment
comment on: http://stackoverflow.com/q/25245310
type: QuestionComment
has text: @Hardik yeah! if the user has already created a particular record with a particular dutyname and volnric he can't do the same creation again!
score: 0

http://stackoverflow.com/q/25272560
has title: background fade-out and going to another page
tagged with: shapes
answer count: 1
type: AnsweredQuestion
has body: I have an XML layout page with a gradient background. I also have an anim XML page to change the alpha from 1 to 0 and a drawable xml page to define a shape as background of layout page. What I'm trying to do is to fade-out the background and then go to the second page. However, the project doesn't run. drawable/linegradiant.xml <gradient android:centerX="20%" android:endColor="#aed36c" android:startColor="#44c8f5" /> anim/fade_out.xml MainActivity.xml MainActivity.java public class MainActivity extends ActionBarActivity implements AnimationListener { LinearLayout screen; // Handler handler = new Handler(); int i; Intent intent; Animation animFadeout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); screen=(LinearLayout) findViewById(R.id.firstpage); animFadeout=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_out ); animFadeout.setAnimationListener(this); screen.post(new Runnable() { @Override public void run() { screen.startAnimation(animFadeout); } }); } @Override public void onAnimationEnd(Animation arg0) { startActivity(new Intent(getApplicationContext(),BMIcalculator.class)); } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } }
accepted answer: http://stackoverflow.com/a/25272758
has comment: http://stackoverflow.com/comment/39381093
score: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25272758
has comment: http://stackoverflow.com/comment/39381025
has comment: http://stackoverflow.com/comment/39380830
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: alpha
has comment: http://stackoverflow.com/comment/39380905

http://stackoverflow.com/comment/39487846
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25291426
has text: Thanks, this gives me good perspective to limiting use errors
score: 0

http://stackoverflow.com/q/25327553
has title: While loop error- not entering
score: -1
has comment: http://stackoverflow.com/comment/39482961
has comment: http://stackoverflow.com/comment/39482978
has answer: http://stackoverflow.com/a/25327593
linked to: http://stackoverflow.com/q/513832
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39483226
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39482993
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39483143
has comment: http://stackoverflow.com/comment/39483100
type: UnansweredQuestion
has body: The following while loop within the program I'm writing is not being entered into, even though the condition within parentheses would evaluate as true (as far as I can tell). Here is the loop with the assignment before it: String choose = "y"; while(choose=="y"); { System.out.println("Enter 4-digit time: (0000 - 2359)"); String time_ = s.nextLine(); System.out.println("Angle between hour hand and minute hand is: " + timeToAngle(time_) + " degrees"); System.out.println("Would you like to calculate the angle for another time? (y/n)"); choose = s.next(); } Please could somebody give me a pointer in the right direction? This is driving me crazy
has answer: http://stackoverflow.com/a/25327574

http://stackoverflow.com/comment/39543988
score: 1
comment on: http://stackoverflow.com/q/25361412
type: Comment
has text: Instead of splitting the string and counting the length of the split array, why not just iterate over the string, and count the tabs? You can use the `String.matches()` method for every character and find the answer that way.
type: QuestionComment

http://stackoverflow.com/q/25288850
has comment: http://stackoverflow.com/comment/39411362
has body: I have a several classes that define as follow : class A extends Super implements Interface {} class B extends Super implements Interface {} I want to create list of these classes. I try the following: public class C { List&lt;Class&lt;?&gt;&gt; classes = Arrays.asList((Class&lt;?&gt;) A.class, B.class); // Works List&lt;Class&lt;? extends Super,Interface&gt;&gt; classes2 = Arrays.asList(A.class, B.class); // Compile Error List&lt;Class&lt;? extends Super&gt;&gt; classes3 = Arrays.asList(A.class, B.class); // Compile Error } What is the right way to write it ? Why the first option works when I make casting only to A ?
has comment: http://stackoverflow.com/comment/39411401
has title: Create List of classes that extends and implement
favorite count: 0
type: Question
tagged with: extends
tagged with: implements
type: UnansweredQuestion
score: -2
tagged with: interface
answer count: 1
has comment: http://stackoverflow.com/comment/39411281
has comment: http://stackoverflow.com/comment/39411467
tagged with: class
has answer: http://stackoverflow.com/a/25289408
has comment: http://stackoverflow.com/comment/39411268
downvote count: 3
has comment: http://stackoverflow.com/comment/39411108
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/39394321
comment on: http://stackoverflow.com/q/25280136
type: Comment
type: QuestionComment
has text: Are you using an applet of some kind or is this a web application? Applets may not have access to the clipboard due to their security restrictions...
score: 1

http://stackoverflow.com/comment/39497715
has text: I wouldn't. To avoid further confusion I've added the version info for both.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25334997
score: 0

http://stackoverflow.com/q/25269561
tagged with: java
tagged with: lwjgl
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39376425
tagged with: 3d
has comment: http://stackoverflow.com/comment/39380294
has title: LWJGL is only rendering one object
has comment: http://stackoverflow.com/comment/39380893
upvote count: 1
has body: As the title suggests, I am trying to render two three-dimensional objects simultaneously using LWJGL, however, only the second one is rendering. I did a bit of searching around and added glPushMatrix() and glPopMatrix() before and after each render. In addition, I am trying to render each object dynamically, rather than statically, with the use of an ArrayList. Actual rendering code, called once every frame: //clear screen and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); //this is done dynamically for (int i = 0; i &lt; MainProgram.renderer.parts.size(); i++) { GL11.glPushMatrix(); BasePart p = MainProgram.renderer.parts.get(i); glTranslatef(p.Position.X+MainProgram.CurrentCamera.CoordinateFrame.X, p.Position.Y-MainProgram.CurrentCamera.CoordinateFrame.Y, -MainProgram.zoom+p.Position.Z-MainProgram.CurrentCamera.CoordinateFrame.Z); if (MainProgram.renderer.rbd == true) { p.Rotation.Y += MainProgram.renderer.ydif; p.Rotation.X += MainProgram.renderer.xdif; } glRotatef(p.Rotation.X, 0f, 1f, 0f); glRotatef(-p.Rotation.Y, 1f, 0f, 0f); glBegin(GL_QUADS); glColor3f(p.BrickColor.r, p.BrickColor.g, p.BrickColor.b); //green glVertex3f(p.Size.X, p.Size.Y, -p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y, -p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y, p.Size.Z); glVertex3f(p.Size.X, p.Size.Y, p.Size.Z); glVertex3f(p.Size.X, -p.Size.Y, p.Size.Z); glVertex3f(-p.Size.X, -p.Size.Y, p.Size.Z); glVertex3f(-p.Size.X, -p.Size.Y, -p.Size.Z); glVertex3f(p.Size.X, -p.Size.Y, -p.Size.Z); glVertex3f(p.Size.X, p.Size.Y, p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y, p.Size.Z); glVertex3f(-p.Size.X, -p.Size.Y, p.Size.Z); glVertex3f(p.Size.X, -p.Size.Y, p.Size.Z); glVertex3f(p.Size.X,-p.Size.Y,-p.Size.Z); glVertex3f(-p.Size.X,-p.Size.Y,-p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y,-p.Size.Z); glVertex3f(p.Size.X, p.Size.Y,-p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y, p.Size.Z); glVertex3f(-p.Size.X, p.Size.Y, -p.Size.Z); glVertex3f(-p.Size.X, -p.Size.Y, -p.Size.Z); glVerte…
has comment: http://stackoverflow.com/comment/39376274
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25274031
tagged with: opengl
has answer: http://stackoverflow.com/a/25274031

http://stackoverflow.com/q/25307459
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39445942
tagged with: javascript
tagged with: jquery
tagged with: css
has body: I have enabled Keepalive on my servlet and JSP pages by adding keepalive header.But GTMETRIX still shows that I should enable keepalive on CSS,JS and images.I am making myproject in java.Any idea how to do that?
tagged with: keep-alive
answer count: 0
has comment: http://stackoverflow.com/comment/39445550
upvote count: 2
has title: How to enable keep alive on CSS,JS and images>
score: 1
tagged with: java

http://stackoverflow.com/q/25262353
upvote count: 1
has title: Double-checked locking as an anti-pattern
has comment: http://stackoverflow.com/comment/39408190
linked to: http://stackoverflow.com/q/3041253
has comment: http://stackoverflow.com/comment/39362075
favorite count: 0
type: Question
tagged with: double-checked-locking
has answer: http://stackoverflow.com/a/25262497
has comment: http://stackoverflow.com/comment/39361636
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39361806
has comment: http://stackoverflow.com/comment/39409421
linked to: http://stackoverflow.com/q/1625118
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39409692
duplicate of: http://stackoverflow.com/q/1625118
has comment: http://stackoverflow.com/comment/39408161
has comment: http://stackoverflow.com/comment/39408529
has comment: http://stackoverflow.com/comment/39401836
score: 1
tagged with: java
has body: There's a common belief and multiple sources (including wiki) that claim this idiom to be an anti-pattern. What are the arguments against using it in production code given the correct implementation is used (for example, using volatile) What are the appropriate alternatives for implementing lazy initialization in a multithreaded environment ? Locking the whole method may become a bottleneck and even while modern synchronization is relatively cheap, it's still much slower especially under contention. Static holder seems to be a language-specific and a bit ugly hack (at least for me). Atomics-based implementation seems not be so different from traditional DCL while allowing multiple calculations or requires more complicated code. For example, Scala is still using DCL for implementing the lazy values while proposed alternative seems to be much more complicated.
tagged with: multithreading
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/39313185
comment on: http://stackoverflow.com/a/25236073
score: 0
type: AnswerComment
has text: It's not possible at all. Nothing to do with the way he writes it.
type: Comment

http://stackoverflow.com/comment/39384191
comment on: http://stackoverflow.com/q/25274197
type: QuestionComment
has text: You mean wait 1 second after the animation is done and start activity?
score: 0
type: Comment

http://stackoverflow.com/comment/39553827
score: 0
type: AnswerComment
has text: Uh! I didn't know about memory mapped files... I'm taking a look to `MappedByteBuffer`, thank you again! :)
type: Comment
comment on: http://stackoverflow.com/a/25365628

http://stackoverflow.com/a/25331105
upvote count: 2
has body: The API you're using treats the whitespaces between the tags as seperate nodes. If you print the node names of child nodes of the first chapter using this code: NodeList lst = doc.getDocumentElement().getElementsByTagName("chapter").item(0).getChildNodes(); for (int i = 0; i &lt; lst.getLength(); i++) { System.out.println(lst.item(i).getNodeName()); } you'll get: #text verse #text verse #text verse #text Which means that the node at index 0 is not the verse node, but a text node, that contains no attributes, which causes a NPE, since you try to call a method of the non existent attribute object (null). If you delete the whitespaces before the verse node like this: &lt;book&gt; &lt;chapter index="1" name="Chapter 2"&gt;&lt;verse index="1" text="First Line" /&gt; ... , everything works fine. But you better use getElementsByTagName("verse") to get the verse nodes, that are child nodes of the chapter: System.out.println("Verse: " + ((Element)doc.getDocumentElement().getElementsByTagName("chapter").item(0)).getElementsByTagName("verse").item(0).getAttributes().getNamedItem("text").getNodeValue());
accepted answer of: http://stackoverflow.com/q/25330187
type: Answer
score: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25330187

http://stackoverflow.com/comment/39359090
score: 0
has text: I have printed the stack trace and find out that my class is not in the trace and the frist Obj in stack is for Android.os.HandleThread.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25259570

http://stackoverflow.com/q/25368728
has comment: http://stackoverflow.com/comment/39560776
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/39587125
has comment: http://stackoverflow.com/comment/39589175
has answer: http://stackoverflow.com/a/25388158
tagged with: maven-3
tagged with: checksum
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39575555
has comment: http://stackoverflow.com/comment/39585471
score: 5
has comment: http://stackoverflow.com/comment/39588567
has comment: http://stackoverflow.com/comment/39586599
has comment: http://stackoverflow.com/comment/39559264
upvote count: 5
tagged with: maven
has comment: http://stackoverflow.com/comment/39587872
accepted answer: http://stackoverflow.com/a/25388158
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39588186
has title: How do you create a checksum in Maven then output it to a text file?
tagged with: java
answer count: 1
downvote count: 0
has body: Still learning how to use Maven, and I was wondering if there is a way to do a checksum on the generated WAR file. The Maven goal is package, and what I'm trying to achieve is to get a checksum value (of the packaged WAR file) put into a text file alongside the packaged file. Thanks in advance!

http://stackoverflow.com/comment/39535967
type: Comment
type: QuestionComment
has text: I'm running this in a new class
comment on: http://stackoverflow.com/q/25306235
score: 0

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/25270000
tags question: http://stackoverflow.com/q/25299353
tags question: http://stackoverflow.com/q/25292224

http://stackoverflow.com/q/25345401
has comment: http://stackoverflow.com/comment/39518701
has comment: http://stackoverflow.com/comment/39515434
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10770483
tagged with: apache
has comment: http://stackoverflow.com/comment/39515891
answer count: 1
tagged with: httpclient
has comment: http://stackoverflow.com/comment/39533089
has comment: http://stackoverflow.com/comment/39532262
has comment: http://stackoverflow.com/comment/39532591
score: 0
has title: Download PDF using Apache HttpClient
tagged with: java
has comment: http://stackoverflow.com/comment/39532430
has answer: http://stackoverflow.com/a/39972720
has comment: http://stackoverflow.com/comment/39515437
has comment: http://stackoverflow.com/comment/39515445
has body: I'm writing a program to download all of my monthly statements from my ISP using HttpClient. I can login to the site, access pages, and download pages but I can't download my PDF statements. It just downloads some HTML. I used the answer to this question to start with. Here is my method where I'm trying to download the PDF: public void downloadPdf() throws ClientProtocolException, IOException { HttpGet httpget = new HttpGet("https://www.cox.com/ibill/PdfBillingStatement.stmt?account13=123&amp;stmtCode=001&amp;cycleDate=7/21/2014&amp;redirectURL=error.cox"); HttpResponse response = client.execute(httpget); System.out.println("Download response: " + response.getStatusLine()); HttpEntity entity = response.getEntity(); InputStream inputStream = null; OutputStream outputStream = null; if (entity != null) { long len = entity.getContentLength(); inputStream = entity.getContent(); outputStream = new FileOutputStream(new File("/home/bkurczynski/Desktop/statement.pdf")); int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } outputStream.close(); } } Any help would be greatly appreciated. Thank you!
type: Question

http://stackoverflow.com/q/25268716
tagged with: linux
has answer: http://stackoverflow.com/a/25282001
accepted answer: http://stackoverflow.com/a/25282001
has body: I have placed a .properties file in the webapps folder of tomcat but am not able to access it. My servlet is in directory under webapps. Do I have to change my java code to look into parent directory? private static final ResourceBundle ldap = ResourceBundle.getBundle("js_ldap");
has title: Cannot access properties file in tomcat - linux
possible better answer: http://stackoverflow.com/a/25268843
tagged with: servlets
has answer: http://stackoverflow.com/a/25268843
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39374883
type: Question
tagged with: properties-file

http://stackoverflow.com/a/25242606
score: 5
answers question: http://stackoverflow.com/q/25242239
upvote count: 5
type: Answer
downvote count: 0
has body: Most-likely, this test of yours depends on the execution of another one which produces some files, other resources or store data somewhere (for example in a database or something). TDD (test-driver development) states that any tests you write should be their own independent entities, meaning: any test you write should be completely self-sufficient and not depend on things produced by other tests executed before it. Simply put: make sure your test has all the proper resources/data produced in it's setUp() method or that the required test resources are copied by Maven before your test executes. Debugging test cases which depend on resources/data which is produced by other test cases is never a good idea, as, at some point in time, you will forget that another test is meddling with your resource and will wonder why the results are not what you were expecting.

http://stackoverflow.com/q/25269190
tagged with: java
tagged with: rcp
has answer: http://stackoverflow.com/a/25269543
type: Question
tagged with: e4
has comment: http://stackoverflow.com/comment/39374696
type: UnansweredQuestion
answer count: 1
tagged with: fragment
tagged with: eclipse-rcp
score: 0
has comment: http://stackoverflow.com/comment/39374599
has title: Extending GUI functionality of RCP application via fragment
has body: I would like to extend the GUI functionality of an existing RCP application with another plug-in. One approach would be to use a fragment which is described quite well in this tutorial. I tried it, and everything seems to work fine. When I build the project, I get a separate jar for the extension plugin. Now to my question: can I safely add/remove this jar from the application to add/remove the desired functionality? Is this a good way to do this, or would you say that another approach works better?

http://stackoverflow.com/a/25291890
downvote count: 1
has comment: http://stackoverflow.com/comment/39416406
type: Answer
has body: This might work: File file= new File (WORKSPACE_PATH+fname); FileWriter fw; if (file.exists()) { fw = new FileWriter(file,true);//if file exists append to file. Works fine. } else { file.createNewFile(); fw = new FileWriter(file); }
score: 2
has comment: http://stackoverflow.com/comment/39416372
has comment: http://stackoverflow.com/comment/39416222
upvote count: 3
answers question: http://stackoverflow.com/q/25291770
has comment: http://stackoverflow.com/comment/39416249

http://stackoverflow.com/comment/39504411
score: 0
has text: Thanks for the top, let me look in there and see if I can find anything. My objects aren't that complex...
type: Comment
comment on: http://stackoverflow.com/q/25335720
type: QuestionComment

http://stackoverflow.com/comment/39316915
has text: @Mofodev He is using a library to retrieve it. The library constructs and returns a `JSONObject`.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25238041

http://stackoverflow.com/q/25284556
type: Question
upvote count: 3
score: 3
tagged with: java
tagged with: crc
tagged with: http://stackoverflow.com/tag/c
answer count: 4
type: AnsweredQuestion
has title: Translate CRC8 from C to Java
has answer: http://stackoverflow.com/a/71214103
has body: I received a piece of code in C which calculates a CRC8-value of a byte array. I need to translate it to Java. Here the C Code: CRC_POLYNOM = 0x9c; CRC_PRESET = 0xFF; unsigned int CRC = CRC_PRESET; for (i = 0; i &lt; Len; i++) { crc ^= FRAME[i]; for (j = 0; j &lt; 8; j++) { if (crc &amp; 0x01) crc = (crc &gt;&gt; 1) ^ CRC_POLYNOM; else crc = (crc &gt;&gt; 1); } } What I have managed to do is this in Java: public static long calculateCRC8(byte[] b, int len) { long crc = CRC_PRESET; for (int i = 0; i &lt; len; i++) { crc ^= b[i]; for (int j = 0; j &lt; 8; j++) { if ((crc &amp; 0x01) == 0) crc = (crc &gt;&gt; 1) ^ CRC_POLYNOM; else crc = crc &gt;&gt; 1; } } return crc; } For a sample byte-array: byte[] b = new byte[] {1, 56, -23, 3, 0, 19, 0, 0, 2, 0, 3, 13, 8, -34, 7, 9, 42, 18, 26, -5, 54, 11, -94, -46, -128, 4, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, -32, -80, 0, 98, -5, 71, 0, 64, 0, 0, 0, 0, -116, 1, 104, 2}; the C code returns 29, my Java code returns 44 though. What did I do wrong? I think this is because of Java's signed-only datatypes, so how can I fix this?
downvote count: 0
has answer: http://stackoverflow.com/a/26998845
has answer: http://stackoverflow.com/a/25284912
possible better answer: http://stackoverflow.com/a/25284912
has answer: http://stackoverflow.com/a/25284911
accepted answer: http://stackoverflow.com/a/25284911
favorite count: 0

http://stackoverflow.com/a/25367479
has comment: http://stackoverflow.com/comment/39557725
has comment: http://stackoverflow.com/comment/39556756
downvote count: 0
has comment: http://stackoverflow.com/comment/39556930
upvote count: 1
has comment: http://stackoverflow.com/comment/39555813
score: 1
has comment: http://stackoverflow.com/comment/39558510
has comment: http://stackoverflow.com/comment/39559125
has comment: http://stackoverflow.com/comment/39558588
has comment: http://stackoverflow.com/comment/39557294
answers question: http://stackoverflow.com/q/25367426
type: Answer
has comment: http://stackoverflow.com/comment/39556006
has body: The normal pattern is a file with name x gets saved as x.bz2, so the output file name is the input file name with the last four characters removed. The only known exception is x.tar -> x.tbz (but some people use x.tar.bz2). This means your example doesn't follow the normal pattern; otherwise it would be test.txt.bz2.
has comment: http://stackoverflow.com/comment/39559101

http://stackoverflow.com/q/25378281
has comment: http://stackoverflow.com/comment/39576476
has body: I'm making a program where a user enters how many inputs the user wants. Example if the user enter's 3, then 3 user inputs will appear. The output of this program goes something like this: ---------------------------------- Enter How Many Inputs: 3 enter name: rendell //value to be outputted enter age: 20 //value to be outputted enter gender: male //value to be outputted ----------------------------------- Now, I want to store those entered values somewhere to be outputted separately after but I have no idea how to do it. I tried to use the ctr1 variable but it only outputs the value of the last user input. Here is my code: Object stud1 [][] = {{1,2,3},{"enter name:","enter age:","enter gender:"}}; String ctr1; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); Scanner scan = new Scanner(System.in); System.out.print("Enter How Many Inputs: "); int num1 = Integer.parseInt(in.readLine()); for (int i = 0; i&lt;num1;i++){ System.out.println(pers[1][i]); ctr1 = in.readLine(); }
has comment: http://stackoverflow.com/comment/39576516
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39576571
tagged with: java
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/25378413
accepted answer: http://stackoverflow.com/a/25378413
has comment: http://stackoverflow.com/comment/39576528
has comment: http://stackoverflow.com/comment/39576452
type: Question
has title: output value of user inputs inside an array java

http://stackoverflow.com/comment/39483199
comment on: http://stackoverflow.com/q/25327139
type: Comment
has text: Open a DOS box, change directory to the one containing the SDK manager and invoke its executable from the command line. That should show you any errors arising.
type: QuestionComment
score: 2

http://stackoverflow.com/a/25308624
answers question: http://stackoverflow.com/q/25308413
type: Answer
score: 0
has body: In Example 1, you have no reference to any HelloWorld object, and therefore can't access any of its member variables or methods. In Example 2, you have a reference sc to the Scanner object and can therefore use sc to access any of its public instance methods.

android-softkeyboard
tags question: http://stackoverflow.com/q/25320653
tag name: android-softkeyboard
type: Tag

http://stackoverflow.com/comment/39388320
has text: Not on point - perhaps I was not specific enough. The static data is distinct for each class in the hierarchy.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25276655
type: Comment

http://stackoverflow.com/q/25275194
has title: Hadoop 2.4 cannot launch job on aws s3n
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25608671
score: 0
tagged with: amazon-s3
has body: I deployed Hadoop 2.4 on AWS EC2 using S3 native file system as a replacement of HDFS. I tried several example apps, all gave me the following stack tracing msgs (an older thread on Jul 24 hang there w/o being resolved... So I attach the DEBUG info here...): hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.4.0.jar wordcount s3n://mybkt/wc/ s3n://mybkt/out 14/08/12 21:57:35 DEBUG util.Shell: setsid exited with exit code 0 14/08/12 21:57:36 DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginSuccess with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of successful kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops) 14/08/12 21:57:36 DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginFailure with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of failed kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops) 14/08/12 21:57:36 DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.getGroups with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[GetGroups], about=, type=DEFAULT, always=false, sampleName=Ops) 14/08/12 21:57:36 DEBUG impl.MetricsSystemImpl: UgiMetrics, User and group related metrics 14/08/12 21:57:36 DEBUG util.KerberosName: Kerberos krb5 configuration not found, setting default realm to empty 14/08/12 21:57:36 DEBUG security.Groups: Creating new Groups object 14/08/12 21:57:36 DEBUG util.NativeCodeLoader: Trying to load the custom-built native-hadoop library... 14/08/12 21:57:36 DEBUG util.NativeCodeLoader: Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError: no had…
tagged with: java
answer count: 1
type: Question
tagged with: hadoop

http://stackoverflow.com/q/25339142
has title: Is there faster way to find distinct elements using Java
has answer: http://stackoverflow.com/a/25339230
answer count: 3
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25339183
upvote count: 1
favorite count: 0
has body: I have written the code to find distinct element in a large array of string. The code is given bellow HashMap&lt;String, Integer&gt; countMap = new HashMap&lt;&gt;(); String[] str={"aa","bb","cc","bb","aa","cc","aa","bb","cc","bb"}; for (String e : str) { if (!countMap.containsKey(e)) { countMap.put(e, 1); } } Iterator it=countMap.keySet().iterator(); String[] db= new String[countMap.size()]; for(int i=0;i&lt;countMap.size();i++){ db[i]=(String)it.next(); System.out.println(db[i]); } Is there any code faster than this one because I have to process very large array.
type: Question
has comment: http://stackoverflow.com/comment/39505243
has answer: http://stackoverflow.com/a/25339167
type: UnansweredQuestion

http://stackoverflow.com/comment/39527542
has text: it works :) I have tried calling the method from main class it actually works
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25352408
type: QuestionComment

network-programming
tag name: network-programming
tags question: http://stackoverflow.com/q/25352697
tags question: http://stackoverflow.com/q/25319735
tags question: http://stackoverflow.com/q/25371802
tags question: http://stackoverflow.com/q/25234619
tags question: http://stackoverflow.com/q/25355696
tags question: http://stackoverflow.com/q/25301819
tags question: http://stackoverflow.com/q/25306124
tags question: http://stackoverflow.com/q/25347864
tags question: http://stackoverflow.com/q/25248612
type: Tag
tags question: http://stackoverflow.com/q/25377242
tags question: http://stackoverflow.com/q/25259873
tags question: http://stackoverflow.com/q/25336893
tags question: http://stackoverflow.com/q/25363069

http://stackoverflow.com/q/25298769
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25298812
score: 1
has title: Getting value from inside a div in Jsoup Not Working
tagged with: java
favorite count: 0
type: Question
tagged with: jsoup
has body: I'm currently trying to access a price value from the homedepot website. URL: http://www.homedepot.ca/product/dewalt-heavy-duty-3-8-vsr-pistol-grip-drill-with-keyless-chuck/907316 the HTML with the price in it looks like this: $69.98 I did some reading and I thought the following code should work: doc = Jsoup.connect("http://www.homedepot.ca/product/dewalt-heavy-duty-3-8-vsr-pistol-grip-drill-with-keyless-chuck/907316").get(); Element content = doc.getElementById("regionalized-price"); Elements p= content.getElementsByTag("p"); System.out.println(p.text()); I've also just tried this to see if I could get a value come up: Elements content2 = doc.getElementsByClass("offer-price"); System.out.println(content2.text()); Not sure if I'm doing something wrong or if Home depot has something preventing my scrape from working. Any suggestions or guidance is appreciated.
answer count: 1
downvote count: 0
upvote count: 1
tagged with: web-scraping
accepted answer: http://stackoverflow.com/a/25298812

http://stackoverflow.com/comment/39472917
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25322063
has text: Left-hand side type should be `List` rather than `ArrayList` unless the code depends on any specific feature of `ArrayList`. Otherwise you can't assign `Collections.emptyList()` to it, or a `LinkedList`, etc. `List<String> strings = new ArrayList<>();`

http://stackoverflow.com/comment/39397748
has text: Yes, you need to work with the real object here. I once saw a project where a developer had written a lot of tests that only tested his own mocking setup instead of any actual code...
type: AnswerComment
comment on: http://stackoverflow.com/a/25281874
score: 0
type: Comment

http://stackoverflow.com/comment/39421644
score: 0
type: Comment
type: QuestionComment
has text: Use js or parse a string in the server side.
comment on: http://stackoverflow.com/q/25294312

http://stackoverflow.com/q/25265920
score: 0
answer count: 2
tagged with: java
tagged with: swing
has body: To be simple, the desired goal is to freeze the active rendering loop on window resize (in order to get rid of some unsavory flashing as described here), but there doesn't appear to be a straightforward way to a determine when the border of a Frame/JFrame is grabbed. Of course, an event is thrown when the frame border is grabbed and resized. This could be useful in that a small wait could be added after each resize event to freeze the rendering loop, but this would produce a nice frozen frame after the frame is done resizing. It would be best to have an actual event thrown. Does anyone know of how to do this? NOTE: To be clear, I need to know when the frame border is grabbed and not when the frame is resized
type: Question
has title: Unable to determine when Frame border is grabbed
linked to: http://stackoverflow.com/q/6824756
has answer: http://stackoverflow.com/a/25266061
type: UnansweredQuestion
tagged with: awt
has answer: http://stackoverflow.com/a/25266257
tagged with: border

http://stackoverflow.com/q/25343430
has answer: http://stackoverflow.com/a/25343477
tagged with: database
has answer: http://stackoverflow.com/a/25386782
accepted answer: http://stackoverflow.com/a/25386782
tagged with: derby
has title: Java not able to see the derby database table when running
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25343477
has body: The Problem: I am creating an application that requires the use of an integrated database but I am having issues getting my application to connect to the database/table. Unfortunately, my knowledge of Java connecting to databases is rather limited but everything I have read and watched seems to point to my code being correct. My Code: public static void main(String[] args) { try{ Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); Connection con = DriverManager.getConnection("jdbc:derby:datahold;"); Statement stat = con.createStatement(); ResultSet rs = stat.executeQuery("select * from APP.DATASTORE"); ResultSetMetaData meta=rs.getMetaData(); int columnCount = meta.getColumnCount(); for (int x = 1; x &lt;= columnCount; x++) System.out.format("%20s",meta.getColumnName(x)+ " | "); while (rs.next()){ System.out.println(""); for (int x = 1; x &lt;= columnCount; x++) System.out.format("%20s", rs.getString(x)+ " | "); } if (stat != null) stat.close(); if (con != null) con.close(); } catch(Exception e) { System.out.print(e); } } The Error: java.sql.SQLSyntaxErrorException: Table/View 'APP.DATASTORE' does not exist.BUILD SUCCESSFUL (total time: 1 second) My Data Base Setup: I have tried removing the "APP." but this then results in the application not being able to find a table "ROOT.DATASTORE". If anyone is able to help me out here that would be great! UPDATE: I can now see that when running the application, it is creating the database files in the root of the package. Therefore, the embedded driver connection must be working (at least that's the way I see it). My question is should the database be located here or should it be held in the "dist" folder? I am assuming it is not able to see the table because it is looking in the wrong location.
type: Question
tagged with: netbeans
answer count: 2
tagged with: database-connection

http://stackoverflow.com/q/25328498
has comment: http://stackoverflow.com/comment/39485500
has comment: http://stackoverflow.com/comment/39484870
type: Question
has answer: http://stackoverflow.com/a/25328535
has title: Flag Class in Java
has answer: http://stackoverflow.com/a/25328620
has comment: http://stackoverflow.com/comment/39484808
has comment: http://stackoverflow.com/comment/39484787
has answer: http://stackoverflow.com/a/25328528
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39485433
has comment: http://stackoverflow.com/comment/39484833
downvote count: 0
has answer: http://stackoverflow.com/a/25328566
upvote count: 1
has body: I am trying to create a class in Java with one boolean variable named flag, that I can access and change using getter and setter in any other class. My class code looks like this: public abstract class WindowFlag { private boolean flag = false; public boolean getFlag() { return flag; } public void setFlag(boolean flag) { this.flag = flag; } } However when I try to call WindowFlag.setFlag(true); I get an error: Cannot make a static reference to a non-static method setFlag(). However if I set the method to static I cannot use the value of flag boolean from this class. How should I solve this?
has comment: http://stackoverflow.com/comment/39484934
has comment: http://stackoverflow.com/comment/39484838
favorite count: 0
has comment: http://stackoverflow.com/comment/39484801
answer count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25328629
score: 1

http://stackoverflow.com/comment/39460652
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25315403
has text: I tried using it but it gave a java.nio.NoSuchFileException!!

http://stackoverflow.com/q/25301195
tagged with: java
has body: I am viewing the Apache POI docs, both the ones that came with my download, and the ones on the live site. There should be a setParagraph() method in the org.apache.poi.xwpf.usermodel.XWPFDocument class. I am consuming this class in ColdFusion, and am unable to access many of the methods listed in the docs. Is this due to consuming the class or possibly class dependencies improperly? Or is this due to Apache POI .jars being updated and no longer supporting the setParagraph() method? Update: I am using ColdFusion 9 and am loading the classes using JavaLoader.cfc. Here is the code I use to instantiate the classes I require for my manipulations. &lt;cfset javaLoader = server[application.myJavaLoaderKey]&gt; &lt;cfset OPCPackage = javaLoader.create("org.apache.poi.openxml4j.opc.OPCPackage")&gt; &lt;cfset dot_template_opc = OPCPackage.open("pathToDocxFileInstantiated")&gt; &lt;cfset XWPFDocument = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFDocument")&gt; &lt;cfset dot_template = XWPFDocument.init(dot_template_opc)&gt; &lt;cfset XWPFParagraph = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFParagraph")&gt; &lt;cfset XWPFTable = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFTable")&gt; &lt;cfset XWPFRun = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFRun")&gt; &lt;cfset CTP = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP")&gt; &lt;cfset CTRImpl = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTRImpl")&gt; &lt;cfset CTText = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText")&gt; &lt;cfset dot_output = "pathToNewDocxFile"&gt;&lt;!--- Edited version of original ---&gt; &lt;cfset outputObject_dot = CreateObject("java","java.io.FiltOutputStream", "java", "java.io.FileOutputStream" ).Init( CreateObject( "java", "java.io.File" ).Init( dot_output )&gt; Here is the relevant code from Application.cfc pertaining to JavaLoader.cfc. It is being held within the …
answer count: 1
has answer: http://stackoverflow.com/a/25309143
downvote count: 0
has comment: http://stackoverflow.com/comment/39435334
favorite count: 0
type: Question
tagged with: coldfusion-9
tagged with: apache-poi
upvote count: 2
tagged with: apache
has title: Apache POI 3.10 Final XWPFDocument.setParagraph()
linked to: http://stackoverflow.com/q/10612042
has comment: http://stackoverflow.com/comment/39438530
tagged with: coldfusion
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25309143
has comment: http://stackoverflow.com/comment/39453968

http://stackoverflow.com/comment/39408076
comment on: http://stackoverflow.com/a/25287071
type: Comment
has text: And removing the `orphanRemoval = true` when managing everything by hand has not worked out?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39561299
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25370165
has text: ur key is same for both constant com.epstudios.basketballmanager_v1.MATCHRESULT??

http://stackoverflow.com/comment/68414858
type: AnswerComment
score: 3
comment on: http://stackoverflow.com/a/25242450
type: Comment
has text: Excellent Article https://www.genuitec.com/spring-frameworkrestcontroller-vs-controller/

http://stackoverflow.com/comment/39582274
type: AnswerComment
has text: strangely it detects "hello my name is kia gallery, what I do is creating amazing jewelry mostly in gold " as hungarian language, any thoughts ?
score: 0
comment on: http://stackoverflow.com/a/25381325
type: Comment

http://stackoverflow.com/a/37553324
has comment: http://stackoverflow.com/comment/62628263
downvote count: 1
has comment: http://stackoverflow.com/comment/90172080
score: 1
has body: same problem here, solved with: ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("nashorn"); Object js = engine.eval("new java.util.Date();");
type: Answer
answers question: http://stackoverflow.com/q/25385911
upvote count: 2

http://stackoverflow.com/comment/39333337
type: QuestionComment
type: Comment
has text: it is not clear what you mean by `close`, `class` and `loading`. be more specific.
comment on: http://stackoverflow.com/q/25247006
score: 1

http://stackoverflow.com/a/25242551
has body: Instead of creating new instance of you objects by calling showTable (which never get added to the screen in any way), which is just going to completely mess up your object references, try resetting the TableModel, for example... if ("LA".equals(cityFilter)) { filterTable.setModel(new DefaultTableModel(null, columnNames)); } Take a closer look at How to Use Tables for more details
accepted answer of: http://stackoverflow.com/q/25242372
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25242372
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/comment/39547885
comment on: http://stackoverflow.com/a/25362346
type: Comment
type: AnswerComment
has text: I'm saying your solution is scalable where OP's is not. Imagine trying to send a 5GB file and allocating a `byte[]` of 5GB! It would not work, where your solution of chunking the file into 2kb segments works perfectly and is likely faster too.
score: 1

http://stackoverflow.com/comment/39561676
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25365403
has text: I edited my question, the prob is not with sql but with combo box, cuz when i choose first values from combo boxes and then fill textfields, the data is correctly inserted in my database. And even, when i fill the textfields first, the combo boxes dont allow me to chose and add to my database the value shown.

http://stackoverflow.com/q/25265734
has comment: http://stackoverflow.com/comment/39367856
favorite count: 0
has answer: http://stackoverflow.com/a/25265780
type: Question
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39367964
has comment: http://stackoverflow.com/comment/39367999
possible better answer: http://stackoverflow.com/a/25265780
downvote count: 1
has title: Cast exception while setting name
has answer: http://stackoverflow.com/a/25269509
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39368486
tagged with: java
has comment: http://stackoverflow.com/comment/39367924
has body: I am getting a cast exception while setting the name. Object[] customers= customerRepository.getCustomerName(Id); Customer row = new Customer(); row.setName((String) customers[0]+" "+(String) customers[1]); The exception is: HTTP Status 500 - Request processing failed; nested exception is java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.String
accepted answer: http://stackoverflow.com/a/25269509

http://stackoverflow.com/q/25323613
favorite count: 0
tagged with: sharepoint-2013
score: 3
tagged with: rest
has comment: http://stackoverflow.com/comment/46075750
tagged with: java
has body: I'm trying to access our company SharePoint 2013 instance, which is hosted at ourinstance.sharepoint.com, with small Java web application. I registered application through _layouts/15/AppRegNew.aspx this way: I let SP generate Client ID, Client Secret, to App Domain I set: ourdomain:8443 to Redirect URL I set: https://ourdomain:8443/our-redirect-processing I edited application permissions with _layouts/15/appinv.aspx, where I looked it up by client ID and edited its Permission Request XML to contain: &lt;AppPermissionRequests AllowAppOnlyPolicy="true"&gt; &lt;AppPermissionRequest Scope="http://insideidc.sharepoint.com/oursite/web" Right="FullControl"/&gt; &lt;/AppPermissionRequests&gt; Handler behind https://ourdomain:8443/our-redirect-processing is doing this: JsonWebSignature jws = JsonWebSignature.parse(new JacksonFactory(), request.getParameter("SPAppToken")); JsonParser jsonParser = new JacksonFactory().createJsonParser(jws.getPayload().get("appctx").toString()); AppCtx appCtx = jsonParser.parse(AppCtx.class, new CustomizeJsonParser()); String appctxsender=jws.getPayload().get("appctxsender").toString(); String[] splitApptxSender = appctxsender.split("@"); String sharepointServerHostName = new URL(request.getParameter("SPSiteUrl")).getHost(); String resource = splitApptxSender[0] + "/" + sharepointServerHostName + "@" + splitApptxSender[1]; AuthorizationCodeTokenRequest tokenRequest = new AuthorizationCodeTokenRequest(new NetHttpTransport(), new JacksonFactory(), new GenericUrl(appCtx.getSecurityTokenServiceUri()), jws.getPayload().get("refreshtoken").toString()); tokenRequest.setRedirectUri(request.getRequestURL().toString()); String aud = (String) jws.getPayload().getAudience(); tokenRequest.setClientAuthentication(new ClientParametersAuthentication(aud, secrets.get(aud))); tokenRequest.setGrantType("refresh_token"); tokenRequest.set("resource", resource); tokenRequest.set("refresh_token", jws.getPayload().get("refreshtoken").toString()); TokenResponse respon…
has answer: http://stackoverflow.com/a/28908675
type: Question
tagged with: oauth
has title: Trying to access hosted SharePoint 2013 from Java app gives me 401 although I use correct OAuth token
upvote count: 3
tagged with: ntlm
type: UnansweredQuestion
downvote count: 0
answer count: 1

http://stackoverflow.com/a/25285610
answers question: http://stackoverflow.com/q/25284762
downvote count: 0
upvote count: 1
has body: Need to override `equals()` and `hashCode()` method in the class `X`. If not you can't get the correct true for x.clone().equals(x) For X x1 = new X() x1.equals(x) Since not overriding equals() x1 and x are considered as same object of X class so it return true Without overriding it will check the equals() in Object class public boolean equals(Object obj) { return (this == obj); }
score: 1
type: Answer

http://stackoverflow.com/q/25307841
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I schedule a Spring task scheduler implementation that fetches list of updated value objects from the database. So each time the task is invoked, it is responsible for fetching the delta objects. The task is run every 10 minutes or so. The output of the task runner is used to run a custom Hadoop job. The task is initialized via annotations so I am not programmatically explicitly triggering the task. My XML configuration &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.bofa.ecom.search.scheduler" /&gt; &lt;bean id="configurationScheduler" class="com.bofa.ecom.search.scheduler.ConfigurationScheduler" scope="prototype"/&gt; &lt;task:annotation-driven proxy-target-class="true"/&gt; &lt;task:scheduled-tasks&gt; &lt;task:scheduled ref="configurationScheduler" method="refreshConfiguration" fixed-rate="5000" /&gt; &lt;/task:scheduled-tasks&gt; &lt;/beans&gt; My scheduler interface package testing; import org.apache.hadoop.conf.Configuration; import org.springframework.beans.factory.DisposableBean; public interface IConfigurationScheduler extends DisposableBean { void refreshConfiguration(); Configuration getConfiguration(); } Con…
tagged with: spring
has title: Extract object state from spring task running at regular intervals
tagged with: concurrency
answer count: 0
score: 1

http://stackoverflow.com/comment/39302766
type: Comment
score: 0
type: AnswerComment
has text: @ChrisStack if you need an exact match: `//h2[text() = 'Downloads']`
comment on: http://stackoverflow.com/a/25230385

http://stackoverflow.com/a/25314488
type: Answer
has comment: http://stackoverflow.com/comment/39585943
accepted answer of: http://stackoverflow.com/q/25314120
has comment: http://stackoverflow.com/comment/39467030
answers question: http://stackoverflow.com/q/25314120
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39465666
has body: You need to package your images inside your jar, then reference them as resources. Doing a google search for "java package images inside jar as resource" will give you a ton of results and tutorials. This approach will work from an IDE on your computer or from a packaged jar on your friend's computer. Using an installer is definitely overkill for this goal.
has comment: http://stackoverflow.com/comment/39458468
has comment: http://stackoverflow.com/comment/39458614
has comment: http://stackoverflow.com/comment/39568293
has comment: http://stackoverflow.com/comment/39568222
score: 0

acl
tag name: acl
tags question: http://stackoverflow.com/q/25293615
tags question: http://stackoverflow.com/q/25385917
type: Tag

http://stackoverflow.com/a/25279316
has comment: http://stackoverflow.com/comment/39396578
has comment: http://stackoverflow.com/comment/39393480
has body: Have a look at this plugin. Very configurable. The only catch is that you have to use jquery on your jsp/html page which is not bad at all. So get the list from the web server and dynamically construct a table from the list. configure data tables and let it handle the render. Spring has no support for front end development. http://www.datatables.net/
answers question: http://stackoverflow.com/q/25238306
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39402074
has comment: http://stackoverflow.com/comment/39511308

http://stackoverflow.com/q/25246151
has title: Canvas getMaximumBitmapWidth and getMaximumBitmapHeight functionality
tagged with: android-canvas
has body: How does the methods of Canvas, getMaximumBitmapWidth() and getMaximumBitmapHeight(), works out. These methods are non-static and seems to be returning static final value according to this Why make the methods non-static, if the values does not change with the instance?
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/28610530

http://stackoverflow.com/a/25307305
answers question: http://stackoverflow.com/q/25286519
has body: If you use JNA and want to call a java program which use its library from batch file, you must avoid using java file. Because it can not load classes at runtime when you call jna.jar from batch too. My code was like: @ECHO OFF java -jar jna-4.1.0.jar java MyBenchmark I tried many other solution too but nothing works(I also used code at question part too). Lastly I tried export my project as jar and used it. First of all I want to state that my IDE was Intellij IDEA. It cannot put project dependency to my manifest file(jna path) although I put jar dependency already. So if you use IDEA, you must enter that from artifact screen manually, otherwise your jar cannot work right. Then you can put your jar under same folder with your bacth and call it like below: java -jar MyJarFile.jar
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25286519

http://stackoverflow.com/comment/39614951
type: QuestionComment
type: Comment
has text: It is not causing problems but even after doing force GC the objects are still existing. The spring ApplicationContext itself doesn't get garbage collected.
comment on: http://stackoverflow.com/q/25378053
score: 0

http://stackoverflow.com/comment/39567260
comment on: http://stackoverflow.com/q/25371058
type: Comment
type: QuestionComment
has text: @skia.heliou: No, you don't. You can pass a `Comparator` into the `TreeSet` constructor; you don't need it to be `Comparable` just to put it in a `TreeSet`.
score: 1

http://stackoverflow.com/a/25251773
answers question: http://stackoverflow.com/q/25251529
has comment: http://stackoverflow.com/comment/39400500
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/39342957
upvote count: 6
type: Answer
has body: Java is not my strongest VM, but I generally understand the opcodes. 27: ifne 120 30: ifeq 119 A conditional branch pops the top value off the stack. So this is not an unconditional branch, it is 2 branch instructions based on 2 different (consecutive) stack values. In short, it consumes 2 different values. So if you have 0 and 1 on the stack, it would fall through without branching. Also, static field initialization is not guaranteed to execute immediately, the JVM spec that I have (old one) says it will execute lazily, on the first non-constant access to the class. That may not be relevant to your question, but is worth mentioning. Last but not least, not all bytecode is valid. Obfuscators will insert invalid / dead code that is either unreachable, redundant, or "obfuscated" by definition.

http://stackoverflow.com/comment/39523113
has text: Oh, in Java it is called from the main method..Thanks, guys. But, still. Any suggestions? I do my work around books, but in the meantime, I like to code something.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25349795

http://stackoverflow.com/a/25326516
has comment: http://stackoverflow.com/comment/39518674
downvote count: 0
has body: I would go with lwjgl applet. But I want to warn you that you should think twice if you actually want your game to be played through browser - if you want to look reliable, you have to sign your jars, which cost around 200$ / year.
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25325440
has comment: http://stackoverflow.com/comment/39518294

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25245042
type: Tag
tags question: http://stackoverflow.com/q/25248981
tags question: http://stackoverflow.com/q/25293788

http://stackoverflow.com/comment/39483038
comment on: http://stackoverflow.com/q/25327542
score: 0
type: Comment
type: QuestionComment
has text: So, if I have for example a countdown timer in my game, I have just to pause it on my onPause method and resume it on my onResume method?

http://stackoverflow.com/comment/39465268
has text: If the activity is the .java File I need to switch it. :/ Because I use an GPS-Script that crashes, if I try to get an other Button in it :]
type: Comment
comment on: http://stackoverflow.com/a/25317990
score: 0
type: AnswerComment

http://stackoverflow.com/a/25371716
answers question: http://stackoverflow.com/q/25316761
has comment: http://stackoverflow.com/comment/39593215
accepted answer of: http://stackoverflow.com/q/25316761
has comment: http://stackoverflow.com/comment/129391855
type: Answer
has comment: http://stackoverflow.com/comment/39593427
has comment: http://stackoverflow.com/comment/39566285
has comment: http://stackoverflow.com/comment/39593349
has comment: http://stackoverflow.com/comment/39571225
score: 3
upvote count: 3
has body: First of all there are some things to clear out: You have a bidirectional association between HL7GeneralCode(the parent) and HL7Address (the child). If the HL7GeneralCode.addresses is the "inverse" side (mappedBy) then why the owning side HL7Address.use has insertable/updatable false? The owning side should control this association so you should remove the insertable/updatable=false flags. It always makes sense to cascade from the Parent to the Child, not the other way around. But in your use case, you try to persist the Child and automatically persist the Parent too. That's why the CASCADE.ALL on the many to one end doesn't make sense. When using bidirectional associations, both sides are mandatory to be set: HL7Address addr = new HL7Address(); HL7GeneralCode code = new HL7GeneralCode(); ... code.getAddresses().add(addr); addr.setUse(code); The persist operation is meant to INSERT transient entities, never to merge them or reattach entities. This implies that both the HL7Address and the HL7GeneralCode are new entities when you call your service method. If you have already saved a HL7GeneralCode with the same ID, you will get the primary key constraint violation exception. If the HL7GeneralCode is possible to exist, then you should fetch it from db. HL7GeneralCode code = em.find(HL7GeneralCode, pk); HL7Address addr = new HL7Address(); if(code != null) { code = new HL7GeneralCode(); em.persist(code); } code.getAddresses().add(addr); addr.setUse(code); em.persist(addr); UPDATE The HL7Address address doesn't override equals/hashCode so the default object same reference check rule applies. This will ensure we can add/remove addresses from the code.addresses List. In case you change your mind later, make sure you implement equals and hashCode properly. Although not related to your issue, you might want to use getter/setter instead of making your fields public. This provides better encapsulation and you will avoid mixing setters with public field access. The savehl7Addres…
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39337947
comment on: http://stackoverflow.com/q/25245907
type: Comment
has text: @DipanshuVerma: Even though the other files import the dependencies, do they actually *use* them? Do they actually create instances of classes defined therein?
score: 0
type: QuestionComment

http://stackoverflow.com/a/27166772
type: AcceptedAnswer
downvote count: 0
has body: Menu -&gt; "Tools" -&gt; "Options.." -&gt; Select "Java" as "Option Category:" -&gt; Tick "Generate codes even when there is no profile" as "Option Item:" -&gt; Click "Ok" It "Specifies whether to generate codes even when Java profile is not loaded in the project (not recommended)." Now it is possible to generate java code.
accepted answer of: http://stackoverflow.com/q/25347267
type: Answer
answers question: http://stackoverflow.com/q/25347267
score: 2
upvote count: 2

http://stackoverflow.com/comment/39539257
comment on: http://stackoverflow.com/a/25357784
has text: Thanks a lot that is what i exactly needed.it works.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25247519
score: 2
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/39334922
tagged with: java
tagged with: user-interface
downvote count: 0
tagged with: swing
has title: Java JButton not creating when in an If Statement
has answer: http://stackoverflow.com/a/25253806
favorite count: 0
has answer: http://stackoverflow.com/a/25248546
type: Question
has comment: http://stackoverflow.com/comment/39334396
has comment: http://stackoverflow.com/comment/39334450
has comment: http://stackoverflow.com/comment/39334319
has comment: http://stackoverflow.com/comment/39334413
type: UnansweredQuestion
has body: I am working on a Java GUI program that is just a practice/example program that checks what rooms are empty in a hotel and reserves them for a group of people. My problem is I need a JButton to be show after the "Check Room Availability" is pressed and if there is a index in the RoomsArray that has a value of 0. I was able to get a JTextPane to be shown after that button is pressed but my "Yes" JButton won't appear if it is in an If Statement, it works fine if it is outside of the If Statement but I need it to only appear after the "Check Room Availability" button is pressed. Any help is appreciated! package text; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.Toolkit; import javax.swing.JTextPane; import java.awt.Color; import javax.swing.UIManager; import java.awt.Font; import java.awt.Choice; import javax.swing.JButton; import org.apache.commons.lang3.ArrayUtils; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JMenu; @SuppressWarnings("serial") public class HotelReservationGUI extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { HotelReservationGUI frame = new HotelReservationGUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. * @return */ public HotelReservationGUI() { contentPane = new JPanel(); final int[] RoomsArray = new int[10]; RoomsArray[0] = (int) ((10 * Math.random()) - 1); RoomsArray[1] = (int) ((10 * Math.random()) - 1); RoomsArray[2] = (int) ((10 * Math.random()) - 1); RoomsArray[3] = (int) ((10 * Math.random()) - 1); RoomsArray[4] = (int) ((10 * Math.random()) - 1); RoomsArray[5] = (int) ((10 * Math.random()) - 1); RoomsArray[6] = (int) ((10 * Math.random()) - 1); RoomsArra…
tagged with: user-input
has comment: http://stackoverflow.com/comment/39334467

http://stackoverflow.com/comment/39399317
type: QuestionComment
has text: do not use jre higher than 1.6 or java 6. since android runtime has java 6.If you use java 7 or java 8 at compile time than you get exception when running app in emulator or device.
comment on: http://stackoverflow.com/q/25282833
score: 0
type: Comment

http://stackoverflow.com/a/25386248
has body: The problem was that whilst I'd added the new codebase address to all the library jars the app uses, I hadn't added it correctly to the main jar. As it turns out a manifest codebase mismatch is reported in the console for a library jar but not for the main jar file. It just fails as ours did and gives no clue. To add the codebase in netbeans just add it to the manifest.custom.codebase property in project.properties.
accepted answer of: http://stackoverflow.com/q/25384503
score: 1
type: AcceptedAnswer
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25384503

http://stackoverflow.com/a/25353349
has comment: http://stackoverflow.com/comment/39529350
upvote count: 4
answers question: http://stackoverflow.com/q/25353329
downvote count: 0
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39529259
has body: assertTrue() is declared to return void, so you cannot use it as the expression of an if statement. JUnit assertions will automatically print an error message when they fail, as long as you use them correctly within the JUnit framework.

http://stackoverflow.com/q/25255239
upvote count: 1
has body: Hi i'm looking for a way to animate these little icons i have for an app i'm making. basically i want 3 little icons to slide from the top of the portrait android screen to the bottom continuously and randomly. I have searched a lot so sorry if this is a repeat but i just cant quite find anything i can understand. So far i have Nothing except the images and xml set up. If this is already answered can someone please point me in the right direction. Is there a way to go about this in xml or must i use java? also would it be easier to use a framework such as libgdx with box2D?
score: 1
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/4938822
has answer: http://stackoverflow.com/a/25255803
linked to: http://stackoverflow.com/q/16185065
favorite count: 0
type: Question
has title: how to i animate an object in android?
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: animation

http://stackoverflow.com/a/25415871
type: Answer
score: 2
has body: As the earlier answer noted, there is a different between real-time and turn-based APIs - the turn-based APIs DO allow you to play asynchronously, and - as far as I know - you can also have multiple games running without any problems. https://developers.google.com/games/services/android/turnbasedMultiplayer The system doesn't work for turn-based games with simultaneous moves, but based on your description, I would think it would work fine for your purposes. Regarding your questions, I've spent some time looking at solutions for multiplayer turn-based game myself and these are my observations: Everything is possible. But if your question is - does Google Play Services support integration, then the answer is no. It's as suitable as most other framework that you might would use to implement a web service. Though it does depend on how much processing you need on the server side; note that there are some limits on how long requests can run, etc. You'll need to roll your own. If you're a Java programmer, you should look at working with a Java-based framework for the backend; Google App engine support this OK. You could also consider setting up your own virtual server somewhere else as - at least right now - there is not much benefit to using Google App engine for stuff like this (at least IMO). Two key elements you need to be clear on: how is your game state saved server-side, and how is the user authenticated. The latter, in particular, is important. If your game structure fits within the Google Play services turn based framework, I would certainly think twice before going for an own solution - at least at the moment.
downvote count: 0
answers question: http://stackoverflow.com/q/25360188
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25360188
type: AcceptedAnswer

http://stackoverflow.com/q/25316128
type: Question
linked to: http://stackoverflow.com/q/8148684
answer count: 2
has title: Change string to a double assign value update and assign back to a string
has body: I am trying to convert a string that the user inputs (price) to a double (price1) and assign it to a total price variable. Then I will convert it back to a string and store it in a map. I have copied the code I have written so far. public class SalesTax { public static void main(String[] args) { // Input items for shopping cart HashMap&lt;String, String&gt; cart = new HashMap&lt;String, String&gt;(); HashMap&lt;String, String&gt; shoppingcart = new HashMap&lt;String, String&gt;(); // Create a Scanner Scanner input = new Scanner(System.in); // variables char done; boolean goods; double totalprice = 0; double totalwtax = 0; double totaltax; // Pick items for list. do { System.out.print("Please enter an item."); String item = input.nextLine(); System.out.print("Please enter the price for "+ item + ": "); String price = input.nextLine(); double price1 = Double.parseDouble(price); totalprice += price1; String price2 = String.valueOf(price1); shoppingcart.put(item, price2); cart.put(item, price); //determine if item will have additional tax if (item.contains("music") == true) { double newprice = Double.parseDouble(price); newprice = newprice *1.10; totalwtax +=newprice; String newprice2 = String.valueOf(newprice); shoppingcart.put(item, newprice2); } else if (item.contains("imported") == true) { double newprice = Double.parseDouble(price); newprice = newprice *1.05; totalwtax +=newprice; String newprice2 = String.valueOf(newprice); shoppingcart.put(item, newprice2); } else if(item.contains("bottle") == true) { double newprice = Double.parseDouble(price); newprice = newprice *1.10; totalwtax +=newprice; String newprice2 = String.valueOf(newprice); shoppingcart.put(item, newprice2); } else { shoppingcart.put(item, price); } System.out.print("Would you like to continue to add items? (Type Y) for Yes and (Type N) for No."); done = input.nextLine().charAt(0); totaltax = totalprice - totalwtax; } while(Character.toUpperCase(done) == 'Y'); System.out.println("Your cart contains …
upvote count: 0
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/25324051
tagged with: assignment-operator
tagged with: variable-assignment
has comment: http://stackoverflow.com/comment/39465894
has comment: http://stackoverflow.com/comment/39465856
has comment: http://stackoverflow.com/comment/39461601
tagged with: java
has answer: http://stackoverflow.com/a/25316241
downvote count: 2
favorite count: 0

http://stackoverflow.com/a/25451662
has body: Assuming you already have discovered the post URI and thus the URI of the association resource (considered to be $association_uri in the following), it generally takes these steps: Discover the collection resource managing comments: curl -X GET http://localhost:8080 200 OK { _links : { comments : { href : "…" }, posts : { href : "…" } } } Follow the comments link and POST your data to the resource: curl -X POST -H "Content-Type: application/json" $url { … // your payload // … } 201 Created Location: $comment_url Assign the comment to the post by issuing a PUT to the association URI. curl -X PUT -H "Content-Type: text/uri-list" $association_url $comment_url 204 No Content Note, that in the last step, according to the specification of text/uri-list, you can submit multiple URIs identifying comments separated by a line break to assign multiple comments at once. A few more notes on the general design decisions. A post/comments example is usually a great example for an aggregate, which means I'd avoid the back-reference from the Comment to the Post and also avoid the CommentRepository completely. If the comments don't have a lifecycle on their own (which they usually don't in an composition-style relationship) you rather get the comments rendered inline directly and the entire process of adding and removing comments can rather be dealt with by using JSON Patch. Spring Data REST has added support for that in the latest release candidate for the upcoming version 2.2.
has comment: http://stackoverflow.com/comment/55868158
has comment: http://stackoverflow.com/comment/50125956
has comment: http://stackoverflow.com/comment/55330104
downvote count: 1
has comment: http://stackoverflow.com/comment/59234307
answers question: http://stackoverflow.com/q/25311978
has comment: http://stackoverflow.com/comment/48840415
has comment: http://stackoverflow.com/comment/40267018
has comment: http://stackoverflow.com/comment/46146796
has comment: http://stackoverflow.com/comment/89621676
has comment: http://stackoverflow.com/comment/62903494
type: Answer
has comment: http://stackoverflow.com/comment/49215902
has comment: http://stackoverflow.com/comment/50156267
has comment: http://stackoverflow.com/comment/50151757
has comment: http://stackoverflow.com/comment/55868420
has comment: http://stackoverflow.com/comment/54458598
has comment: http://stackoverflow.com/comment/68650340
has comment: http://stackoverflow.com/comment/40036311
has comment: http://stackoverflow.com/comment/48885814
has comment: http://stackoverflow.com/comment/70342393
upvote count: 57
has comment: http://stackoverflow.com/comment/72609833
has comment: http://stackoverflow.com/comment/41069004
has comment: http://stackoverflow.com/comment/48975474
has comment: http://stackoverflow.com/comment/45662590
score: 56
has comment: http://stackoverflow.com/comment/40267054

http://stackoverflow.com/q/25379639
has comment: http://stackoverflow.com/comment/39578910
score: 0
answer count: 0
tagged with: java
has title: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.Box
has comment: http://stackoverflow.com/comment/39578964
tagged with: boxlayout
type: Question
has body: I have two JPanels leftTextField and rightTexTField which both contain one instance of FileBox as followed: public class FileBox extends Box { private Box content; public FileBox(String text) { super(3); // ? content = Box.createVerticalBox(); init(text); } private void init(String text) { JTextArea editor = new JTextArea(); editor.setDragEnabled(true); editor.setText(text); editor.setEditable(false); JScrollPane scrollPane = new JScrollPane(editor); content.add(Box.createVerticalStrut(5)); content.add(scrollPane); content.add(Box.createVerticalStrut(5)); } public Box get() { return content; } public void set(Box content) { this.content = content; } } I also have two buttons with actionListeners and want to perform some Code, once the listeners gets triggered. I tried something like this: @Override public void actionPerformed(ActionEvent e) { if(e.getSource().equals(buttonToLeft)) { FileBox left = (FileBox) leftTextPanel.getComponent(0); FileBox right = (FileBox) rightTextPanel.getComponent(0); left.set(right.get()); } } However i do get the error Message as posted in the title which i don't understand. FileBox is a Component of my leftTextPanel, because i added it with leftTextPanel.add(new FileBox()) etc. Is there any reason why it is now an instance of Box and i cannot cast it? How do i solve this issue?
has comment: http://stackoverflow.com/comment/39579468
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39580325
tagged with: swing
has comment: http://stackoverflow.com/comment/39581132
has comment: http://stackoverflow.com/comment/39579159

http://stackoverflow.com/comment/39415835
score: 1
type: Comment
has text: Since the second one is generated by Eclipse, I can only surmise that it is impossible that I would be using the wrong data types
type: AnswerComment
comment on: http://stackoverflow.com/a/25291507

http://stackoverflow.com/a/25277671
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25275427
has body: Yes, they changed in v5.0 their whole API, and now they use a REST API. Here is de descriptor file: http://javadoc.pentaho.com/bi-platform500/webservice500/application.wadl Import it to SoapUI and you're good to go to test the services.

http://stackoverflow.com/q/25325117
has body: My (OpenGL ES 2.0) app has a splashscreen which is basically an Android View displayed over my GLSurfaceView. I do all my initial setup on an AsyncTask and then (out of necessity), load my bitmaps/textures on the GLRendering thread in onSurfaceCreated. Once everything has loaded, I dismiss my splashscreen. Everything works as expected apart from one thing. The splashscreen still accepts input and if the screen is touched just after the app is launched, I (obviously) get an null pointer exception. I simply create my view like so: splashscreen = new SplashScreen(getApplication(), width, height); //Where SplashScreen is a custom class that extends View I then add it to my layout like so: layout.add(myView); //My GLSurfaceView layout.add(splashscreen); //The splashscreen View setContectView(layout); Once everything has loaded, I simply remove the (splashscreen) View to reveal my GLSurfaceView underneath: layout.removeView(splashscreen); splashscreen=null; //Null it currently, in my onTouch method, to get around the issue, I have put a check in place like so: public boolean onTouchEvent(MotionEvent event) { if(splashscreen==null){ //Do touch related stuff here } return true; } This does work, however, I'm sure it's not the cleanest way to achieve what I'm after. I've tried this: splashscreensetClickable(false); and layout.setClickable(false); as well as setEnabled(false) Nothing seems to work, but I'm sure there must be a way of doing this.......
tagged with: android
tagged with: java
tagged with: ontouchlistener
has comment: http://stackoverflow.com/comment/39491635
has answer: http://stackoverflow.com/a/25333980
type: Question
tagged with: touch
score: 0
has comment: http://stackoverflow.com/comment/39493150
has comment: http://stackoverflow.com/comment/39492718
answer count: 1
has title: How to disable touch events on a View?
has comment: http://stackoverflow.com/comment/39493691
accepted answer: http://stackoverflow.com/a/25333980
type: AnsweredQuestion
tagged with: opengl-es-2.0

http://stackoverflow.com/q/25334332
has comment: http://stackoverflow.com/comment/39496771
answer count: 1
tagged with: jsp
has body: What I am trying to do is dynamically create slides in the Twitter Bootstrap Carousel control by connecting to a database, taking pictures from that database and populating the carousel with those images. For some reason, the carousel that I am working on will not slide. Anything wrong with my code? <% rs = stmt.executeQuery("SELECT IMG_NAME FROM IMAGES WHERE IMG_NAME LIKE 'Material%'"); ResultSetMetaData rsmd = rs.getMetaData(); while (rs.next()) { names.add(rs.getString(1)); } double testDouble = names.size() / 3; int divider = names.size() / 3; if (testDouble > divider) { divider++; } int totalSpaces = divider * 3; int lastBit = totalSpaces % names.size(); for (int j = 0; j < divider + 0; j++) { List<String> content = new ArrayList<String>(); if (names.size() >= 3) { %> <% for (int x = 0; x < 3; x++) { content.add(names.get(x)); String theUrl_2 = "http://localhost:8085/assignment/GetImage?name=" + content.get(x); %> <a href="<%=theUrl_2%>"> 3 <img src="<%=theUrl_2%>" alt="ALT NAME"> kjlkj <% } names.remove(2); names.remove(1); names.remove(0); %> <% } else { %> <% for (int i = 0; i < lastBit; i++) { content.add(names.get(i)); String theUrl = "http://localhost:8085/assignment/GetImage?name=" + content.get(i); %> <a href="<%=theUrl%>"> 1 <img src="<%=theUrl%>" alt="ALT NAME"> test <% } %> <% } } %>
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25335354
accepted answer: http://stackoverflow.com/a/25335354
tagged with: scriptlet
has comment: http://stackoverflow.com/comment/39496940
type: Question
has title: Problems with twitter bootstrap carousel control?
tagged with: twitter-bootstrap

http://stackoverflow.com/comment/39463161
has text: I've edited my answer to include a link to a related question. The answers on that question appear to have some methods for removing window borders.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25315922
type: Comment

http://stackoverflow.com/q/25242372
has comment: http://stackoverflow.com/comment/39324431
tagged with: jtable
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/513832
has title: Table does not update when selecting combobox
has body: My problem is that a JTable does not update when I select my combobox. The program I present below should delete all data (data = null;), when LA is selected. The table does not update. public class minimumExample extends JFrame { private JTabbedPane tabbedPane; private FilteredTabPanel filteredTabPanel; public void createTabBar() { tabbedPane = new JTabbedPane(JTabbedPane.TOP); filteredTabPanel = new FilteredTabPanel(); tabbedPane.addTab("Test", filteredTabPanel.createLayout()); add(tabbedPane); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } private void makeLayout() { setTitle("Test App"); setLayout(new BorderLayout()); setPreferredSize(new Dimension(1000, 500)); createTabBar(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public void start() { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { makeLayout(); } }); } public static void main(String[] args) throws IOException { minimumExample ex = new minimumExample(); ex.start(); } public class FilteredTabPanel extends JPanel { private JPanel selectionArea; private JLabel lCity; private JComboBox cityBox; private JTable filterTable; String[] columnNames = {"Cities"}; String[][] data = { {"NY"}, {"NY"}, {"NY"}, {"NY"}, {"LA"}, {"LA"},{"Columbia"},{"DC"},{"DC"},{"DC"},{"DC"},{"DC"},{"DC"} }; private JScrollPane scrollPane; public JPanel createLayout() { JPanel panel = new JPanel(new GridLayout(0, 1)); //add panels to the layout panel.add(addButtons()); panel.add(showTable()); repaint(); revalidate(); return panel; } public JPanel addButtons(){ selectionArea = new JPanel(new FlowLayout(FlowLayout.LEFT)); lCity = new JLabel("City"); String[] fillings = {"NY", "LA", "Columbia", "DC"}; cityBox = new JComboBox(fillings); cityBox.addActionListener(new ActionListener() { private String cityFilter; @Override public void actionPerformed(ActionEvent arg0) { //2. get data cityFilter = cityBox.getSelectedItem().toString(); if(cityFilter.equals("LA")) { data …
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39324569
has comment: http://stackoverflow.com/comment/39324402
downvote count: 1
has comment: http://stackoverflow.com/comment/39324311
accepted answer: http://stackoverflow.com/a/25242551
tagged with: jcombobox
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25242551
upvote count: 0
has comment: http://stackoverflow.com/comment/39324469
tagged with: swing
score: -1

http://stackoverflow.com/q/25264684
downvote count: 5
tagged with: latitude-longitude
has comment: http://stackoverflow.com/comment/39365843
has comment: http://stackoverflow.com/comment/39366288
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39366631
has comment: http://stackoverflow.com/comment/39366230
has answer: http://stackoverflow.com/a/25267557
has comment: http://stackoverflow.com/comment/39366401
has comment: http://stackoverflow.com/comment/39365937
tagged with: java
has title: How to generate random latitude and longitude in a city using java?
accepted answer: http://stackoverflow.com/a/25267557
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39366258
tagged with: random
has body: How can I generate a random location (latitude and longitude) within a city using Java? I want to test application functionality with random locations within a city (a single city for now).
score: -4
answer count: 1
has comment: http://stackoverflow.com/comment/39366685
upvote count: 1

http://stackoverflow.com/q/25315729
has body: I'm trying to call a mapreduce job from a java application. In former hadoop versions (1.x) I created a Configuration object and a Job object, set mapred.job.tracker and fs.default.name in the Configuration and ran the Job. Now, in hadoop 2.x the job tracker does not exist anymore neither exists there any documentation on how to programatically run MR jobs. Any ideas? What I'm looking for is an explanation as given here: call mapreduce from a java program
tagged with: hadoop-yarn
has answer: http://stackoverflow.com/a/25316519
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25338124
possible better answer: http://stackoverflow.com/a/25338124
score: 1
has comment: http://stackoverflow.com/comment/39462082
tagged with: java
tagged with: resourcemanager
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25316519
tagged with: mapreduce
has title: Launch mapreduce job on hadoop 2.2 (Yarn) from java application
favorite count: 0
type: Question
tagged with: hadoop
linked to: http://stackoverflow.com/q/9849776

http://stackoverflow.com/a/25282278
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: There are 2 problems with your configuration @Autowired will only work for Spring Managed beans, your MainClass isn't spring managed so no autowiring is going to happen @Autowired will not work on static fields
accepted answer of: http://stackoverflow.com/q/25279501
answers question: http://stackoverflow.com/q/25279501

http://stackoverflow.com/comment/39363457
type: Comment
comment on: http://stackoverflow.com/a/25263362
type: AnswerComment
has text: I'm passing it as List<Option> so I need.
score: 0

http://stackoverflow.com/q/25302999
has title: Using addShutdownHook in java
upvote count: 1
has body: I want to do following operation in ordered wise 1. Stop jetty server 2. Delete used resource from jetty 3. Restart jetty server. I have done this above using shutdownhook in java as below : &lt;code&gt; Thread restartThread = new Thread(){ public void run(){ try { sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } String osName = System.getProperty("os.name"); logger.debug("OS name:" + osName); if (osName != null &amp;&amp; osName.toUpperCase().startsWith("WINDOWS")) { Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { List&lt;String&gt; cmdLine = new ArrayList&lt;String&gt;(); cmdLine.add("cmd.exe"); cmdLine.add("/C"); cmdLine.add("start"); cmdLine.add("\"\""); cmdLine.add(getBaseDir() + File.separator + "restart.bat"); final ProcessBuilder pb = new ProcessBuilder(cmdLine); Process process = pb.start(); if (process.exitValue() == 0) { // after stopping server delete stores deleteCertificates(); // restores files restoreFiles(tmpdir, backupfilelist); } //p.waitFor(); } catch (IOException e) { logger.error("Failed to restart:" + e.getMessage(), e); } } }); System.exit(0); } else { try { Runtime.getRuntime().exec("service appservice restart"); } catch (IOException e) { logger.error("Failed to restart:" + e.getMessage(), e); } } } }; restartThread.start(); &lt;code&gt; my concern is will it do it sequentially execution, otherwise application will fail to restore.
has comment: http://stackoverflow.com/comment/39437301
has comment: http://stackoverflow.com/comment/39437206
has comment: http://stackoverflow.com/comment/39437273
score: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39437192

http://stackoverflow.com/comment/39342105
type: Comment
type: QuestionComment
score: 0
has text: @Matt Well, in my case it does, unfortunately. And given that the business logic is probably just a few lines, and this all was a custom development, and even the linked tutorial promotes exactly that approach, I can see why it was done like this. Either way, these are the prerequisites I have to deal with.
comment on: http://stackoverflow.com/q/25250127

http://stackoverflow.com/a/25375498
answers question: http://stackoverflow.com/q/25290036
downvote count: 0
type: Answer
has body: This is a CPU intensive operation and not long running or blocked on I/O. If you are using Java 8 you can use parallel streams to do processing in parallel as shown below. The method has been changed to use Collection instead of List to keep it more flexible. public static boolean containsAny(final String searchString, final Collection&lt;String&gt; searchCollection) { return searchCollection.stream().parallel() .anyMatch(x -&gt; searchString.indexOf(x) &gt; -1); } Furthermore, instead of using List, a Set should be used as the underlying data structure so that duplicate entries, if any, will be eliminated.
score: 8
upvote count: 8

http://stackoverflow.com/a/25381281
score: 1
has comment: http://stackoverflow.com/comment/39595678
has body: isDone() is called after doInBackground() but you receive a property change event after the completion of isDone() and since your listener overwrites almost all UI properties you are modifying in isDone() you are drawing the wrong conclusion. PropertyChangeEvents are sent for different properties, most notably for progress and state. The last event you receive after isDone has been called is telling you that the state property of the SwingWorker went from STARTED to DONE. You can examine the property name of the PropertyChangeEvent to tell changes of progress and state apart.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39596065
has comment: http://stackoverflow.com/comment/39588588
upvote count: 1
has comment: http://stackoverflow.com/comment/39589084
has comment: http://stackoverflow.com/comment/39588456
type: Answer
accepted answer of: http://stackoverflow.com/q/25372124
has comment: http://stackoverflow.com/comment/39594050
has comment: http://stackoverflow.com/comment/39588313
answers question: http://stackoverflow.com/q/25372124
has comment: http://stackoverflow.com/comment/39594885

http://stackoverflow.com/comment/39519937
score: 0
type: AnswerComment
type: Comment
has text: Make the image accessible through your webserver. Give it a url such as http://localhost:8181/pic/th.jpg (and of course update your code to server the image from that location)
comment on: http://stackoverflow.com/a/25348108

http://stackoverflow.com/comment/39553441
type: Comment
has text: @peter i have updated my question. Plaese if you can check it again.
type: QuestionComment
comment on: http://stackoverflow.com/q/25264296
score: 0

http://stackoverflow.com/comment/39308898
comment on: http://stackoverflow.com/q/25233881
type: Comment
type: QuestionComment
has text: That's not how you do delays in Swing, but rather that's how you completely disable your GUI rendering it useless. Use a Swing Timer (Google the tutorial) for delays.
score: 0

http://stackoverflow.com/comment/39522827
has text: Yes, I did, nothing worked
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25349570

http://stackoverflow.com/comment/39573353
score: 0
type: Comment
has text: I ended up with `private <T> T convertToBoolean(Object value, T defaultValue) {`, but that's not really a clean solution...
type: AnswerComment
comment on: http://stackoverflow.com/a/25376529

http://stackoverflow.com/q/25294401
tagged with: java
has body: How can I make sure that a null request payload will not be sent to any of the POST or PUT requests?
type: Question
has answer: http://stackoverflow.com/a/25298055
answer count: 2
accepted answer: http://stackoverflow.com/a/25298055
has title: Jersey: Checking for Not null request payload
tagged with: jersey
upvote count: 1
has answer: http://stackoverflow.com/a/57084085
possible better answer: http://stackoverflow.com/a/57084085
downvote count: 1
favorite count: 0
type: AnsweredQuestion
score: 0

jvm
tags question: http://stackoverflow.com/q/25310929
tag name: jvm
tags question: http://stackoverflow.com/q/25234112
tags question: http://stackoverflow.com/q/25387267
tags question: http://stackoverflow.com/q/25279741
type: Tag
tags question: http://stackoverflow.com/q/25242984
tags question: http://stackoverflow.com/q/25347564
tags question: http://stackoverflow.com/q/25241550
tags question: http://stackoverflow.com/q/25297022
tags question: http://stackoverflow.com/q/25250808
tags question: http://stackoverflow.com/q/25239301
tags question: http://stackoverflow.com/q/25234679
tags question: http://stackoverflow.com/q/25316058
tags question: http://stackoverflow.com/q/25309748
tags question: http://stackoverflow.com/q/25369708

http://stackoverflow.com/comment/39543056
comment on: http://stackoverflow.com/q/25360886
type: QuestionComment
score: 3
type: Comment
has text: you need to add the panels into the frame....

http://stackoverflow.com/comment/39571361
comment on: http://stackoverflow.com/q/25375408
has text: sorry I changed it to make sense and didnt change that. It should be levArray
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25252157
has comment: http://stackoverflow.com/comment/39343326
has comment: http://stackoverflow.com/comment/39344003
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39343512
tagged with: public
type: Question
has body: Hello StackOverFlow Community! I have an issue with a line of code in one of my android, java apps I am currently building. During the starting of the app, I run (amongst other code) the following code which creates a new instance of another class. It then runs a method inside of the class which sets up a number of different things inside of the app. As it is a large amount of processing, its in another thread to keep the app running at a good speed. The method cannot be static as it uses context. Whenever I create a new instance of the class that contains the thread (Longer_Tasks Set_Up_Reference = new Longer_Tasks()), it crashes. I am wondering how I can fix the code as I appear to have a run time error somewhere! new Thread(new Runnable() { public void run() { Longer_Tasks Set_Up_Reference = new Longer_Tasks(); Set_Up_Reference.Variable_Set_Up(); } }).start(); I have narrowed it down to this line via the debugger. I apologize for the lack of information, the following is the constructor: import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.security.SecureRandom; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; public class Longer_Tasks extends Activity { ... Other Functions and Procedures ... public void Variable_Set_Up() { Profile_Load_Data_From_File(); Profile_Load_Data_From_Server(); } .... Other Functions and Procedures ... } The following is the stack trace (I think): 08-11 22:10:08.347: D/WifiStateMachine(1018): handleMessage: E msg.what=131155 08-11 22:10:08.347: D/WifiStateMachine(1018): processMsg: ConnectedState 08-11 22:10:08.348: D/WifiStateMachine(1018)…
has title: Creating a New Instance causes a Crash in the Thread
tagged with: multithreading
has answer: http://stackoverflow.com/a/25253334
answer count: 1
accepted answer: http://stackoverflow.com/a/25253334
has comment: http://stackoverflow.com/comment/39343348
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25291066
has answer: http://stackoverflow.com/a/25291410
has comment: http://stackoverflow.com/comment/39415034
has comment: http://stackoverflow.com/comment/39414887
favorite count: 0
type: Question
upvote count: 4
has title: Trouble interpreting java stack trace
has comment: http://stackoverflow.com/comment/39414919
answer count: 1
has comment: http://stackoverflow.com/comment/39415107
downvote count: 1
has comment: http://stackoverflow.com/comment/39414981
has comment: http://stackoverflow.com/comment/39414724
type: AnsweredQuestion
score: 3
has body: I have a stack trace that I need some help interpreting: java.lang.ArrayIndexOutOfBoundsException: 36 &gt;= 36 at java.util.Vector.elementAt(Vector.java:427) at javax.swing.tree.VariableHeightLayoutCache.getNode(VariableHeightLayoutCache.java:976) at javax.swing.tree.VariableHeightLayoutCache.getPreferredHeight(VariableHeightLayoutCache.java:274) at javax.swing.plaf.basic.BasicTreeUI.updateCachedPreferredSize(BasicTreeUI.java:1823) at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1924) at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1912) at javax.swing.JComponent.getPreferredSize(JComponent.java:1642) at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769) at java.awt.Container.layout(Container.java:1420) at java.awt.Container.doLayout(Container.java:1409) at java.awt.Container.validateTree(Container.java:1506) at java.awt.Container.validate(Container.java:1479) at javax.swing.RepaintManager$2.run(RepaintManager.java:698) at javax.swing.RepaintManager$2.run(RepaintManager.java:696) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:695) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1679) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at java.awt.EventQueue.dispatchEvent(EventQueue.java:685) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pump…
accepted answer: http://stackoverflow.com/a/25291410
tagged with: java
tagged with: indexoutofboundsexception

http://stackoverflow.com/comment/39408644
comment on: http://stackoverflow.com/q/25287834
type: Comment
has text: What have you tried? Is this the only input you'll ever get? What should happen if the shape crosses over itself? This question is too broad for StackOverflow and will probably be closed.
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39536485
has text: Smells like odata ;)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25357240
type: Comment

http://stackoverflow.com/q/25348997
favorite count: 0
has comment: http://stackoverflow.com/comment/39521834
has comment: http://stackoverflow.com/comment/39529551
type: Question
has comment: http://stackoverflow.com/comment/39521426
has comment: http://stackoverflow.com/comment/39556831
has comment: http://stackoverflow.com/comment/39521474
has body: I encountered the following error when using the JBoss 8 Wildfly Server along with JDK 8 on a Windows 7 machine. After having a look at the source it was trying to create a FileOutputStream from "NUL:" similar to the following piece of code try { new FileOutputStream("NUL:").getChannel(); } catch (FileNotFoundException e) { e.printStackTrace(); } The above gives a FileNotFound exception When trying an echo in command prompt (following log) NULL only works C:\Users\Admin&gt;echo A &gt; NUL: The system cannot find the file specified. C:\Users\Admin&gt; C:\Users\Admin&gt;echo A &gt; NULL: C:\Users\Admin&gt; C:\Users\Admin&gt; When trying to executing the same "NUL:" on my Windows 8 laptop and given to a friend to execute it works. When having a look at the registry the following also appears http://technet.microsoft.com/library/Cc976138 It seems that it is a windows related issue? Does anyone know how to make "NUL:" work. Regards, Milinda
tagged with: windows
tagged with: java
tagged with: jboss
has title: NUL: does not work for windows but NULL: does
score: 2
answer count: 0
upvote count: 2
tagged with: null
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39521516
downvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/39521451
has comment: http://stackoverflow.com/comment/39529497
has comment: http://stackoverflow.com/comment/39522194

http://stackoverflow.com/q/25257055
has comment: http://stackoverflow.com/comment/39352477
accepted answer: http://stackoverflow.com/a/25257118
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25257118
has title: Crash code when i am using from a method of class?
has comment: http://stackoverflow.com/comment/39352412
has body: I have a MainActivity that connect to a webService for login that it work good but it get me crash when i am using from a method of Logins.Class: public class MainActivity extends Activity { EditText UserName; EditText PassWord; Button Login; String mUserName; String mPassWord; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); UserName = (EditText) findViewById(R.id.edtUserName); PassWord = (EditText) findViewById(R.id.edtPasswprd); Login = (Button) findViewById(R.id.btnLogin); Login.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mUserName = UserName.getText().toString().trim(); mPassWord = PassWord.getText().toString().trim(); if (mUserName.length() &gt; 0 &amp;&amp; mPassWord.length() &gt; 0) { Logins LG = new Logins().UsernameValue(mUserName) .PasswordValue(mPassWord).LOGINS(); ------&gt; Log.i("OK", LG.getWebresponse());&lt;--- Crash Here } else { Toast.makeText( G.context, G.context.getResources().getString( R.string.btn_LoginError), Toast.LENGTH_LONG) .show(); } } }); } } And i have a Logins.Class for login : public class Logins { private String UsernameValues; private String PasswordValues; String NAMESPACE = "http://tempuri.org/"; String METHOD_NAME = "Login"; String SOAP_ACTION = "http://tempuri.org/Login"; String URL = "http://test.com/MobileWebService/Related.asmx"; private String Webresponse; public Logins LOGINS() { Thread thread = new Thread(new Runnable() { //"xxssxx" //123456789 @Override public void run() { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("username", UsernameValues); request.addProperty("pass", PasswordValues); request.addProperty("device", "0"); request.addProperty("security", 128110); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setAddAdornments(false); envelope.implicitTypes = true; envelope.setOu…
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39352416
answer count: 1
has comment: http://stackoverflow.com/comment/39352379

http://stackoverflow.com/comment/39363009
type: Comment
type: QuestionComment
has text: Welcome to Stack Overflow, please take the [Tour](http://stackoverflow.com/tour). Please clarify your specific problem or add additional details to highlight exactly what you need. As currently written, its hard to tell exactly what you're asking. See [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask).
score: 0
comment on: http://stackoverflow.com/q/25263085

http://stackoverflow.com/comment/39587273
type: AnswerComment
has text: "Best collection for small number of key value pairs" -- Maybe you mean ArrayList<Pair<X, Y>> ? // "most 5 key value pairs in the collection"
type: Comment
comment on: http://stackoverflow.com/a/25384074
score: 2

spring-security-oauth2
tags question: http://stackoverflow.com/q/25354435
tag name: spring-security-oauth2
type: Tag
tags question: http://stackoverflow.com/q/25264358

jar
tags question: http://stackoverflow.com/q/25369490
tags question: http://stackoverflow.com/q/25338362
tags question: http://stackoverflow.com/q/25323286
tags question: http://stackoverflow.com/q/25335786
tags question: http://stackoverflow.com/q/25334714
tags question: http://stackoverflow.com/q/25271271
tag name: jar
tags question: http://stackoverflow.com/q/25314503
tags question: http://stackoverflow.com/q/25317650
tags question: http://stackoverflow.com/q/25336464
tags question: http://stackoverflow.com/q/25274949
tags question: http://stackoverflow.com/q/25232367
tags question: http://stackoverflow.com/q/25307667
tags question: http://stackoverflow.com/q/25378933
tags question: http://stackoverflow.com/q/25235060
tags question: http://stackoverflow.com/q/25230954
tags question: http://stackoverflow.com/q/25312590
tags question: http://stackoverflow.com/q/25355241
tags question: http://stackoverflow.com/q/25303451
tags question: http://stackoverflow.com/q/25287486
tags question: http://stackoverflow.com/q/25297876
tags question: http://stackoverflow.com/q/25294533
tags question: http://stackoverflow.com/q/25302486
tags question: http://stackoverflow.com/q/25328847
tags question: http://stackoverflow.com/q/25252614
tags question: http://stackoverflow.com/q/25375104
tags question: http://stackoverflow.com/q/25245907
tags question: http://stackoverflow.com/q/25321026
tags question: http://stackoverflow.com/q/25370121
tags question: http://stackoverflow.com/q/25349000
tags question: http://stackoverflow.com/q/25305883
type: Tag
tags question: http://stackoverflow.com/q/25379560
tags question: http://stackoverflow.com/q/25309250
tags question: http://stackoverflow.com/q/25292666
tags question: http://stackoverflow.com/q/25258144
tags question: http://stackoverflow.com/q/25329175
tags question: http://stackoverflow.com/q/25302157
tags question: http://stackoverflow.com/q/25275850
tags question: http://stackoverflow.com/q/25319366
tags question: http://stackoverflow.com/q/25298031
tags question: http://stackoverflow.com/q/25362943
tags question: http://stackoverflow.com/q/25257513
tags question: http://stackoverflow.com/q/25307949
tags question: http://stackoverflow.com/q/25254817
tags question: http://stackoverflow.com/q/25358157
tags question: http://stackoverflow.com/q/25238426
tags question: http://stackoverflow.com/q/25230408
tags question: http://stackoverflow.com/q/25288128

rebuild
type: Tag
tags question: http://stackoverflow.com/q/25380969
tag name: rebuild

http://stackoverflow.com/q/25350621
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
type: Question
has body: This is how my java main class looks like public class Main { public static void main(String[] args) throws Exception { XmlParser b = new XmlParser(); ServiceController sl = new ServiceController(); Pipeline2 objPipeline2 = new Pipeline2(); objPipeline2.main(args); b.parseXML(); sl.callServiceByDomain(); } public void function1() throws Exception { System.out.println("hello"); } Here is the run.jsp file where i want to run the main function <%@ page import="java.io.*" %> <%@ page import="main.Main" %> <TITLE>Enter Email over here <jsp:useBean id="link" scope="application" class = "main.Main" /> <%Main r=new Main(); Main.main(null);%> I am not able to run it if i am running the run.jsp file where as if i am trying to run the function1 from the jsp in place of main....it is running. please help me in this regard
has answer: http://stackoverflow.com/a/25350639
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: javascript
tagged with: swing
has title: Run a java main class from JSP
score: 3

http://stackoverflow.com/comment/39423493
score: 0
type: Comment
has text: @adavis The buttons are working great. Also I'm getting an error with `public void run(String what) {`: `Error:(125, 55) error: <anonymous net.k40s.metronome.MainActivity$1> is not abstract and does not override abstract method run() in Runnable`. When I remove the `String what` it compiles without error but the app crashes after playing the click once since I put the `mp=MediaPlayer.create()` into onCreate.
type: QuestionComment
comment on: http://stackoverflow.com/q/25293653

http://stackoverflow.com/q/25335269
has comment: http://stackoverflow.com/comment/39497987
has comment: http://stackoverflow.com/comment/39498324
has title: compile-time error: illegal Character: \8279
has comment: http://stackoverflow.com/comment/39498037
possible better answer: http://stackoverflow.com/a/25335321
has comment: http://stackoverflow.com/comment/39497989
has answer: http://stackoverflow.com/a/25335348
has comment: http://stackoverflow.com/comment/39498273
tagged with: servlets
has answer: http://stackoverflow.com/a/25335321
has body: When I try to compile my servlet I get folowing exception: illegal character: \8279 And it's pointing to &amp; msg.setContent("&lt;a href=\"" + server + ":8080/myApp/ResetPasswordPage.jsp?randNum=" + randNum + ‌​ "&amp;practiceName=" + practiceName+"\" Click Here &lt;/a&gt;", "text/html" ); I can't find a whole lot on the net about it...
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39498105
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25335348
type: Question
tagged with: exception

http://stackoverflow.com/a/25312429
has comment: http://stackoverflow.com/comment/39456762
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39459200
has comment: http://stackoverflow.com/comment/39454943
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25298969
has body: There are a few use cases where a JAXBElement is required to be able to round trip XML as defined in the XML Schema. If you are seeing alot of JAXBElement in your generated model then several of these conditions are probably true. An element is both nillable="true" and minOccurs="0". In this case what does null on the mapped field/property mean? When the property is JAXBElement a null value means the element isn't present and a JAXBElement wrapping null means an XML element with xsi:nil="true". There are 2 global elements with the same named complex type. Since in JAXB classes correspond to complex types a way is needed to capture which root element was encountered. http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html There is a choice structure where either foo or bar elements can occur and they are the same type. Here a JAXBElement is required because simply encountering a String value isn't enough to indicate which element should be marshalled. An element with xsi:nil is encountered in the document that contains attributes. In this example the object corresponding to that element can still be unmarshalled to hold the attribute values, but JAXBElement can stil indicate that the element was null. Mechanisms to Reduce the Number of JAXBElement in the Model Binding file with generateElementProperty set to false. <?xml version="1.0" encoding="UTF-8"?> <generateElementProperty>false</generateElementProperty> Simple plugin for XJC - https://jaxb.java.net/2.1.2/docs/vendorCustomizations.html#simple <?xml version="1.0" encoding="UTF-8"?> <xjc:simple />

http://stackoverflow.com/comment/39566720
type: Comment
comment on: http://stackoverflow.com/a/25372559
type: AnswerComment
score: 0
has text: exactly, but if I have double input=keyboard.nextDouble(); then the program wont run correctly, no matter if I actually input a integer or not. if I have int input=keyboard.nextInt(); then it runs correctly, the only progrem is that it doesnt work if I input 1234.26 cuz its double, but if I input 1234, its correct. so im pretty sure I have to have input as int, just as you said in 3) to get it right

http://stackoverflow.com/a/25365792
accepted answer of: http://stackoverflow.com/q/25365033
type: Answer
score: 0
type: AcceptedAnswer
has body: I would highly recommend using the Fused location provider with PRIORITY_BALANCED_POWER_ACCURACY: LocationRequest request = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY) .setInterval(POLLING_INTERVAL) .setFastestInterval(POLLING_INTERVAL/2) .setSmallestDisplacement(MIN_INTERVAL_METERS); It is designed to provide you with a in a 40 meter range accuracy with battery consumption &lt;= 0.6%/hour. Also remember to turn location listening off immediately when no longer needed.
answers question: http://stackoverflow.com/q/25365033

http://stackoverflow.com/comment/44094336
has text: Could you explain why compile time can't help here? Do you mean that you want to create war only once and run it on all environments with -Denvironment=xxx property instead of building different war files for each environment?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25232252
score: 0

http://stackoverflow.com/comment/39395613
score: 0
comment on: http://stackoverflow.com/q/25266907
has text: At first just monitor it. Then I could of course lateron implement a logging.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25334873
downvote count: 0
score: 4
has title: Facebook Login not working properly (Parse)
has comment: http://stackoverflow.com/comment/39527318
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25352364
accepted answer: http://stackoverflow.com/a/25352364
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: parse-platform
has body: In my app, I have an activity that handles the Facebook sign in and sign up. When I click my "Sign in with Facebook" button, I execute this code, as written the Parse docs: ParseFacebookUtils.logIn(this, new LogInCallback() { @Override public void done(ParseUser user, ParseException err) { if (user == null) { Log.d(APPTAG, "Uh oh. The user cancelled the Facebook login."); } else if (user.isNew()) { Log.d(APPTAG, "User signed up and logged in through Facebook!"); } else { Log.d(APPTAG, "User logged in through Facebook!"); } } }); This is supposed to handle new and existing users. I also have this method in my activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); ParseFacebookUtils.finishAuthentication(requestCode, resultCode, data); } In my Application class, I set up Parse and ParseFacebookUtils properly: Parse.initialize(this, getString(R.string.parse_app_id), getString(R.string.parse_client_key)); ParseFacebookUtils.initialize(getString(R.string.facebook_app_id)); I also have the Facebook App installed on my device. The problem I have is that when I call ParseFacebookUtils.logIn(), it always returns a ParseUser that's not new or null, but that is effectivly empty. It has no objectId, createdAt, updatedAt, etc. The ParseException also is always null. I'm also not sure why the ParseUser in the done callback has a false value for user.isNew() because there aren't any users in my _User table. Usually, the Facebook sign in should create a new ParseUser if one doesn't already exist. I've tried uninstalling and re-installing my app but that didn't work. Even If I clear every table, in the Data Browser, clear my cache, and get a completely fresh install of my app, It never shows that the user is new. I found a similar post on the Parse help forum, but there were no answers. In my AndroidManifest, I have this: &lt;activity android:name="com.facebook.LoginActivity" android:l…
tagged with: android
tagged with: facebook

http://stackoverflow.com/a/25381917
has body: it's possible to tell jackson to don't set to null values that are not in json request (json A) during deserialization? No, it is not possible. Indeed, what you are asking doesn't make any sense. When you create a PostServerActionsRequest, by deserializing from JSON, or by any other means, each of the fields in the PostServerActionsRequest instance has to have a value. It is simply meaningless to talk about a field of a Java object as having "no value" ... in the sense you are talking about. For fields that are reference typed, the value has to be either a reference to some object ... or null. There are simply no alternatives.
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25381791
type: Answer
answers question: http://stackoverflow.com/q/25381791

http://stackoverflow.com/q/25253758
answer count: 3
tagged with: package
tagged with: interface
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/25253814
has answer: http://stackoverflow.com/a/25254144
possible better answer: http://stackoverflow.com/a/25254144
has answer: http://stackoverflow.com/a/25253900
type: AnsweredQuestion
tagged with: inner-classes
has comment: http://stackoverflow.com/comment/39348525
upvote count: 7
downvote count: 0
has body: Actually, I am trying to finish this practice in "Think in Java" for self-learning purpose -- Exercise 6: (2) Create an interface with at least one method, in its own package. Create a class in a separate package. Add a protected inner class that implements the interface. In a third package, inherit from your class and, inside a method, return an object of the protected inner class, upcasting to the interface during the return. so I created a class named IgetResult.java under directory "a" which has a IIGetResult Interface. interface IIGetResult { String getResult(); } public class IgetResult { } then I create another class in another directory -- directory b import a.IgetResult.IIGetResult; public class PracticeClass { protected class inner implements IIGetResult { @Override String getResult(){ return "result";} } public static void main(String[] args) { System.out.println("practice start"); } } In the final step, I compile the two java classes with command: # javac a/.java b/.java and get the following error: ./a/IgetResult.java:1: duplicate class: IIGetResult interface IIGetResult { ^ ./a/IgetResult.java:4: duplicate class: IgetResult public class IgetResult { ^ b/PracticeClass.java:1: cannot access a.IgetResult bad class file: ./a/IgetResult.java file does not contain class a.IgetResult Please remove or make sure it appears in the correct subdirectory of the classpath. import a.IgetResult.IIGetResult; ^ Please teach me go through this practice, thanks in advance.
has title: import class in different directory
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25253900

http://stackoverflow.com/comment/39383518
comment on: http://stackoverflow.com/q/25273914
type: Comment
has text: Please clarify your question with some code. If the method is abstract in the super class you can just invoke it in your classes and rely on the fact that there must be a concrete implementation for someone to have passed you that instance.
score: 1
type: QuestionComment

http://stackoverflow.com/q/25269907
has answer: http://stackoverflow.com/a/25269937
has comment: http://stackoverflow.com/comment/39375855
has body: Hi im new in java and tried to make this piece of code to work but i can't concatenate the variables public class peces { public static void main(String args[]){ String raza = "Barracuda"; String alimento = "otros peces"; int peso = "20"; System.out.println ("El Peso de la" +raza "es de " +peso "kg y se alimenta de " +alimeto); } }
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/39375829
tagged with: concatenation
downvote count: 5
answer count: 1
accepted answer: http://stackoverflow.com/a/25269937
has comment: http://stackoverflow.com/comment/39375827
linked to: http://stackoverflow.com/q/3753869
favorite count: 0
type: AnsweredQuestion
has title: Concatenate multiple variables in java
score: -5
tagged with: java

http://stackoverflow.com/a/25368059
type: Answer
answers question: http://stackoverflow.com/q/25364474
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25364474
has body: You have never called createDataBase() method! You can put it into onCreate() method. Good luck

http://stackoverflow.com/q/25366639
has comment: http://stackoverflow.com/comment/39554006
has comment: http://stackoverflow.com/comment/39554672
tagged with: eclipse
has title: Eclipse: Java application size
has body: So i made it finally to the final stage of my simple java app that runs under windows and is used to get the user name and log it in an remote excel file. up until now everything is ok. When i Externelize (does that word exist?) the app to make it a runnable jar the size of the app was 22Mo! wich is huge since i want to use it in an email (outlook). Here come the question (finally). Can i delete any of the default java jars in the classpath and the app will still run ?? if yes, which ones?? NB: i tried including the imports in the SS if it does help NB2: the Jar of the app it self is just 20Ko , the ressources are around 22Mo . By the way thank you all for helping me make this app it was thanks to this website eventhought i didn't ask any question up until now you'll still answered them all..You rock ! Those are my imports: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.wb.swt.SWTResourceManager; EDIT: So after the discussions i managed to reduce the size of the app to 8Mo by deleting some of the jar in the referenced library (org.ibm.icu.jar). The app still runs perfectly without it
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25366745
answer count: 1
has answer: http://stackoverflow.com/a/25366745
type: Question

http://stackoverflow.com/q/25299479
favorite count: 0
type: Question
score: 9
answer count: 1
downvote count: 0
has body: With String.format %d and its variants, we can easily format primitive integers and longs. However, does these formatting options work perfectly with BigInteger? I've made some tests, and they seem to work well, for example: public class Test6 { public static void main(final String args[]) { final java.math.BigInteger b = java.math.BigInteger.TEN.pow(999999); System.out.println(String.format("%,d", b)); } } But are there any gotchas to watch out for?
tagged with: string.format
type: AnsweredQuestion
has title: Is String.format %d always compatible with BigInteger?
upvote count: 9
tagged with: biginteger
tagged with: java
has answer: http://stackoverflow.com/a/25299548
accepted answer: http://stackoverflow.com/a/25299548

http://stackoverflow.com/comment/39547680
type: Comment
type: QuestionComment
has text: It should not add the element, are you sure you're not adding elements elsewhere?
score: 0
comment on: http://stackoverflow.com/q/25363408

http://stackoverflow.com/a/25309657
downvote count: 0
type: Answer
upvote count: 1
has body: I'm not a hardcore user of swing but having worked with it last couple of months I would suggest using MIGLayout. It is very versatile and allows you to make layouts very easy. It takes a little time to learn, but it will make many layout problems very easy, e g forms. Your problem could be solved like this with MIGLayout: JScrollPane sp = new JScrollPane(); JPanel panel = new JPanel(); panel.setLayout(new MigLayout("gap rel 0", "grow")); Panels can then be added like this: panel.add(new JPanel(), "wrap");
answers question: http://stackoverflow.com/q/25304941
score: 1

http://stackoverflow.com/comment/39449092
has text: I am afraid there isn't currently a way to do that, but you can ask this feature in the eclipse community
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25309498
score: 0

http://stackoverflow.com/comment/39655920
comment on: http://stackoverflow.com/a/25378411
score: 0
has text: How can i access to non-static methods with this case?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25383917
accepted answer of: http://stackoverflow.com/q/25379122
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25379122
has body: You will need to encode in the WebSocketFrame some "marker" that can be used to detect to which frame the text goes. For example you could use Json or something like this
has comment: http://stackoverflow.com/comment/39881122
type: Answer
score: 0

http://stackoverflow.com/a/25378157
type: Answer
has comment: http://stackoverflow.com/comment/39576149
score: 0
has body: I was struggling with this yesterday for most of the day. The problem seemed to have been a broken base image supplied by the official CentOS repo. If you look on your base image you will notice that /opt/java exists on the base image. That's the clue that you have the broken image. Simply pull the latest image with "docker pull centos" and you'll be back in action. They must have fixed it sometime last night. You'll notice the hash of the image has changed even though it shows that the image was uploaded 2 weeks ago. Someone is trying to hide their tracks! Haha. Your Dockerfile is fine. Regards Wynand
answers question: http://stackoverflow.com/q/25377131

keystroke
type: Tag
tag name: keystroke
tags question: http://stackoverflow.com/q/25266279

http://stackoverflow.com/a/25327394
type: Answer
has body: You were part-way there with the ComponentListener. In the componentResized(...) method you need to adjust the location of the JInternalFrame. Keep in mind, if the user moves the JInternalFrame on the desktop, it will get repositioned automatically if the JFrame is resized. This may not be desirable. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JInternalFrameDemo implements Runnable { private JInternalFrame iFrame; private JDesktopPane desktop; public static void main(String[] args) { SwingUtilities.invokeLater(new JInternalFrameDemo()); } public void run() { desktop = new JDesktopPane(); desktop.setOpaque(true); desktop.addComponentListener(new ComponentListener() { public void componentResized(ComponentEvent e) { adjustInternalFrameLocation(); } public void componentMoved(ComponentEvent e) {} public void componentShown(ComponentEvent e) {} public void componentHidden(ComponentEvent e) {} }); JFrame frame = new JFrame("Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setContentPane(desktop); frame.setVisible(true); iFrame = new JInternalFrame("Centered InternalFrame"); iFrame.setSize(200, 150); iFrame.setVisible(true); desktop.add(iFrame); adjustInternalFrameLocation(); } private void adjustInternalFrameLocation() { Dimension desktopDim = desktop.getSize(); Dimension iFrameDim = iFrame.getSize(); int x = (desktopDim.width - iFrameDim.width) / 2; int y = (desktopDim.height - iFrameDim.height) / 2; iFrame.setLocation(x, y); } }
score: 0
answers question: http://stackoverflow.com/q/25326343

parsing
tags question: http://stackoverflow.com/q/25275248
tags question: http://stackoverflow.com/q/25307743
tags question: http://stackoverflow.com/q/25306085
tags question: http://stackoverflow.com/q/25285572
tags question: http://stackoverflow.com/q/25276074
tags question: http://stackoverflow.com/q/25345620
tags question: http://stackoverflow.com/q/25282581
tags question: http://stackoverflow.com/q/25340834
tags question: http://stackoverflow.com/q/25377521
tag name: parsing
tags question: http://stackoverflow.com/q/25260456
tags question: http://stackoverflow.com/q/25365255
tags question: http://stackoverflow.com/q/25261659
tags question: http://stackoverflow.com/q/25365598
tags question: http://stackoverflow.com/q/25278216
tags question: http://stackoverflow.com/q/25349803
tags question: http://stackoverflow.com/q/25276477
tags question: http://stackoverflow.com/q/25360231
tags question: http://stackoverflow.com/q/25230297
tags question: http://stackoverflow.com/q/25326176
tags question: http://stackoverflow.com/q/25309979
tags question: http://stackoverflow.com/q/25382162
type: Tag

http://stackoverflow.com/comment/39306933
type: Comment
comment on: http://stackoverflow.com/q/25233072
type: QuestionComment
score: 0
has text: I don't think `UNIXProcess` is part of the API?

http://stackoverflow.com/comment/39329731
comment on: http://stackoverflow.com/q/25244091
type: Comment
type: QuestionComment
has text: @icza All the fields that I want are annotated. Name, PropertyA1 and PropertyB1. I don't need the other ones. It is why I'm using @XmlAccessorType(XmlAccessType.NONE).
score: 0

http://stackoverflow.com/a/58084985
answers question: http://stackoverflow.com/q/25352764
has body: This issue occurred in my case because there are two hateoas jars one has the resource interface and other has the implementaion with same groupId and arifactId. To Resolve this issue --> Downgrade your STS if you're using 4.* to 3.* Add the below dependency if you're using spring boot org.springframework.boot spring-boot-autoconfigure org.springframework.boot spring-boot-starter-hateoas After adding this dependency run below commands in the command prompt where you're pom.xml is present mvn clean install package mvn eclipse:eclipse This steps resolved issue for me.
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/102564698
type: Answer

http://stackoverflow.com/q/25246078
tagged with: jsp
has comment: http://stackoverflow.com/comment/39393361
has body: I'm running a Google App Engine with Endpoints. Everything works fine. Now I would like to add some JSP's for admin purposes. So, following the docs, I added a JSP in /war/. Works, too. But I don't have any syntax highlighting (Eclipse) and when there's a code error, I get the following compilation error. But without syntax highlighting, it's no easy to locate the error. Any idea? Failed to compile the generated JSP java files
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39366309
has title: Java Server Pages and Google App Engine
has comment: http://stackoverflow.com/comment/39371397
tagged with: google-app-engine
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/25268010
has comment: http://stackoverflow.com/comment/39406663
has answer: http://stackoverflow.com/a/25268010
has comment: http://stackoverflow.com/comment/39336708
has comment: http://stackoverflow.com/comment/39365343
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/12324201
score: -3

http://stackoverflow.com/comment/39481983
comment on: http://stackoverflow.com/a/25327079
type: Comment
score: 0
type: AnswerComment
has text: Thank you for the answer. Out of curiosity, does C++ work similarly, or are they different in this regard?

http://stackoverflow.com/comment/95858461
comment on: http://stackoverflow.com/a/54528299
type: Comment
has text: `A[0] == 1` part seems unnecesary
score: 0
type: AnswerComment

http://stackoverflow.com/q/25260469
tagged with: apache-tiles
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39358169
has answer: http://stackoverflow.com/a/26491850
accepted answer: http://stackoverflow.com/a/25962840
tagged with: spring-4
answer count: 3
has answer: http://stackoverflow.com/a/25962840
tagged with: java
has body: I am using Spring framework version 4 and I get confused which folder to put the XML files, specially the tile definitions and where to find the resolver bean.
downvote count: 0
favorite count: 0
type: Question
has title: How to integrate Spring 4 with Apache Tiles 3?
has answer: http://stackoverflow.com/a/31210234
tagged with: tiles-3
tagged with: spring
score: 4
possible better answer: http://stackoverflow.com/a/26491850

http://stackoverflow.com/q/25375979
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/7161638
has body: I have a Java class like this and want to convert to JSON using Jackson. Thanks for your help. Java Class public class myClass { String Id; Map&lt;String, Object&gt; optionalData = new LinkedHashMap&lt;String, Object&gt;(); } How to serialization it to JSON using Jackson ObjectMapper ? For example, suppose the optionalData is a Map saving two entries &lt;"type", "book"&gt; and &lt;"year", "2014"&gt; I want the output to be as follow. Please note that the key/value of optionalData could be changed on the fly (so, I cannot create a "static" Java object for this without using Map) [ { id: "book-id1", type: "book", year: "2014" }, { id: "book-id2", type: "book", year: "2013" } ]
upvote count: 6
linked to: http://stackoverflow.com/q/11038553
type: Question
answer count: 2
has title: jackson serialization for Java object with Map?
type: UnansweredQuestion
downvote count: 0
score: 6
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/25377574
has comment: http://stackoverflow.com/comment/39572459
has answer: http://stackoverflow.com/a/25376193

http://stackoverflow.com/comment/39429382
comment on: http://stackoverflow.com/q/25298524
type: QuestionComment
has text: Also this is unrelated to answering the question, but consider storing your dates as an epoch time (depends on what else you are doing with these dates). This makes comparisons easy, and makes the code easy to read.
type: Comment
score: 0

http://stackoverflow.com/comment/39511701
comment on: http://stackoverflow.com/a/25342424
type: Comment
has text: ok, but if I want to implement InputAdapter in other class in the key pressed events I have to change the texture of the player.From where I take the object player. I do not know if I explained well
score: 0
type: AnswerComment

http://stackoverflow.com/q/25378435
has answer: http://stackoverflow.com/a/25378762
downvote count: 1
has title: Why my LinkedList is filled with the same object?
has answer: http://stackoverflow.com/a/25378487
has comment: http://stackoverflow.com/comment/39576706
has body: I've been trying to fill in a LinkedList. I've written the following code: List&lt;Item&gt; lst = new LinkedList&lt;Item&gt;(); Item item = new Item(); for(ListItem it : getAllItems()){ item.setDate(it.getDate); //Setting up it's property to item lst.add(item); } But after the code above is executed we have lst contains a List of the same element, which has been added at the last executing of foreach body. I'm expected that we have a List of elements which has been set up at any executing of the foreach body.
type: AnsweredQuestion
tagged with: java
answer count: 3
score: 1
possible better answer: http://stackoverflow.com/a/25378482
accepted answer: http://stackoverflow.com/a/25378487
favorite count: 0
has answer: http://stackoverflow.com/a/25378482
tagged with: linked-list
type: Question
upvote count: 2

http://stackoverflow.com/q/25293546
has comment: http://stackoverflow.com/comment/39420304
score: 0
tagged with: java
answer count: 1
type: Question
has body: When I change fragment page recreate view in instantiateItem. How can I avoid this? public class ContactPagerAdapter extends PagerAdapter implements IconTabProvider { @Override public Object instantiateItem(ViewGroup container, int position) { View view =null; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.show_content,null); container.addView(view, 0); return view; } }
type: UnansweredQuestion
tagged with: android
tagged with: fragmentpageradapter
has title: Avoid recreating same view when fragment pager changed
has answer: http://stackoverflow.com/a/25294501
tagged with: android-fragments

http://stackoverflow.com/comment/39432533
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25300335
score: 0
has text: You need to refer to Oracle Docs first. Refer - [Create Packages](http://docs.oracle.com/javase/tutorial/java/package/packages.html) and [Use Packages](http://docs.oracle.com/javase/tutorial/java/package/usepkgs.html).

http://stackoverflow.com/comment/39519181
type: AnswerComment
has text: Thanks. I implemented this option and it works ok. However the code looks a bit messy now due to other limitations in having to rely on the ListenableFuture carrying all the context.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25323446

http://stackoverflow.com/comment/39438431
score: 0
type: AnswerComment
has text: Nope. Not via standard library. Except if you only have one method with the specified name, you'll know for sure it's that.
comment on: http://stackoverflow.com/a/25303429
type: Comment

http://stackoverflow.com/a/25312762
accepted answer of: http://stackoverflow.com/q/25312296
type: Answer
has comment: http://stackoverflow.com/comment/68878415
score: 4
answers question: http://stackoverflow.com/q/25312296
has body: Remove thread and try
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/68912221

http://stackoverflow.com/comment/39518487
comment on: http://stackoverflow.com/q/25343025
type: Comment
type: QuestionComment
has text: @EJP Yes, I mentioned in my question "both work fine on my computer"
score: 0

http://stackoverflow.com/comment/39313057
type: QuestionComment
comment on: http://stackoverflow.com/q/25236044
type: Comment
score: 1
has text: @Feek: No, so it gets one without arguments automatically.

http://stackoverflow.com/comment/39356398
comment on: http://stackoverflow.com/a/25247418
type: Comment
score: 0
type: AnswerComment
has text: last collector makes an error : `Collectors.mapping(Entry::getValue, Collectors.toList()` [link](http://speedy.sh/2qtFC/Bez-tytulu.png")

http://stackoverflow.com/comment/39434959
type: Comment
comment on: http://stackoverflow.com/a/25301635
type: AnswerComment
score: 0
has text: I'm talking about changing type in java class, see my update of my answer above

http://stackoverflow.com/comment/39515623
has text: My guess is the error is elsewhere, is that all the code generating the error? Your code reads from standard input each line and writes to the standard output, so effectively it will read the same output it generated. Don't think that's what you really want.
score: 0
comment on: http://stackoverflow.com/q/25343025
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39324966
comment on: http://stackoverflow.com/a/25241592
score: 0
type: Comment
type: AnswerComment
has text: @user3929251 read this [wiki article](http://en.wikipedia.org/wiki/Modulo_operation)

http://stackoverflow.com/q/25241019
linked to: http://stackoverflow.com/q/630453
has answer: http://stackoverflow.com/a/25241394
favorite count: 0
has comment: http://stackoverflow.com/comment/39321885
type: Question
has comment: http://stackoverflow.com/comment/39322220
tagged with: rest
has title: Restful API post hierarchical/nested data to webservice
has body: Hi I am trying to replace php-java-bridge with restful API, in older application EJBs were accessed by PHP using php-java-bridge Using this bridging mechanism I was able to send complex Objects from PHP to Java. Now as we have replaced the bridge with Restful API now instead of object we have to send each individual param. Let say I have a User class consist of id, name and favouriteLinks favrouteLinks is an array of Type Link consist of title and url. class User { Integer id; String name; Link[] favouriteLinks; } class Link { String title; String url; } Let say API is trying to save a user with multiple favourite links detail. Now as you have noticed that this is a nested/hierarchical information that need to be passed. What is the correct way to achieve this? api.something.com/1/user?id=101&amp;name=Jon&amp;favourite???? What if I have an array of users that have an array of favourite links???? Please share your expert thoughts.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39322574
tagged with: php
has comment: http://stackoverflow.com/comment/39324183
score: 2
upvote count: 2
tagged with: java
tagged with: php-java-bridge
answer count: 1
downvote count: 0
tagged with: web-services

http://stackoverflow.com/a/25481697
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25365532
has body: I have installed WildFly 8.1 and added the module under: &lt;wildfly-root&gt;\modules\org\firebirdsql\main\ module.xml jaybird-2.2.5.jar Note that this doesn't match the location used in the tutorial you link to. The tutorial - incorrectly - roots user modules in modules\system\layers\base instead of modules\, but when I place the module there it works as well. My module.xml definition has content: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;module xmlns="urn:jboss:module:1.0" name="org.firebirdsql"&gt; &lt;resources&gt; &lt;resource-root path="jaybird-2.2.5.jar"/&gt; &lt;/resources&gt; &lt;dependencies&gt; &lt;module name="javax.api"/&gt; &lt;module name="javax.transaction.api"/&gt; &lt;module name="javax.resource.api"/&gt; &lt;/dependencies&gt; &lt;/module&gt; I added the driver entry to standalone.xml exactly as you posted. And then added a datasource in the management console, and tested the connection. This works. My earlier theory in the comments that it isn't working for you due to the Web Profile not including Resource Connectors seems to be wrong. I have also tested using a Java 8 version of Jaybird when WildFly is running on Java 7, but this gives an UnsupportedClassVersionError as expected. The only way I have been able get the error in your question is to intentionally misplace the module (eg deleting it entirely, having a spelling error in the folder names, or putting it in the wrong location). I would suggest that you carefully check your module location (see above). See the answer by asohun for the solution to your specific problem. I will leave this answer in place as it contains the correct config and an alternative failure mode that produces the same error.
score: 1

http://stackoverflow.com/comment/67525565
type: Comment
type: QuestionComment
has text: think i was using the amqptemplate in SpringAMQP
comment on: http://stackoverflow.com/q/25260223
score: 0

http://stackoverflow.com/a/25329431
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/39487390
has comment: http://stackoverflow.com/comment/39486597
upvote count: 10
accepted answer of: http://stackoverflow.com/q/25329340
has comment: http://stackoverflow.com/comment/39497059
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39486906
downvote count: 0
has comment: http://stackoverflow.com/comment/39486760
has comment: http://stackoverflow.com/comment/39486953
has body: One reason that you may want to leave a setter non-final is to let subclasses make their own, stricter, argument checks: public class Subclass extends Superclass { public void setX(int x) { if(x &gt;= 0) throw new IllegalArgumentException("X must be negative"); super.setX(x); } } Of course this breaks Liskov Substitution Principle, because a subclass strengthens a precondition in a subtype.
has comment: http://stackoverflow.com/comment/39486998
answers question: http://stackoverflow.com/q/25329340

http://stackoverflow.com/q/25272803
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39381310
score: 0
has comment: http://stackoverflow.com/comment/39396583
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39411148
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39419180
has comment: http://stackoverflow.com/comment/39404107
has comment: http://stackoverflow.com/comment/39382195
type: Question
has comment: http://stackoverflow.com/comment/39382620
has comment: http://stackoverflow.com/comment/39382785
accepted answer: http://stackoverflow.com/a/25301518
has comment: http://stackoverflow.com/comment/39381669
answer count: 2
has comment: http://stackoverflow.com/comment/39381722
has answer: http://stackoverflow.com/a/25301518
has title: error in logcat fail3: java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/39383267
has comment: http://stackoverflow.com/comment/39381322
has body: I am creating a page in Android that gets ID &amp; Name and then inserts it to my database but I get this error in logcat. error in logcat is: pass 1(854): connection success pass2(854): connection success fail 3(854): java.lang.NullPointerException my code is: public class Sampleactivity extends Activity { String name; String id; InputStream is=null; String result=null; String line=null; int code; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mainprogram); final EditText e_id=(EditText) findViewById(R.id.editText1); final EditText e_name=(EditText) findViewById(R.id.editText2); Button insert=(Button) findViewById(R.id.button1); insert.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub id=e_id.getText().toString(); name=e_name.getText().toString(); insert(); } }); } public void insert() { ArrayList&lt;NameValuePair&gt; nameValuePairs=new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("id", id)); nameValuePairs.add(new BasicNameValuePair("name", name)); try{ HttpClient httpclient=new DefaultHttpClient(); HttpPost httppost=new HttpPost("http://10.0.2.2/insert.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response=httpclient.execute(httppost); HttpEntity entity=response.getEntity(); is=entity.getContent(); Log.e("pass 1","connection success"); } catch(Exception e) { Log.e("fail 1",e.toString()); Toast.makeText(getApplicationContext(), "invalid ip address",Toast.LENGTH_LONG).show(); } try { BufferedReader reader=new BufferedReader (new InputStreamReader(is, "iso-8859-1"),8); StringBuilder sb=new StringBuilder(); while((line=reader.readLine())!=null) { sb.append(line + "\n"); } is.close(); String result=sb.toString(); Log.e("pass2","connection success"); } catch(Exception e) { Log.e("fail2",e.toString()); } try { JSONParser parser_obj=new JSONParser(); J…
possible better answer: http://stackoverflow.com/a/25273084
has answer: http://stackoverflow.com/a/25273084

http://stackoverflow.com/a/25342612
type: AcceptedAnswer
upvote count: 2
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25337855
score: 2
answers question: http://stackoverflow.com/q/25337855
has body: Basically it means file data is seeked twice, once during the split creation &amp; once during read from the mapper tasks. Yes. The purpose of this InputFormat is to create a split for every N-lines. The only way to compute the split boundaries is to read this file and find the new line characters. This operation can be costly, but you cannot avoid it if this is what you need. If this is a bottleneck how does hadoop job overrides this? Not sure to understand the question. NLineInputFormat is not the default InputFormat and very few use cases require it. If you read the javadoc of the class you will see that this class mainly exists to feed the parameters to embarrassingly parallel jobs (= "small" input files). Most of the InputFormat do no need to read the file to compute the splits. They usually use hard rules like a split should be 128MB or one split for each HDFS block and the RecordReaders will take care of the real start/end-of-split offset. If the cost of NLineInputFormat.getSplitsForFile is an issue I would really review why I need to use this InputFormat. What you want to do is to limit the batch size of a business process in your mapper. With NLineInputFormat a mapper is created for every N lines, it means that a mapper will never do more than one bulk transaction. You don't seems to need this feature, you only want to limit the size of a bulk transaction but don't care if a mapper does several of them sequentially. So you are paying the cost of the code you spotted for nothing in return. I would use TextInputFormat and create the batch in the mapper. In pseudo code: setup() { buffer = new Buffer&lt;String&gt;(1_000_000); } map(LongWritable key, Text value) { buffer.append(value.toString()) if (buffer.isFull()) { new Transaction(buffer).doIt() buffer.clear() } } cleanup() { new Transaction(buffer).doIt() buffer.clear() } By default a mapper is created per HDFS block. If you think this is too much or little, mapred.(max|min).split.size variables allow to inc…

freeze
tags question: http://stackoverflow.com/q/25367402
type: Tag
tag name: freeze

http://stackoverflow.com/q/25335715
has body: I am trying to customize the default listview in the XML. In particular, I am trying to do the following: Center the item in the list where android:gravity="center" simply does not work Change the font color of the item of the list (android:textColor="#ffffff" simply does not work Below is my listView &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/userlistview" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bac_blue" android:textColor="#ffffff" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; Below is the line of code that refers to the layout usersListView = (ListView)getActivity().findViewById(R.id.userlistview); Kindly advise. All the best Update Activity code public class Fragment1 extends Fragment { private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ListView usersListView; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setConversationsList(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment1_layout, container, false); r…
has comment: http://stackoverflow.com/comment/39499294
has comment: http://stackoverflow.com/comment/39498831
has comment: http://stackoverflow.com/comment/39498980
score: 0
has comment: http://stackoverflow.com/comment/39498941
tagged with: android-listview
tagged with: java
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/39499116
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/39498926
has comment: http://stackoverflow.com/comment/39499475
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25335876
tagged with: android
has title: Redesign the default listview - add additional items like font color

http://stackoverflow.com/comment/39596718
type: Comment
has text: I'll accept as soon as I can verify - I think you are right but I need to prove it on my computer - thank you for your help!
type: AnswerComment
comment on: http://stackoverflow.com/a/25387747
score: 0

http://stackoverflow.com/comment/39523639
has text: Thanks!! You were almost completely right. I also needed to add this line to imports: <?import com.zurg.ocean2.view.BookTree?>
type: AnswerComment
comment on: http://stackoverflow.com/a/25346228
score: 0
type: Comment

http://stackoverflow.com/q/25363882
tagged with: java
answer count: 1
type: Question
has title: Android: Achieve the content inside the linear layout through Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25363958
tagged with: android
has comment: http://stackoverflow.com/comment/39548689
has comment: http://stackoverflow.com/comment/39548742
has comment: http://stackoverflow.com/comment/39548737
has body: I have a sample content.xml whose textview is hard coded right now. But application requirement is such these these have to populated according to the results fetched from db. Suppose I have a service which return list of string which needs to populated as text in text view how can this be achieved in Java Code? &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 1" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 2" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 3" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 4" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 5" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:layout_marginTop="25dp" android:text="Content 6" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;Te…
score: 0

http://stackoverflow.com/q/25349164
has comment: http://stackoverflow.com/comment/39577293
tagged with: jtable
type: AnsweredQuestion
upvote count: 2
has body: I want to create a file reader that shows data in a JTable. The data in the file are separated by ',' , ';' , or '.' characters. Here's a small part of it txt File 12345;Βασ.ίλειος;Τζης;Περικλής;Μαρία;28/06/1984;α1 12346;Βασίλ.ειος;Τζόγλου;Πέτρος;Μαρία;29/06/1984;α1 12347;Βα.σίλειος;Τζόπουλος;Παύ.λος;Μαρία;30/06/1984;α1 12348;Βασίλ.ειος;Τζάκης;Πανα.γιώτης;Μαρία;27/06/1984;α1 I open those records with a default separator (';') as shown in the picture below When I try to select another separator, the program have to read the file again and then separate data with the new separator. I can see that data cannot be refreshed after all. After urging, I put all essential code into one class in order to be runnable. Plus, I use openCSV. public class NewClass extends JFrame{ private CSVReader reader; private DefaultTableModel defaultTableModel; private final Handle handle; private final List&lt;String&gt; studentColumnNames; private FileInputStream fileInputStream; private InputStreamReader fileReader; private int numberOfColumns, numberOfRows; private final JComboBox split; private final JTable dataDemoTable; private String[] nextLine; private String[][] rowData; CharsetDecoder UTF8_CHARSET; Container container; FlowLayout flowLayout; List&lt;String[]&gt; myEntries; public NewClass(){ this.studentColumnNames = new ArrayList&lt;&gt;(); this.studentColumnNames.add("A"); this.studentColumnNames.add("B"); this.studentColumnNames.add("C"); this.studentColumnNames.add("D"); this.studentColumnNames.add("E"); this.studentColumnNames.add("F"); this.studentColumnNames.add("G"); this.split = new JComboBox(); this.split.addItem(";"); this.split.addItem("."); this.split.addItem("tab"); read(); populateData(); this.dataDemoTable = new JTable(new DefaultTableModel(this.rowData, studentColumnNames.toArray())); this.dataDemoTable.setFont(new Font("Calibri", Font.PLAIN,18)); this.dataDemoTable.setPreferredScrollableViewportSize(new Dimension(490,290)); this.dataDemoTable.setFillsViewportHeigh…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39577899
has comment: http://stackoverflow.com/comment/39577918
answer count: 1
has answer: http://stackoverflow.com/a/25379819
tagged with: swing
accepted answer: http://stackoverflow.com/a/25379819
has comment: http://stackoverflow.com/comment/39522124
downvote count: 1
tagged with: opencsv
has comment: http://stackoverflow.com/comment/39579509
favorite count: 0
has title: JTable refresh data from txt file
type: Question
has comment: http://stackoverflow.com/comment/39578045
has comment: http://stackoverflow.com/comment/39522068
tagged with: defaulttablemodel
has comment: http://stackoverflow.com/comment/39577731
has comment: http://stackoverflow.com/comment/39522233

http://stackoverflow.com/a/56749452
has body: on windows : step 1] find the process : netstat -ano or netstat -aon |find /i "listening" |find "Port no" step 2] kill the process : Taskkill /F /IM (Process id obtained from above step) Please see example below:
upvote count: 6
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/25373565
type: Answer

http://stackoverflow.com/a/25338402
type: Answer
score: 0
has body: You can check documentation for PHP WSDL client here: http://php.net/manual/en/book.soap.php $service_url ="my url"; $client = new SoapClient($service_url,array('cache_wsdl' =&gt; WSDL_CACHE_NONE)); $response = $client-&gt;ord:getOrderDocuments(array ( "hl7Order" =&gt; "IvRmxhdGVEZWNvZGU...", //..... other args )); //fetch response $output =$response-&gt;return;
answers question: http://stackoverflow.com/q/25337386

http://stackoverflow.com/q/25239587
possible better answer: http://stackoverflow.com/a/52220359
has title: What is the significance of "key password" in keystore using keytool
tagged with: keytool
tagged with: ssl-certificate
upvote count: 13
score: 13
accepted answer: http://stackoverflow.com/a/25239918
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25239918
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/52220359
has body: I used following command to generate the jks for my web app. keytool -genkey -keyalg RSA -alias my-app -validity 10800 -keysize 2048 -sigalg SHA1withRSA -keystore myapp.jks This command prompted some questions as below: Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: GS What is the name of your organizational unit? [Unknown]: XX What is the name of your organization? [Unknown]: YY What is the name of your City or Locality? [Unknown]: ZZ What is the name of your State or Province? [Unknown]: AA What is the two-letter country code for this unit? [Unknown]: BB Is CN=GS, OU=XX, O=YY, L=ZZ, ST=AA, C=BB correct? [no]: yes Enter key password for &lt;my-app&gt; //Why this password is required??? (RETURN if same as keystore password): Tomcat is able to read this keystore only when both keystore password [first time prompted] and key password. When I use some other password in place of "key password" tomcat fails to start due to the keystore file. My question is what is the significance of key password. P.S: I seen this link. Here they say: Press RETURN when prompted for the key password (this action makes the key password the same as the KeyStore password). If both passwords must be same then any idea what is the significance of asking it twice?
has answer: http://stackoverflow.com/a/25239665
tagged with: keystore
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/39557060
has text: @Absurd-Mind That's what I want to do, but don't know how to. I didn't even know it was possible. Can you tell me how?
comment on: http://stackoverflow.com/q/25337184
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39601199
has text: I'd probably throw in typesafe cast restrictions and restrictions on subtyping, too, but those are more techincal.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25376140
type: Comment

http://stackoverflow.com/comment/39360416
comment on: http://stackoverflow.com/q/25260794
score: 0
has text: So you problem is that `in.readLine()` returns `null`. Have you tried with a simple command to make sure the process works?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39341461
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25251092
has text: user.dir returned /Users/username/eclipse/Eclipse.app/Contents/MacOS/ and after doing the suggested changes, it's back to nullpointerexception.
type: Comment

http://stackoverflow.com/comment/39401275
score: 0
type: AnswerComment
has text: For response analysis via Java code I would go for i.e. Beanshell or JSR223 Post Processor. What do you mean by "specific test case"? If it's thread group - you can set other thread groups thread numbers to 0. If it is a single sampler - you can put it (or remaining) under IF Controller.
type: Comment
comment on: http://stackoverflow.com/a/25262138

http://stackoverflow.com/a/25362244
upvote count: 2
downvote count: 0
has body: Your miss-understanding is in what is class and what is Class (please pay attention on the case of letter "c") Keyword class is used to define user defined types or classes. Class Class is a class that represents other class` metadata. In your case re-write your wrong statement as following: final BaseObject objectType = new Domain("1"); // now this should not cause error something.load2(objectType); If however you will want to discover your Domain class itself, e.g. check dynamically whether it implements method foo() or has field bar you will use Class and reflection API.
score: 2
answers question: http://stackoverflow.com/q/25362086
has comment: http://stackoverflow.com/comment/39545412
type: Answer

http://stackoverflow.com/a/25354188
has body: from: https://wordcram.wordpress.com/2010/09/09/get-acquainted-with-wordcram/ : Daniel Bernier says: June 11, 2013 at 1:13 am You can’t pass command-line args directly to WordCram, because it has no executable. But you can make an executable wrapper (base it on the IDE examples that come with WordCram), and it can read command-line args &amp; pass them to WordCram as needed. FYI, it’ll still pop up an Applet somewhere – AFAIK, you can’t really run Processing “headless.” But that’s usually only a concern if you’re trying to run on a server.
type: Answer
answers question: http://stackoverflow.com/q/25341916
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25341916
type: AcceptedAnswer

http://stackoverflow.com/comment/39433220
has text: possible duplicate of [Java string to date conversion](http://stackoverflow.com/questions/4216745/java-string-to-date-conversion) and [this](http://stackoverflow.com/q/4772425/642706) and [this](http://stackoverflow.com/q/8307417/642706) and [many others](http://stackoverflow.com/search?q=java+date+format).
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25287722
type: QuestionComment

http://stackoverflow.com/comment/39489352
has text: I have added them in the project buildpath and they are physically located in other folder of another drive i.e. in F drive.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25330493
type: Comment

http://stackoverflow.com/comment/39591866
type: QuestionComment
has text: it says "unfortunately, example has stopped"
type: Comment
comment on: http://stackoverflow.com/q/25385769
score: 0

http://stackoverflow.com/q/25336752
tagged with: android
tagged with: java
tagged with: eclipse
has body: I am wondering if anybody knows the solution for this: I am creating a questionnaire in Android using radio buttons and I am wondering if there is a solution for Android to remember which radio buttons were clicked. For example I have a register and login and instead of each user having to click through the questionnaire each time how can I make Android remember which buttons were submitted previously. It would be ideal if I could get Android to remember each user submission... any help will be appreciated as I don't even know where to start. Here is my code for the questionnaire: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_system); /* * The random generator which generates the data inside each individual * string randomly */ randomGenerator = new Random(); /* * The data within each string */ resultsIf1 = new String[] { "100% good job", "well done" }; resultsIf2 = new String[] { "unlucky", "try again" }; /* * Holding the data for the radio buttons from the xml file */ RadioGroup gender = (RadioGroup) findViewById(R.id.question1); gender.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.answer1A: ans1 = 1; break; case R.id.answer1B: ans1 = 2; break; } } }); RadioGroup nutrition = (RadioGroup) findViewById(R.id.question2); nutrition.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.answer2A: ans2 = 1; break; case R.id.answer2B: ans2 = 2; break; } } }); btnSubmitQuiz = (Button) findViewById(R.id.submit); btnSubmitQuiz.setOnClickListener(new OnClickListener() { public void onClick(View v) { // result answer 1 if (ans1 == 1 &amp;&amp; ans2 == 1) { displayResult(getRandom…
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25337574
answer count: 1
has title: Android questionnaire - saving users submissions to memory
has comment: http://stackoverflow.com/comment/39500912
type: Question
accepted answer: http://stackoverflow.com/a/25337574

http://stackoverflow.com/comment/39312171
type: QuestionComment
score: 0
has text: Have you added M2_HOME and its path in system environment variable?
comment on: http://stackoverflow.com/q/25235574
type: Comment

http://stackoverflow.com/q/25327195
type: Question
has body: Actually I have got a situation ,and I am looking for guidance .. The thing is I have got a table which contains entries for days and time at which a user can access the system . The columns are in this way :- Userid day accesstimefrom accesstimeto now I am looking for a way by which I can ensure that for a particular user who has got entry in the table ,the user should be able to access the system at the time and day specified in the table upto the value in accesstimeto column of my table .for if userid =1 day=wednesday accesstimefrom=02:00 accesstimeto=04:00 then user with userid =1 can access the system only at wednesday at 02:00 in the night till 04:00 i.e for 2 hrs Please provide a way how can I achieve this , I am using Jboss 7.1 as server oracle 10g DB Java
has title: Timebound access to system
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25327465
score: 0
tagged with: java
answer count: 1
tagged with: jboss7.x
tagged with: oracle10g

http://stackoverflow.com/comment/39315249
comment on: http://stackoverflow.com/q/25237345
has text: I'm assuming you've compiled your `.java` files into `.class` files...?
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/comment/39492063
type: QuestionComment
score: 0
has text: @t.pimentel but my servlet is not getting those values, even thought they are passed in url :(
comment on: http://stackoverflow.com/q/25327797
type: Comment

http://stackoverflow.com/a/25333602
upvote count: 3
downvote count: 0
has body: You can only request focus on a visible component on a visible GUI. Therefore you can't request focus in the constructor. You should NOT be using a KeyListener anyway. Swing was designed to be used with Key Bindings. Read the section from the Swing tutorial on How to Use Key Bindings. When using key bindings the component does not (always) need to have focus to respond to the key binding.
answers question: http://stackoverflow.com/q/25332230
has comment: http://stackoverflow.com/comment/39500571
score: 3
type: Answer

http://stackoverflow.com/a/25344996
has body: Whenever you can't view your ui the right way look at the code to see if there's red blocks in the right side. This indicates errors that may cause this. In my case I had deleted a semicolon by accident somewhere... If you fix the errors, it should be fine. Also, you can simply try to comment out the errors to see if you can see the ui.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25344676
answers question: http://stackoverflow.com/q/25344676
type: Answer
score: 0

http://stackoverflow.com/comment/39320594
score: 0
type: AnswerComment
has text: So if I have to run it one by one I don't need threads for it I guess?
comment on: http://stackoverflow.com/a/25240141
type: Comment

http://stackoverflow.com/a/25316435
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25316411
has comment: http://stackoverflow.com/comment/39462244
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39462098
has body: My first thought was to use the setter in the constructor. So if you want to change how the name is stored, or if you want to add any other behavior while setting the name, you just have to change it once. But thinking just a bit more on this, I think using direct access to the variable is better if the class is not final and the method is not private. Otherwise someone could extend your, override the method, causing your constructor to call their method with unpredictable behavior. Rule of thumb: If the class is not final, you should only call private methods in the constructor.
type: Answer
score: 6
answers question: http://stackoverflow.com/q/25316411
has comment: http://stackoverflow.com/comment/39462378

http://stackoverflow.com/q/25244041
type: Question
type: AnsweredQuestion
has body: Last packet sent to the server was 0 ms ago. at com.mysql.jdbc.Connection.createNewIO(Connection.java:2820) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1553) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:148) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 14:23:57,798 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0][BasicResourcePool:1841] com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2a391af -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.ConnectException MESSAGE: Verbindungsaufbau abgelehnt STACKTRACE: java.net.ConnectException: Verbindungsaufbau abgelehnt at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket…
score: 1
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25244995
has comment: http://stackoverflow.com/comment/39327814
has comment: http://stackoverflow.com/comment/39330905
tagged with: liferay
downvote count: 0
has title: Trying to start Liferay with Tomcat I get this Java ConnectException: Connection Refused. Any suggestions?
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25244995
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/47466310
score: 0
has text: Is there a recommended way to check the content, in the case where we have conditional logic that displays X or Y depending on model values? Thanks.
comment on: http://stackoverflow.com/a/25304658
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25347593
has comment: http://stackoverflow.com/comment/39519106
has comment: http://stackoverflow.com/comment/97800321
linked to: http://stackoverflow.com/q/37472693
has comment: http://stackoverflow.com/comment/97835377
linked to: http://stackoverflow.com/q/38335529
tagged with: spring
upvote count: 6
score: 6
linked to: http://stackoverflow.com/q/49135156
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39519941
has title: Known way to stop server when spring context failed to load?
has comment: http://stackoverflow.com/comment/39519916
has comment: http://stackoverflow.com/comment/97800420
has comment: http://stackoverflow.com/comment/44798391
has body: Sometimes during development, something gets broken which cause the spring context to fail loading. The problem is that sometimes the error is just in some bean(s), but the rest of the webapp is partially loading, and then you get some weird behaviors. Is there a known way to make Spring stop the server process in case something bad happened? like some bean failed injection, or some NPE happened in some PostConstruct or something. Something like stopOnError=true in web.xml.
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39519728
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/29748372
favorite count: 0
has comment: http://stackoverflow.com/comment/97800319
has comment: http://stackoverflow.com/comment/39519769
type: Question
has answer: http://stackoverflow.com/a/29748372

http://stackoverflow.com/comment/39407896
comment on: http://stackoverflow.com/q/25285932
score: 0
type: Comment
type: QuestionComment
has text: Where is your data coming from? This will probably be a lot easier to do with Lists rather than arrays

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/25385990
tags question: http://stackoverflow.com/q/25276020

http://stackoverflow.com/comment/39502170
comment on: http://stackoverflow.com/a/25337326
score: 0
type: Comment
type: AnswerComment
has text: I guess, because the downvoters think that it is irrelevant to the Question. I agree with that proposition.

http://stackoverflow.com/q/25382192
downvote count: 4
has comment: http://stackoverflow.com/comment/39584103
score: 1
has comment: http://stackoverflow.com/comment/39585238
has comment: http://stackoverflow.com/comment/39584046
has answer: http://stackoverflow.com/a/25382362
has comment: http://stackoverflow.com/comment/39583480
has comment: http://stackoverflow.com/comment/39583441
has comment: http://stackoverflow.com/comment/39584569
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39583472
accepted answer: http://stackoverflow.com/a/25382545
tagged with: performance
answer count: 5
has answer: http://stackoverflow.com/a/25382591
has body: I'm am in my 3rd week of Java in school, and I just submitted a payroll-calculating application. Being an extreme newbie, I know that my code is likely horrific and would give a seasoned programmer a migraine - but that's why I'm here. This assignment has already been turned-in, so I'm not looking for anyone to do my work for me, I'm just wondering about a few specific things in my code, as well as maybe some general "You should have done it this way" feedback, if anyone is so inclined to help a guy with 3 weeks experience get better. First off, here is my code: // Payroll.java // This program calculates an employee's net pay // minus Federal tax (11% off the gross) with Overtime // Daniel Zaleski // 08/17/2014 /** Import Scanner */ import java.util.Scanner; // Scanner to read user input /** Create Class */ public class Payroll // Class declaration { public static double hoursWorked; // Declare hoursWorked as a double public double hoursWorked() { return hoursWorked; } public static double hourlyRate; // Declare hourlyRate as a double public double hourlyRate() { return hourlyRate; } private double taxedPay; // Declare taxedPay as a double public double taxedPay() { return taxedPay; } private double netPay; // Declare netPay as a double public double netPay() { return netPay; } private static double grossPay; // Defining variable grossPay private static double overtimePay; // Defining variable overtimePay private static double overtimeHours; // Defining variable overtimeHours public static void main(String[] args) // Main method { int i = 8; // Setting the application loop while(i &lt; 9) // Setting the termination variable which doesn't exist to continue loop { Scanner input = new Scanner(System.in); // Creating the scanner /** Prompt for first name */ String firstName; // Variable for the first name System.out.println("\nEnter Your First Name: (Enter the name quit (all lowercase) to terminate application)\n"); firstName = input.next(); // Setting the loop terminat…
possible better answer: http://stackoverflow.com/a/25382471
upvote count: 5
has answer: http://stackoverflow.com/a/25382545
tagged with: java
has answer: http://stackoverflow.com/a/25383315
has title: 3rd Week of Programming, just looking for tips
has comment: http://stackoverflow.com/comment/39583928
has answer: http://stackoverflow.com/a/25382471
has comment: http://stackoverflow.com/comment/39583901
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39583761

http://stackoverflow.com/a/25381269
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39653762
answers question: http://stackoverflow.com/q/25303420
has body: You should always separate as much as possible the server-side from client-side, else you'll end up having a hard to mantain, not understandable and error prone code. That being said, you can convert your map to JSON and send that json to the client-side, so it can be handled as you want: &lt;script&gt; var statesJSON = JSON.parse( &lt;%= net.sf.json.JSONSerializer.toJSON(states) %&gt; ); &lt;/script&gt; Now you can write your client-side code (regarding the population of the drop-down lists) by using the statesJSON global variable. You can follow these links for how to populate a drop-down list based on selection on another : populate-one-dropdown-based-on-selection-in-another populate-one-dropdown-list-based-on-the-selection-of-other-dropdown-list populate-a-second-drop-down-menu-depends-upon-first-drop-down-selection
score: 1

http://stackoverflow.com/q/25250104
has title: Could not inject Spring service into akka service
has comment: http://stackoverflow.com/comment/39396097
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39381911
has comment: http://stackoverflow.com/comment/39395081
has body: I have Spring service, which is actually actor, it is received info, but I cant pass it to another Spring service, because injection fails. @Service("mailContainer") @Scope("prototype") @Component public class MailContainer extends UntypedActor { private final LoggingAdapter LOG = Logging.getLogger(getContext().system(), this); private Mail value; private List&lt;Mail&gt; mailList = new ArrayList&lt;Mail&gt;(); private Integer size; @Autowired @Qualifier("springService") private SpringService springService; //@Autowired public void setSpringService(SpringService springService) { this.springService = springService; } public MailContainer(Mail value) { this.value = value; } @Override public void onReceive(Object message) throws Exception { // LOG.debug("+ MailContainer message: {} ", message); if (message instanceof Mail) { value = (Mail) message; System.out.println("MailContainer get message with id " + value.getId()); System.out.println("With time " + value.getDateSend()); //getSender().tell(value, getSelf()); //heta uxarkum //this.saveIt(value); springService.add(value); } } and second service @Service("springService") //@Component @Scope("session") public class SpringService { private List&lt;Mail&gt; mailList = new ArrayList&lt;Mail&gt;(); public void add(Mail mail) { System.out.println("Saving mail from Spring " +mail.getId()); mailList.add(mail); } public List&lt;Mail&gt; getMailList() { return mailList; } } Spring config, this is from akka spring example @Configuration //@EnableScheduling //EnableAsync @ComponentScan(basePackages = {"com"}, excludeFilters = { @ComponentScan.Filter(Configuration.class)}) //@ImportResource("classpath:META-INF/spring/spring-data-context.xml") //@EnableTransactionManagement //@EnableMBeanExport //@EnableWebMvc public class CommonCoreConfig { // the application context is needed to initialize the Akka Spring Extension @Autowired private ApplicationContext applicationContext; /** * Actor system singleton for this application. */ @Be…
has comment: http://stackoverflow.com/comment/39399202
tagged with: java
tagged with: spring
accepted answer: http://stackoverflow.com/a/25283009
tagged with: akka-persistence
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39396345
has answer: http://stackoverflow.com/a/25283009
has comment: http://stackoverflow.com/comment/39382185
tagged with: jsf
tagged with: akka
downvote count: 0
answer count: 1
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39396375

http://stackoverflow.com/q/25289275
has comment: http://stackoverflow.com/comment/39411968
has comment: http://stackoverflow.com/comment/39427915
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39411846
tagged with: spring
has body: I am trying to provide a Custom Implementation of repository using Spring Data JPA. I have : public interface PersonRepositoryCustom{ List&lt;Person&gt; chercher(String name); } And the implementation : public class PersonRepositoryImpl implements PersonRepositoryCustom{ List&lt;Person&gt; chercher(String name){ // my implementation } } The two classes are in the jpa:repositories package Here is my Person DAO: public interface IPersonDAO extends CrudRepository&lt;Person, Long&gt;,PersonRepositoryCustom{ // other methods here } When i launch the server i am getting the error : org.springframework.data.mapping.PropertyReferenceException: No property chercher found for type Person at org.springframework.data.mapping.PropertyPath.&lt;init&gt;(PropertyPath.java:75) at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270) at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241) at org.springframework.data.repository.query.parser.Part.&lt;init&gt;(Part.java:76) at org.springframework.data.repository.query.parser.PartTree$OrPart.&lt;init&gt;(PartTree.java:201) at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:291) at org.springframework.data.repository.query.parser.PartTree$Predicate.&lt;init&gt;(PartTree.java:271) at org.springframework.data.repository.query.parser.PartTree.&lt;init&gt;(PartTree.java:80) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.&lt;init&gt;(PartTreeJpaQuery.java:57) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:91) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:162) at org.springframework.data.jpa.repo…
has comment: http://stackoverflow.com/comment/39412117
score: 3
upvote count: 3
tagged with: spring-data-jpa
downvote count: 0
has title: Spring data jpa cannot find my custom implementation method
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39427908
has answer: http://stackoverflow.com/a/25297885
has comment: http://stackoverflow.com/comment/39413142
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39413791

http://stackoverflow.com/comment/39436832
has text: I dunno. Pick the guy with the lowest rep to give him/her a boost? Roll a dice? Pick your favourite username? :-). It's not critical you do this, so don't worry about it if you don't want to.
type: Comment
comment on: http://stackoverflow.com/q/25302423
type: QuestionComment
score: 1

http://stackoverflow.com/a/25250696
answers question: http://stackoverflow.com/q/25250526
has comment: http://stackoverflow.com/comment/39340515
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39340571
has body: You can do it with str.split(): String str = "nameadress=johndoe&amp;adress=newyork163thdowntown&amp;phone=+341431242"; String[] firstSplit = str.split("&amp;"); System.out.println(firstSplit[0]); // Prints nameadress=johndoe System.out.println(firstSplit[1]); // Prints adress=newyork163thdowntown System.out.println(firstSplit[2]); // Prints phone=+341431242 String name = firstSplit[0].split("=")[1]; // johndoe String address = firstSplit[1].split("=")[1]; // newyork163thdowntown String phone = firstSplit[2].split("=")[1]; // +341431242 Then you can write these three strings to a file In order to ignore any other data you could do the following: String str = "nameadress=johndoe&amp;age=15&amp;sex=female&amp;adress=newyork163thdowntown&amp;phone=+341431242"; String name = str.split("nameadress=")[1].split("&amp;")[0]; String adress = str.split("adress=")[1].split("&amp;")[0]; String phone = str.split("phone=")[1]; // This is the end of the String so we do not need to split("&amp;")
has comment: http://stackoverflow.com/comment/39341058
has comment: http://stackoverflow.com/comment/39340535
type: Answer
has comment: http://stackoverflow.com/comment/39340776
has comment: http://stackoverflow.com/comment/39340882
accepted answer of: http://stackoverflow.com/q/25250526
score: 0

http://stackoverflow.com/q/25321312
upvote count: 1
has body: For some reason it keeps saying: error: '.class' expected and error: ';' expected public class num1{ public static void main(String args[]) throws java.io.IOException { char let; num1 (char l) { let=l; } l = (char) System.in.read(); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/39471207
type: Question
has comment: http://stackoverflow.com/comment/39471206
tagged with: constructor
has comment: http://stackoverflow.com/comment/39471210
has title: Why doesn't my constructor work? Java
has comment: http://stackoverflow.com/comment/39471715
has answer: http://stackoverflow.com/a/25321364
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25321351
score: -2
has comment: http://stackoverflow.com/comment/39471228
has comment: http://stackoverflow.com/comment/39471251
has comment: http://stackoverflow.com/comment/39471390
has answer: http://stackoverflow.com/a/25321682
tagged with: command-line
answer count: 3
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/39578425
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25377463
has text: What line is your breakpoint on? Does it contain code, or is it a breakpoint on a class attribute (also called watchpoint)? What does it look like (symbol) in the "Breakpoints" window (ALT+SHIFT+Q, B)?

http://stackoverflow.com/q/25313054
has title: what's the relationship between ClassName.this and Context Class?
score: 0
tagged with: android
tagged with: java
has body: Im learning Android ComponentName, the example of the android book is: ComponentName componentName = new ComponentName( ComponentAttrActivity.this, SecondActivity.class); It is used to create a 2nd Activity by the 1st Activity, Im confused about the first parameter: ComponentAttrActivity.this. I checked on StackOverflow, most answers are about why it is ClassName.this not only this, but what I want to know is what's the relationship between the type of Class.this with Context, I am assuming the above ComponentName constructor fit the 3rd constructor below it has 3 2-argument constructors: ComponentName(String pkg, String cls) ComponentName(Context pkg, String cls) ComponentName(Context pkg, Class&lt;?&gt; cls) I checked Context of Android API, still have no clue... Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc. Can anyone explain this for me?
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/25313154
has answer: http://stackoverflow.com/a/25313154
type: AnsweredQuestion

http://stackoverflow.com/comment/39534903
comment on: http://stackoverflow.com/a/25289837
score: 0
type: AnswerComment
type: Comment
has text: thanks.but i need this json format need to store dojo datagrid.

http://stackoverflow.com/comment/39543088
score: 0
comment on: http://stackoverflow.com/q/25360916
type: Comment
type: QuestionComment
has text: What about removing it? Unless you're developing an API used by third parties for example.

http://stackoverflow.com/comment/39485425
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25306786
type: Comment
has text: Will deserializing maps `newB` to `b`? again in need of **MixIn**, if so how?

http://stackoverflow.com/a/25342407
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25342370
has comment: http://stackoverflow.com/comment/39510591
answers question: http://stackoverflow.com/q/25342370
type: Answer
has comment: http://stackoverflow.com/comment/39511026
has comment: http://stackoverflow.com/comment/39510699
has comment: http://stackoverflow.com/comment/39510852
has comment: http://stackoverflow.com/comment/39511340
has body: You haven't compared string properly in your code! Grade.equals("1") AND Grade.equals("2") Next,your code is incorrect in returning values too. Totalsal=inputbasicSal()+allowance(); here, return type of inputbasic() is string which is different from other two. So,it's an error. Please correct it as float Totalsal=Float.parseFloat(inputbasicSal())+allowance(); And similarly,for the next two methods! float Tax=(100/5)*Float.parseFloat(inputbasicSal()); And,the last one :- float Net=Float.parseFloat(inputbasicSal())+allowance()-tax(); Edit your code accordingly!
has comment: http://stackoverflow.com/comment/39511093
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25354009
score: 4
upvote count: 4
has title: Jackson serialization of Map of objects
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2525042
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25354080
has answer: http://stackoverflow.com/a/25354080
favorite count: 0
type: Question
has body: I'm attempting to use Jackson to serialize and deserialize a map containing arbitrary objects. According to the docs I've read I should be able to use enableDefaultTyping() to tell Jackson to store the info I need in serialization, and have written the following simple test: @Test public void testObjectMap() { final ObjectMapper mapper = new ObjectMapper().enableDefaultTyping(); final Map&lt;String, Object&gt; map = Maps.newHashMap(); map.put("test1", new Date()); map.put("test2", new InetSocketAddress(10)); try { final String ser = mapper.writeValueAsString(map); System.err.println(ser); final Map&lt;String, Object&gt; deser = this.mapper.readValue(ser, new TypeReference&lt;Map&lt;String, Object&gt;&gt;(){}); assertTrue(deser.get("test1") instanceof Date); assertTrue(deser.get("test2") instanceof InetSocketAddress); } catch (final IOException e) { fail("Failed", e); } } The serialization looks okay, in that the System.err.println(ser) line in the above code produces the output: {"test1":["java.util.Date",1408312196267],"test2":["java.net.InetSocketAddress","0.0.0.0:10"]} But the deserialization attempt fails with the following error: Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class java.util.Map at [Source: {"test1":["java.util.Date",1408312196267],"test2":["java.net.InetSocketAddress","0.0.0.0:10"]}; line: 1, column: 1] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164) at com.fasterxml.jackson.databind.DeserializationContext.wrongTokenException(DeserializationContext.java:841) at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._locateTypeId(AsArrayTypeDeserializer.java:122) at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._deserialize(AsArrayTypeDeserializer.java:93) at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer.dese…
downvote count: 0
tagged with: jackson

http://stackoverflow.com/a/25257118
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25257055
answers question: http://stackoverflow.com/q/25257055
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: The problem is that you are getting directly the Webresponse which is still null. it is initialized when the response to web request is done. now LG.getWebresponse() will return null, you need to wait for the web response to be done before you can use the Webresponse in your log. solution: you need to use asyntask instead of thread and log it in the onPostExecute() method that will secure Webresponse is initialized to the response of the web request.

http://stackoverflow.com/q/25271352
score: 2
type: UnansweredQuestion
tagged with: scala
downvote count: 0
has comment: http://stackoverflow.com/comment/39380607
tagged with: java-8
duplicate of: http://stackoverflow.com/q/23860533
has comment: http://stackoverflow.com/comment/39378864
has comment: http://stackoverflow.com/comment/39378899
tagged with: java
has title: java.lang.IllegalStateException: stream has already been operated upon or closed
has comment: http://stackoverflow.com/comment/39380642
favorite count: 0
type: Question
has body: I'm training with Java 8 streams, trying to implement the same logic as in this Scala code I also wrote : def solution = { var s = "input" var n = Math.sqrt(s.length / 3).toInt val arr = s.split("\\s+").map(_.toInt) def prod(index : Int, count : Int = 4)(inc : Int) : Int = if (count &gt; 0) arr(index)*prod(index + inc,count - 1)(inc) else 1 def prodInRange(rows : Seq[Int], cols : Seq[Int])(inc : Int) = for (i &lt;- rows ; j &lt;- cols) yield prod(n*i + j)(inc) val seq = prodInRange(0 to 19,0 to 16)( 1 ) ++ prodInRange(0 to 16,0 to 19)( n ) ++ prodInRange(0 to 16,0 to 16)(n + 1) ++ prodInRange(3 to 19,0 to 16)(1 - n) seq.max } I implemented prod in Java, nothing special about that, and the method solution is also quite the same. However, I'm having a hard time with prodInRange. I change it to maxProdInRange, which is supposed to compute not only all the products but also their maximum. Here is the code : public static int maxProdInRange(IntStream rows, IntStream cols, int inc, List&lt;Integer&gt; input) { int n = (int) Math.sqrt(input.size()); return rows.flatMap(i -&gt; cols.map(j -&gt; prod(i*n + j,inc,input))).max().getAsInt(); } Nevertheless, I'm having an exception (see title) when calling maxProdInRange. According to the tests I ran to try to debug it, it occurrences only when I call max(). First, I would like to know why I get this error (I think it comes from a misconception about Java streams) and also a way to fix it. Note that in all the calls to maxProdInRange have the form maxProdInRange(IntStream.range(a,b),IntStream.range(a,b),input) so rows and cols are neither operated nore closed when passed as parameters.
has comment: http://stackoverflow.com/comment/39378767
linked to: http://stackoverflow.com/q/23860533
answer count: 0
tagged with: java-stream
upvote count: 2

twilio
tag name: twilio
type: Tag
tags question: http://stackoverflow.com/q/25279434

http://stackoverflow.com/a/25231024
has comment: http://stackoverflow.com/comment/39327555
has comment: http://stackoverflow.com/comment/39328155
type: Answer
answers question: http://stackoverflow.com/q/25230909
score: 2
upvote count: 2
has body: If you image fully covers the button, just put a click listener on the image, and forget about the button. Or better yet, the JButton can take an image as it's contents, so alter the JButton's look and feel to not draw the button borders, and add the image. If those techniques don't work for you (say you want to partially see the button behind the image, then still consider putting the image in the button, but compost your image to contain the portion of the button that will be visible. There are a number of very good reasons for this. You don't have to worry about fighting for focus, so your image can't swallow the mouse click. Tab and arrow hot keys will work appropriately, as will the "enter to click" behaviors. Your code will read better, which will help you finish the project faster and ease in maintenance. Now, if the image never overlaps the button, then just layout an image above the button; however, in your write up, it seems you are trying to do something quite different.
has comment: http://stackoverflow.com/comment/39313309
downvote count: 0
has comment: http://stackoverflow.com/comment/39328239

http://stackoverflow.com/a/25244372
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25241319
downvote count: 0
score: 13
has body: First, yes, the exception says the Java SSL module in your machine doesn't trust the proof of identity (certificate) received from the server. Yes, Java 7 does stricter checking. There may be more, but the one I'm sure of is that it doesn't allow the validity period of a child cert to end after the parent/CA cert (or begin before, but in practice that doesn't happen). See PKIX Path does not chain with any of the trust anchors error in Windows Environment which says it is a bug and will be fixed. To check: if the server is a webserver, you could access any (harmless) page with a browser and use that to look at the cert chain. Otherwise, run openssl s_client -connect $host:443 -showcerts and once it connects enter EOF (Unix ^D, Windows ^Z), then put each ----BEGIN CERT... to -----END CERT... block in a different file and run openssl x509 -noout -subject -issuer -startdate -enddate on each in order. To fix: if this is the problem, there doesn't seem to be any way to turn it off directly, except by turning off all cert checking (and thus losing some of the security of SSL), but adding the server entity cert to your truststore should work because then Java doesn't verify the chain. (You don't need to remove what's already there, just use an alias that isn't already in use.) Good luck.
upvote count: 13
has comment: http://stackoverflow.com/comment/39362014
has comment: http://stackoverflow.com/comment/39362025
type: Answer
has comment: http://stackoverflow.com/comment/40947280
has comment: http://stackoverflow.com/comment/39472603
accepted answer of: http://stackoverflow.com/q/25241319

http://stackoverflow.com/a/25268268
answers question: http://stackoverflow.com/q/25268174
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: Your array someByte is out of scope public class MyClass { public static byte[] someMethod() { try { ... byte[] someByte = .... ; // scope begins return someByte; // scope ends } catch (Exception e) { e.printStackTrace(); } return someByte; // out of scope } } instead do this public class MyClass { public static byte[] someMethod() { byte[] someByte = null ; // scope begins try { someByte = .... ; return someByte; } catch (Exception e) { e.printStackTrace(); } return someByte; // scope ends } }

http://stackoverflow.com/comment/39434330
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/25301474
has text: vote for close under minimum effort of OP

http://stackoverflow.com/q/25234892
favorite count: 0
type: Question
has body: I dont understand why I am getting this error on the save below. Any clue? org.springframework.beans.InvalidPropertyException: Invalid property 'id' of bean class [com.test.DataException]: Getter for property 'id' threw exception; nested exception is java.lang.reflect.InvocationTargetException Code try { DataException dataException = new DataException(); dataException.tenant = job.tenant; dataExceptionRepository.save(dataException); } catch (Throwable ex) { } DataException.java @Entity public class DataException { @Id @GeneratedValue public Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "tenantId") public Tenant tenant; public String sourceSystem; public String objectType; public String objectId; public String description; public Date jobDate; public long getId() { return id; } public void setId(long id) { this.id = id; } Stack Trace org.springframework.beans.InvalidPropertyException: Invalid property 'id' of bean class [com.test.DataException]: Getter for property 'id' threw exception; nested exception is java.lang.reflect.InvocationTargetException at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:823) ~[spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:699) ~[spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$DirectFieldAccessFallbackBeanWrapper.getPropertyValue(JpaMetamodelEntityInformation.java:225) ~[spring-data-jpa-1.3.2.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.getId(JpaMetamodelEntityInformation.java:84) ~[spring-data-jpa-1.3.2.RELEASE.jar:na] at org.springframework.data.repository.core.support.AbstractEntityInformation.isNew(AbstractEntityInformation.java:53) ~[spring-data-commons-1.5.1.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:3…
has comment: http://stackoverflow.com/comment/39310825
tagged with: spring
has comment: http://stackoverflow.com/comment/39310996
upvote count: 23
has comment: http://stackoverflow.com/comment/39311134
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39313487
accepted answer: http://stackoverflow.com/a/25235148
tagged with: java
tagged with: hibernate
has title: org.springframework.beans.InvalidPropertyException: Invalid property 'id' of bean class
answer count: 1
has answer: http://stackoverflow.com/a/25235148
downvote count: 0
score: 23

http://stackoverflow.com/q/25308640
has body: I'm using JAXB unmarshalling to parse through a XML file. Have created two JAXB objects with different packages which means two package-info.java files are available. Compilation of both the package-info.java also goes through on Eclipse. Have an issue on UNIX server. The java file names should be unique. How can i now maintain multiple package-info.java which is required for proper namespace. Code of package-info.java @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.com/done/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns = { @javax.xml.bind.annotation.XmlNs( prefix = "done",namespaceURI = "http://www..com/done/" )}) package com.ui.done.one; Code of another package-info.java @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.com/done/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns = { @javax.xml.bind.annotation.XmlNs( prefix = "done",namespaceURI = "http://www..com/done/" )}) package com.ui.done.two; Help me on how to maintain multiple package-info.java but with a unique name. Java version is "1.7.0.08"
has title: package-info.java compilation on UNIX server
score: 0
type: UnansweredQuestion
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25308664
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/39491244
score: 0
has text: Spawn a communicator thread? I don't understand how threads in the same program are isolated I'm that type of scenario? Using http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Exchanger.html seems like a good idea.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25329650

http://stackoverflow.com/a/25363044
accepted answer of: http://stackoverflow.com/q/25362932
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25362932
has body: You never initialize current_path, so it is still null when you call add(v) on it. That is what is throwing the NullPointerException. You have to create a new ArrayList and assign it to current_path before you can use it. You can create it in the constructor. public DirectionGraphe(){ current_path = new ArrayList&lt;GraphVector&gt;(); } Also, I would check your other instance variables and make sure they get initialized correctly. (such as weight_sum. It looks like you add a number to it before giving it a value)

http://stackoverflow.com/a/25332285
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25332241
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25332241
has body: Once the return statement has been reached, no further code will execute within that method. Therefore, in this case the break statement will never actually be reached, so you are right that it is not necessary. I'm guessing that the person who wrote it was just trying to be extra (read: too) careful. In fact, the compiler should give you an unreachable code warning when you compile this, as it will recognize that you have operations listed in an unreachable part of your program. In general it is very bad practice to have any operations directly following a return statement for this very reason.
type: Answer

http://stackoverflow.com/comment/39652846
type: QuestionComment
has text: @trashgod i can create ovel shape form that do you have any idea to create other shapes? if i can use library please tell me.i search github project but i didnt find any good project
comment on: http://stackoverflow.com/q/25379397
score: 0
type: Comment

http://stackoverflow.com/a/25321942
answers question: http://stackoverflow.com/q/25321773
has comment: http://stackoverflow.com/comment/39472417
type: Answer
has body: If the problem is just to get description on the basis of button click then you can try this code.In this case I have get the button text so in you case you can get the description from the strings. result=(TextView) findViewById(R.id.textView1); btn1=(Button) findViewById(R.id.button1); btn2=(Button) findViewById(R.id.button2); btn1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub result.setText(btn1.getText().toString()); } }); btn2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub result.setText(btn2.getText().toString()); } });
has comment: http://stackoverflow.com/comment/39472552
score: 0

http://stackoverflow.com/comment/40247655
type: Comment
type: AnswerComment
has text: Since you have no control in how ZK renders the HTML, I think the best solution is the Java/CSS override approach suggested by @chillworld.
comment on: http://stackoverflow.com/a/25732283
score: 1

http://stackoverflow.com/a/25437581
has comment: http://stackoverflow.com/comment/39912785
answers question: http://stackoverflow.com/q/25359734
type: Answer
accepted answer of: http://stackoverflow.com/q/25359734
has comment: http://stackoverflow.com/comment/39690235
score: 1
type: AcceptedAnswer
downvote count: 0
has body: I have forked the repo and have made some changes. I have an open pull request that will be reviewed shortly and then we'll get it pushed to the main repo. Here's a link to the branch. https://github.com/trevershick/Rally-Lookback-Toolkit/tree/S72258 If you want to clone that repo and 'mvn package' the source it will generate a .jar file for you that you can use. It's the same interface as the one you're probably using now but has setProxyServer and setProxyCredentials for authenticating against a proxy server via basic auth. If you cannot use basic auth to authenticate against the proxy server then you may need to inject your own instance of DefaultHttpClient (see the Readme). You should be able to add for example an Ntlm Credentials object to the Credentials provider if necessary. Fee free to ask any questions you may have and i'll update this answer once I get the PR merged in.
upvote count: 1

http://stackoverflow.com/a/25318983
has comment: http://stackoverflow.com/comment/39467248
has body: Your question doesn't make sense if we don't know how doSomething is called. You could get almost of those exceptions according to the situation : In some cases, you won't get any exceptions. For example : ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add(""); doSomething(a,0); The following will throw a NullPointerException : ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add(null); doSomething(a,0); This one will throw an IndexOutOfBoundException : doSomething(new ArrayList&lt;&gt;(),0) Finally, you would have a ClassCastException with this one : ArrayList a = new ArrayList(); a.add(new Object()); doSomething(a,0); Neither D nor E are possible (D could only happen if you used an array and your code does not contain any particular arithmetic operation that could throw an exception).
answers question: http://stackoverflow.com/q/25318925
score: 1
has comment: http://stackoverflow.com/comment/39467309
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39467362
has comment: http://stackoverflow.com/comment/39467338
has comment: http://stackoverflow.com/comment/39467323
type: Answer

http://stackoverflow.com/q/25355241
type: Question
tagged with: batch-file
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/25355273
type: AnsweredQuestion
has body: I have an existing Java project that compiles and runs properly through Eclipse. I have created the following .bat file to run the program sans Eclipse: java -classpath jflashplayer.jar;bin TestProgram The file is saved within the project folder, but not within the bin folder (located in same directory as bin). When I try to run the batch, I am met with a large number of runtime errors, the first being Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils I'm not sure why I get this error when it compiles and runs properly via Eclipse. I have the commons-io jar files linked to the project within Eclipse as libraries, and the jar files are themselves located in the project file (same directory as the batch file and the bin folder). Also, I'm not entirely sure what the -classpath jflashplayer.jar bit of the batch file is doing. I am using the jflashlayer.jar library (also linked to the project within Eclipse and in the same location as the other jar files), but I am not sure why it would appear in the batch file. I edited an existing batch file from a similar project that uses the jflashplayer.jar files, and it has worked previously to leave that part in. When I write code in Java, I rarely require it to compile/run outside of the IDE, so I usually have troubles when it comes to this part. Perhaps there is a more robust and foolproof method to run the program outside of the IDE other than the batch file method.
linked to: http://stackoverflow.com/q/8511063
has title: JAVA, Batch file errors
upvote count: 1
answer count: 1
downvote count: 0
tagged with: jar
accepted answer: http://stackoverflow.com/a/25355273
favorite count: 0

http://stackoverflow.com/a/25339041
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25268550
downvote count: 0
has body: I was waaay off. There was no problem with my code at all. The problem was that my project had a dependency that was not compatible with a JEE module installed on the server. javax.validation validation-api compile The problem started when Intellij (but not Maven) began to issue warnings, such as the one above, when compiling. The following change eliminated the MalformedParameterizedTypeException problem but reintroduced the annoying Intellij warning. provided JetBrains support created a new issue in its bug tracker: http://youtrack.jetbrains.com/issue/IDEA-127569
type: Answer
accepted answer of: http://stackoverflow.com/q/25268550
score: 2

http://stackoverflow.com/comment/67347163
has text: Checkout this answer http://stackoverflow.com/a/40035338/4989929,If it helps.
type: QuestionComment
comment on: http://stackoverflow.com/q/25262435
score: 0
type: Comment

http://stackoverflow.com/comment/39407248
type: Comment
has text: Please show your TableModel inplementation... Why `SwingUtilities.updateComponentTreeUI(queryTable)`?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25287064

http://stackoverflow.com/comment/39583574
has text: Does this have to be in the render method and where would you put your clear screen?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25382334

http://stackoverflow.com/comment/131428027
score: 0
comment on: http://stackoverflow.com/q/25368339
type: QuestionComment
type: Comment
has text: Oracle has a helpful tutorial, [Creating a GUI With Swing](https://docs.oracle.com/javase/tutorial/uiswing/index.html). Skip the Learning Swing with the NetBeans IDE section.

http://stackoverflow.com/q/25357043
tagged with: java-8
tagged with: foreach
type: AnsweredQuestion
tagged with: java-stream
score: 3
has body: I try to understand the new Java 8 Streams and I tried for days to transfer nested foreach loops over collection in Java 8 Streams. Is it possible to refactor the following nested foreach loops including the if-conditions in Java-8-Streams? If yes what would it look like. ArrayList&lt;ClassInq&gt; Inq = new ArrayList&lt;&gt;(); TreeMap&lt;String, SalesQuot&gt; Quotations = new TreeMap&lt;&gt;(); ArrayList&lt;ClassInq&gt; tempInqAndQuot = new ArrayList&lt;&gt;(); ArrayList&lt;SalesQuot&gt; tempQuotPos = new ArrayList&lt;&gt;(); for(ClassInq simInq : this.Inq) { if(!simInq.isClosed() &amp;&amp; !simInq.isDenied()) { for(Map.Entry&lt;String, SalesQuot&gt; Quot: Quotations.entrySet()) { SalesQuot sapQuot = Quot.getValue(); if(sapQuot.getInquiryDocumentNumber().compareTo(simInq.getSapInquiryNumber()) == 0) { simInq.setSAPQuotationNumber(sapQuot.getQuotationDocumentNumber()); tempInqAndQuot.add(simInq); for(Map.Entry&lt;String, SalesQuotPosition&gt; quotp : sapQuot.getPosition().entrySet()) { tempQuotPos.add(quotp.getValue()); } } } } } Thanks a lot for your help. BR
upvote count: 3
tagged with: java
downvote count: 0
has title: Java 8 - Streams Nested ForEach with different Collection
has comment: http://stackoverflow.com/comment/39549358
has comment: http://stackoverflow.com/comment/39551099
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25366161
has comment: http://stackoverflow.com/comment/39554147
has answer: http://stackoverflow.com/a/25366161
answer count: 1
tagged with: collections

http://stackoverflow.com/comment/39416997
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25291773
has text: I've tested this on MacOS and Windows and it's always the same result. My original file on the server is 2,612,350 bytes and the downloaded file on MacOS is exactly the same size but the file downloaded on Windows is 2,622,171 bytes. And this is a jar file so the downloaded file on windows is corrupted and can't be used.
score: 0

http://stackoverflow.com/comment/39912785
comment on: http://stackoverflow.com/a/25437581
score: 2
type: Comment
type: AnswerComment
has text: The binary has been released and is searchable through search.maven.org ( http://search.maven.org/#search%7Cga%7C1%7Clookback ).

http://stackoverflow.com/comment/39581775
has text: ItemFormatter, is this a stand alone class?
comment on: http://stackoverflow.com/a/25381411
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25359762
upvote count: 1
has body: Can you check the log, for any possible exceptions. Any runtime exception might also be stopping the thread.
type: Answer
answers question: http://stackoverflow.com/q/25358461
has comment: http://stackoverflow.com/comment/39541751
score: 1
downvote count: 0

http://stackoverflow.com/comment/39322652
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25241338
type: Comment
has text: Are you sure you add guava jar right place?

http://stackoverflow.com/comment/39562076
comment on: http://stackoverflow.com/a/25370547
type: AnswerComment
score: 0
has text: @Mik378 I say "should", since that's the good practice in OOP. The fact that Java doesn't force you to do it doesn't mean you don't have to.
type: Comment

http://stackoverflow.com/comment/40245775
type: Comment
score: 0
type: QuestionComment
has text: *which one is used for rotation* - the first four. A pure rotation (by an angle q counter clockwise) transformation matrix looks like `[cos q sin q -sin q cos q 0 0]`. For details cf. section 8.3.3 *Common Transformations* of the [PDF specification](http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf).
comment on: http://stackoverflow.com/q/25356302

http://stackoverflow.com/q/25374223
has body: Can I sleep or stop AsycTask's execution without affect to UI? Is there any way other than creating a new Thread to achieve this (I am sure this doesn't affect UI though)? Explanation: public class MyAsync extends AsyncTask&lt;....&gt;{ @Override ..doInbackground(){ //do something for(....){ //sleep this Asynctask //I want to delay my for loop } //do something } } Creating a new Thread isn't what I want as follow: //inside doInBackground() new Thread(new Runnable(){ @Override public run(){ for(..){ Thread.sleep(1000);//sleeping for 1 second } } }); //other parts P.S. I am using AsyncTask in Service to run in background every N seconds.
tagged with: android-asynctask
score: 0
tagged with: multithreading
answer count: 1
has comment: http://stackoverflow.com/comment/39569424
has answer: http://stackoverflow.com/a/25374324
accepted answer: http://stackoverflow.com/a/25374324
type: Question
has comment: http://stackoverflow.com/comment/39569443
has comment: http://stackoverflow.com/comment/39569467
type: AnsweredQuestion
tagged with: android
tagged with: java
has title: Pause or sleep AsyncTask without affect to UI

http://stackoverflow.com/q/25232718
tagged with: jtable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39307552
answer count: 3
tagged with: file-io
possible better answer: http://stackoverflow.com/a/25232950
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25232950
type: Question
has answer: http://stackoverflow.com/a/25233472
tagged with: swingworker
has title: Moving a method into SwingWorker
downvote count: 0
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/25232881
has body: I am working on a program that analyzes DNA. The main work of the program is in a method that takes in a certain file type, parses the file and converts it into a string, then parses the string to separate it into segments. It then returns the results of the analysis in a JTable on a new JFrame. public JTable readFile(File file) throws IOException{ BufferedReader in = new BufferedReader(new FileReader(file)); String line; String result = ""; while((line=in.readLine())!=null) { if(!line.startsWith("&gt;")) { result = result + line; } } Sequence sequence = new Sequence("Unspecified", result); ArrayList&lt;Contig&gt; contigs = sequence.getReadingFrames(); String [] columnNames = {"Position", "Frame", "Sequence"}; Object[][] data = new Object[contigs.size()][3]; int j = 0; for (int i = 0; i &lt;= contigs.size() &amp;&amp; j &lt; 3; i++){ if (i == contigs.size()){ j++; i = -1; } else if (j == 0){ data[i][j] = Integer.toString(contigs.get(i).getStartPosition()); } else if (j == 1){ data[i][j] = Integer.toString(contigs.get(i).getReadingFrame()); } else if (j == 2){ data[i][j] = contigs.get(i).getSequence(); } } JTable seqTable = new JTable(data, columnNames); in.close(); return seqTable; } How should I go about moving this into a SwingWorker? I tried a copy, paste, and edit, but the whole thing just returns empty results.
favorite count: 0
has answer: http://stackoverflow.com/a/25232881

http://stackoverflow.com/q/25245355
has title: calling args from out side the main method
has answer: http://stackoverflow.com/a/25360905
score: 0
tagged with: java
tagged with: corba
has body: I am developing a client server application where i can invoke server from the remote client and the some string is returned from the client. I am using CORBA. I have a user interface developed by using Java Swing on Netbeans. I need to invoke the server when a button is clicked on the client interface. For that I have to put following code segment inside jButtonaction listener. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try{ // create and initialize the ORB ORB orb = ORB.init(args, null); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); // Use NamingContextExt instead of NamingContext. This is // part of the Interoperable naming Service. NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // resolve the Object Reference in Naming String name = "Hello"; bsImpl = BubbleSortHelper.narrow(ncRef.resolve_str(name)); //System.out.println("Obtained a handle on server object: " + helloImpl); String z = bsImpl.sort(inputFlArray); System.out.println(z); bsImpl.shutdown(); } catch (Exception e) { System.out.println("ERROR : " + e) ; e.printStackTrace(System.out); } } Once I compile it, I get the error saying args cannot be identified. I just copied ORB orb = ORB.init(args, null); code segment from a place where it was inside the main method. I know that error comes up because of I used args outside the main method. I need to know that how can I initialize ORB object here outside the main method?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25245563
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39330033

http://stackoverflow.com/q/25310005
has body: Is there any way of getting coordinates of layout (nodes, lines, bendpoints) of graphs in Zest (Eclipse)? I tried several approaches, with Draw2D which comes in package with Zest, but I don't know how to make Zest object an instance of Draw2D graph. Is this even possible?
tagged with: java
answer count: 1
score: 1
favorite count: 0
type: Question
tagged with: graph
has title: Coordinates export in Zest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26042763
tagged with: layout
tagged with: zest
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39371866
type: Comment
comment on: http://stackoverflow.com/a/25266905
type: AnswerComment
has text: true, but then you still need to pass a type argument to the generic method somehow and you can't do that, only based on the `class` object. I'll clarify that in the answer
score: 0

http://stackoverflow.com/comment/39487257
type: Comment
type: QuestionComment
has text: Just to be sure to understand correctly: you want to generate a stream from whichever Supplier has an item available? The order is more or less defines by which supplier already has a new item available?
comment on: http://stackoverflow.com/q/25311535
score: 0

http://stackoverflow.com/q/25344431
tagged with: java
has answer: http://stackoverflow.com/a/25347191
has title: ParseFile cannot be cast to android
has answer: http://stackoverflow.com/a/25344782
type: Question
tagged with: android-layout
tagged with: parse-platform
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19995007
tagged with: android
tagged with: android-activity
has body: I have created a profile creation page where users fills out a variety of information that gets recorded into parse. In this activity page a list of information from parse will be retrieved like Age, Name, Headline, and picture of many users in list (excluding current user). I have, however, experienced issues in retrieving images. Below is the error I have received from logcat: 08-16 21:53:16.401: E/AndroidRuntime(1345): FATAL EXCEPTION: main 08-16 21:53:16.401: E/AndroidRuntime(1345): Process: com.dooba.beta, PID: 1345 08-16 21:53:16.401: E/AndroidRuntime(1345): java.lang.ClassCastException: com.parse.ParseFile cannot be cast to android.provider.MediaStore$Images 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.dooba.beta.Fragment1$1.done(Fragment1.java:105) 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.parse.FindCallback.internalDone(FindCallback.java:45) 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.parse.FindCallback.internalDone(FindCallback.java:1) 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.parse.Parse$6$1.run(Parse.java:888) 08-16 21:53:16.401: E/AndroidRuntime(1345): at android.os.Handler.handleCallback(Handler.java:733) 08-16 21:53:16.401: E/AndroidRuntime(1345): at android.os.Handler.dispatchMessage(Handler.java:95) 08-16 21:53:16.401: E/AndroidRuntime(1345): at android.os.Looper.loop(Looper.java:136) 08-16 21:53:16.401: E/AndroidRuntime(1345): at android.app.ActivityThread.main(ActivityThread.java:5017) 08-16 21:53:16.401: E/AndroidRuntime(1345): at java.lang.reflect.Method.invokeNative(Native Method) 08-16 21:53:16.401: E/AndroidRuntime(1345): at java.lang.reflect.Method.invoke(Method.java:515) 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 08-16 21:53:16.401: E/AndroidRuntime(1345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 08-16 21:53:16.401: E/AndroidRuntime(1345): at dalvik.system.NativeStart.main(Native Method) Below is the acti…
score: 0
answer count: 2

http://stackoverflow.com/comment/39482077
score: 0
has text: OP wants array, not a collection. and, if you check ArrayList.add() it checked the backed array's capacity, and if exceeded, do array copy. same thing, just we don't see.
type: Comment
comment on: http://stackoverflow.com/a/25327151
type: AnswerComment

http://stackoverflow.com/comment/39358425
comment on: http://stackoverflow.com/q/25244414
type: Comment
has text: I ran the flush command, but still I am getting same error message.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39448923
type: QuestionComment
has text: sorry typing error. I'll remake. My english is bad.
comment on: http://stackoverflow.com/q/25309193
score: 0
type: Comment

http://stackoverflow.com/a/27796144
answers question: http://stackoverflow.com/q/25328669
type: Answer
score: 0
has body: I don't know english. the problem of you is next Activity is called but don't care gps is on or off because you put it out of if{...} else{..}. How to wait initiation of next activity until user enables GPS settings and get current location? I think you should move this line nextActivity(); in to: if(gps.canGetLocation()){ //.... } so the code will look like : public void getCurrentLocation(View view) { latitude=0.0; longitude=0.0; GPSTracker gps = new GPSTracker(GetCurrentLocation.this); if(gps.canGetLocation()){ latitude = gps.getLatitude(); longitude = gps.getLongitude(); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); // //launch new activity when location is detected. // nextActivity(); }else{ // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } with this code above when gps is off setting window pops up will be show up, and if user turn on gps ->they can get location -> the next activity will be launched.

http://stackoverflow.com/comment/39406049
type: Comment
type: QuestionComment
has text: You can refer to already available answer on SO. [Refer](http://stackoverflow.com/questions/4852839/appending-text-in-javas-jtextarea).
score: 0
comment on: http://stackoverflow.com/q/25286461

http://stackoverflow.com/comment/39458275
comment on: http://stackoverflow.com/q/25314324
score: 0
type: Comment
type: QuestionComment
has text: I am trying to search a text pattern in String, where I am searching for MyText, but "MyText" should not begin with any other alphabet or number or _, space and other symbols are allowed.

http://stackoverflow.com/q/25336620
has comment: http://stackoverflow.com/comment/39500543
has answer: http://stackoverflow.com/a/25336855
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39501320
has body: I need to process a string for swapping a few characters for simple encryption. Input : ABCDEFGHIJKLMNOPQRSTUVWXYZ Output: NOPQRSTUVWXYZABCDEFGHIJKLM In the above process I split the string into two and moved the first half into last half. final int mid = (xyz.length()+1) / 2; String[] spstr = { xyz.substring(0, mid), xyz.substring(mid), }; String firstMix=spstr[1]+spstr[0]; System.out.println(firstMix); Now, I need to swap the first two characters with the last two characters Input : NOPQRSTUVWXYZABCDEFGHIJKLM Output: LMPQRSTUVWXYZABCDEFGHIJKNO and also Swap the two characters immediately to the left of the middle of the string with the two characters that immediately follow them. Input : LMPQRSTUVWXYZABCDEFGHIJKNO Output : LMPQRSTUVWXABYZCDEFGHIJKNO The swap takes places between "YZAB" to "ABYZ" in the about input and output What would be the best way to swap these characters effectively? I will have convert a lot of strings in this process. The string length is not constant in this case.
tagged with: java
has title: Swap a few characters in a String in java?
has answer: http://stackoverflow.com/a/25336686
accepted answer: http://stackoverflow.com/a/25337436
has comment: http://stackoverflow.com/comment/39500567
has comment: http://stackoverflow.com/comment/39500553
tagged with: string
has comment: http://stackoverflow.com/comment/39501273
has answer: http://stackoverflow.com/a/25337220
favorite count: 0
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/39501346
has comment: http://stackoverflow.com/comment/39500549
has comment: http://stackoverflow.com/comment/39500573
possible better answer: http://stackoverflow.com/a/25336686
has comment: http://stackoverflow.com/comment/39500544
has comment: http://stackoverflow.com/comment/39500723
has comment: http://stackoverflow.com/comment/39500628
downvote count: 0
has comment: http://stackoverflow.com/comment/39500687
has comment: http://stackoverflow.com/comment/39501285
score: 4
has comment: http://stackoverflow.com/comment/39500651
answer count: 4
has answer: http://stackoverflow.com/a/25337436

http://stackoverflow.com/q/25292927
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
has body: I started experimenting a little bit with JSPs and Servlets.I have a project that lets you create an account and saves user data in Oracle db.I have created a form that allows the user to make a quick log-in,from the webapps header using email and password fields: <jsp:include page="/includes/header.jsp" /> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <link href="<c:url value='sources/css/logIn.css'/>" type="text/css" rel="stylesheet" /> <a href="<c:url value='/welcome.jsp'/>"> <img src="<c:url value='/sources/images/logo.jpg'/>"> Dont have an account? JOIN! email Address password I use post method to call the LogInServlet which looks like this: package appUsers; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import business.User; import data.UserDB; public class LogInServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String logEmailAddress = request.getParameter("logEmailAddress"); String logPassword = request.getParameter("logPassword"); String url = ""; String message =""; boolean isLogged=false; //debug message System.out.println("user input is emailaddress: " + logEmailAddress + " and password: " + logPassword); if (logEmailAddress.length()==0 || logPassword.length()==0) { message = "Please provide your email address and password"; url = "/welcome.jsp"; } User user = UserDB.selectUser(logEmailAddress); if (user!=null) { isLogged = logPassword.equals(user.getPassword()); System.out.println(isLogged); if(isLogged) { message = "You have succesfully loged in"; url = "/welcome.jsp"; } else { message = "Invalid password"; url = "/welcome.jsp"; } } else { message = "No such account"; url = "/welcome.jsp"; } HttpSession session = request.getSession(); session.setAttribute("user", user); session.setAttribute("isLogged", isLogged); request.setAttribute("message",message); RequestDispatcher dispatcher = getServletContext().…
tagged with: jsp
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/25293241
type: Question
has answer: http://stackoverflow.com/a/25293241
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39418147
has comment: http://stackoverflow.com/comment/39418316
accepted answer: http://stackoverflow.com/a/25293134
has title: Servlet works only for one jsp form
has answer: http://stackoverflow.com/a/25293134
tagged with: servlets

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/25366673
tags question: http://stackoverflow.com/q/25381052
type: Tag
tags question: http://stackoverflow.com/q/25295935
tags question: http://stackoverflow.com/q/25278772
tags question: http://stackoverflow.com/q/25238024
tags question: http://stackoverflow.com/q/25253713
tags question: http://stackoverflow.com/q/25257100
tags question: http://stackoverflow.com/q/25362982
tags question: http://stackoverflow.com/q/25244909
tag name: csv
tags question: http://stackoverflow.com/q/25276074
tags question: http://stackoverflow.com/q/25381726
tags question: http://stackoverflow.com/q/25239428
tags question: http://stackoverflow.com/q/25261618
tags question: http://stackoverflow.com/q/25277337
tags question: http://stackoverflow.com/q/25314664
tags question: http://stackoverflow.com/q/25385952
tags question: http://stackoverflow.com/q/25238703

http://stackoverflow.com/comment/39402953
type: AnswerComment
score: 0
has text: @DarkDust It's a *possible* answer. It isn't guaranteed to work. I haven't said otherwise. Steffen's answer is perfectly correct. It's a byte stream; the receiver can't make any assumptions about packetisation; and the sender can't really control it.
type: Comment
comment on: http://stackoverflow.com/a/25281661

http://stackoverflow.com/comment/39530667
type: QuestionComment
has text: Can you give us actual contents of .bat file?
score: 0
comment on: http://stackoverflow.com/q/25354081
type: Comment

http://stackoverflow.com/q/25241759
has comment: http://stackoverflow.com/comment/39323165
has answer: http://stackoverflow.com/a/25242366
has title: Java Class member variable
has answer: http://stackoverflow.com/a/25241834
has answer: http://stackoverflow.com/a/25241868
downvote count: 0
answer count: 3
upvote count: 1
tagged with: class
type: Question
type: AnsweredQuestion
tagged with: java
has body: I'm developing a research framework that needs to allow users to override core functionality. I have a core class, called TorSocket, that has a method called createCircuit() which returns a TorCircuit class. I want users of the framework to be able to override TorCircuit functions without modifying the source but because the only way to create such a class is through TorSocket.createCircuit() I'm not sure how to. I've tried as follows, in TorSocket, creating a member variable: public Class circuitClass; and then users could do: sock.circuitClass = class MyCircuitClass extends TorCircuit { ... and the TorSocket class would use circuitClass to instantiate. However, I'm getting a syntax error using the above code, at "class." What is the correct syntax for this? I cant find much online although welcome pointers. Finally, how to I then use TorSocket.circuitClass to instantiate? Many thanks Gareth
score: 1
accepted answer: http://stackoverflow.com/a/25242366
favorite count: 0
possible better answer: http://stackoverflow.com/a/25241834

http://stackoverflow.com/comment/39378384
type: Comment
type: QuestionComment
has text: This question is entirely answered in the Javadoc.
comment on: http://stackoverflow.com/q/25269690
score: 0

http://stackoverflow.com/comment/39573121
comment on: http://stackoverflow.com/q/25363403
has text: that was by mistake, i removed the outer form
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25297699
type: Answer
has body: You want to do an empirical comparison of sorting algorithms. That's good and the results are usually educational. The way empirical testing works, though, is that you decide on a bunch of things you think are worth measuring, then you run the experiment and measure them. If you decide that you care about the average-case performance of your sorting algorithm, you generate a bunch of random data and take the average of the running times. If you decide that you care about the worst-case performance, you have to do rather more work. There are N! ways to generate a permutation of length N, and that's too many when N is big. So you have to analyse the algorithms to figure out what kind of data will elicit the worst case and write a generator that generates such data. Usually you do this sort of thing because you care about how a given sorting algorithm will perform in your particular use case. So you generate lots of data typical for your use case and feed it through various sorting algorithms. Then you crunch the numbers in a manner appropriate for your setting. For sorting in particular, you can always randomly scramble the data before feeding it to the sorting algorithm. (These days you'll want to scramble it in a manner that's friendly to the cache, but that's not too tricky.) So average running time may be a reasonable thing to measure.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25295265

http://stackoverflow.com/comment/39593263
type: Comment
score: 1
type: QuestionComment
has text: It's clear that you've done some research on this, and you've explained the issue, so I won't downvote. However, "**Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow**". I think you'd be much more likely to get quick and accurate responses from the jena-users mailing list.
comment on: http://stackoverflow.com/q/25383812

http://stackoverflow.com/comment/39318754
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25239158
has text: do you want to run the same task 5 times?

http://stackoverflow.com/a/26737450
type: Answer
has body: If you use Java8 you can print only Nodes (as far i know). But you can create an ImageView that renders an image you can print. If you want to print an pdf take a look at https://www.idrsolutions.com/javafx-pdf-viewer or any other javafx PDF viewer. You can render the pdf in a Node (PDF Viewer) and print this. But if you want an Printing Dialog, I think you must build your own. But thats not realy hard. You can use all the Information given from the Printer classes for example: ObservableList&lt;PaperSource&gt; paperSources = FXCollections.observableArrayList(); paperSources.add(PaperSource.AUTOMATIC); paperSources.add(PaperSource.BOTTOM); ... PrintQuality.values() PrintSides.values() ...
score: 0
answers question: http://stackoverflow.com/q/25384442

http://stackoverflow.com/comment/39462429
has text: You should add your current output to the question.
score: 0
comment on: http://stackoverflow.com/q/25316605
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39340222
type: Comment
has text: this is what i want to see https://www.dropbox.com/s/rlgdddv7uy45omv/1.png
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25250513

http://stackoverflow.com/q/25272391
has comment: http://stackoverflow.com/comment/39380689
has title: Mockito mocking restTemplate.postForEntity
upvote count: 4
has answer: http://stackoverflow.com/a/36055065
tagged with: mocking
tagged with: mockito
has comment: http://stackoverflow.com/comment/39380629
downvote count: 0
has answer: http://stackoverflow.com/a/40757188
has answer: http://stackoverflow.com/a/25277228
tagged with: unit-testing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/74722428
tagged with: testing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/57083057
tagged with: java
has body: I am trying to mock restTemplate.postForEntity method, The actual method call is: URI myUri = new URI(myString); HttpEntity&lt;String&gt; myEntity ... String myResponse = restTemplate.postForEntity(myUri, myEntity, String.class); What I have in my test class is: Mockito.when(restTemplate.postForEntity(any(URI.class), any(HttpEntity.class), eq(String.class))).thenReturn(response); This does not work; I have tried several other permutations with no success either. Any suggestions appreciated, thanks. By this does not work I mean that the actual method is called and not the mocked method (so the desired result is not returned etc.)
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/26324875

http://stackoverflow.com/comment/39428245
type: Comment
has text: A good one but it only works in Java 7 which is not always available. And it does not answer the question: why a certain pattern is used all over the official documentation when there is a better one?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25297421

http://stackoverflow.com/q/25269088
has answer: http://stackoverflow.com/a/25269183
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25269189
accepted answer: http://stackoverflow.com/a/25269189
score: 0
has comment: http://stackoverflow.com/comment/39374436
tagged with: android
tagged with: java
has body: I'm trying to make my Android app wait a few seconds before it tries to do an if statement. I've heard some people say not to use the thread.sleep() method, so is there a better way to do it? This is what I tried to do, which doesn't work try { Thread.sleep( 1500 ); } catch( InterruptedException e ) { e.printStackTrace(); } if( playerimage.getVisibility() == View.VISIBLE ) { currentscore.setText( "Game over" ); }
has comment: http://stackoverflow.com/comment/39374285
type: Question
has title: Making an if statement wait in Java/Android
answer count: 2
possible better answer: http://stackoverflow.com/a/25269183
upvote count: 1

http://stackoverflow.com/a/25333870
has comment: http://stackoverflow.com/comment/39496653
has comment: http://stackoverflow.com/comment/39587337
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39495510
accepted answer of: http://stackoverflow.com/q/25333624
upvote count: 2
has body: I think you might consider thinking about it this way: The UI thread is where most stuff runs. It is also, occasionally, called the "main" thread, because it is, uhhh... the main thread. Unless your program is wildly complex, you probably don't need to worry about an architecture for threads. All you need to worry about is getting slow stuff off the UI thread. That's it. You don't care where they go, just not the UI thread. If you buy that, there are some nifty choices: Intent Service: If, a bit metaphorically, the methods you need to run in "background" have void return types, an intent service is the perfect solution. You communicate with it using Intents and, since it has only one thread, tasks you submit to that thread are run in order. AsyncTask: These are fraught with problems but people get a lot of programming done with them. They run in a pool of around 6 threads, but (surprise!) run in order anyway. Your own Java Executor: Use this if you need behavior similar an AsyncTask, but with more control. New thread per task: Just don't do this. Really. In any of these cases, though, you don't really care on which threads your tasks are running. You make a policy about the number of threads that makes sense on the target device and then run your slow stuff on one of them. ...and "slow" should include all I/O: databases, file system, network, etc., as well as major computation.
answers question: http://stackoverflow.com/q/25333624
type: Answer
has comment: http://stackoverflow.com/comment/39497362
has comment: http://stackoverflow.com/comment/39497381
has comment: http://stackoverflow.com/comment/39495601
score: 2

http://stackoverflow.com/q/25232318
accepted answer: http://stackoverflow.com/a/25232409
has title: method call output is confusing
has comment: http://stackoverflow.com/comment/39305419
has comment: http://stackoverflow.com/comment/39305328
has comment: http://stackoverflow.com/comment/39305413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39305479
has comment: http://stackoverflow.com/comment/39305467
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39305335
has comment: http://stackoverflow.com/comment/39305416
answer count: 1
has body: When the object reference b is instantiated in method main, the method getH() in class Beta is automatically executed. When the method getH() in class Beta is executed it's body, the println statement, is executed as well. However, when the method getH() is called using the reference variable b as a println statement argument in method main, the println statement thats included as part of the body of method getH() does not print. It seems to me that when the method getH() gets called in any case, its body (e.g. the println statement thats included as part of its body) should execute. But again, this doesn't appear to be whats occuring in this case. I'm trying to understand why (or whether my reasoning is incorrect)... class Beta { public int h = 44; public int getH() { System.out.println(" test " + h); return h; } public static void main( String[] args) { Beta b = new Beta(); System.out.println( b.getH()); } }
has comment: http://stackoverflow.com/comment/39305635
has answer: http://stackoverflow.com/a/25232409
has comment: http://stackoverflow.com/comment/39305510
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39305314
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/39305459

http://stackoverflow.com/comment/39504442
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25322679
has text: @Axel I'm curious, for what sort of application did switching from C++ to Java give you an order of magnitude performance increase?
score: 4

wear-os
tags question: http://stackoverflow.com/q/25346957
tags question: http://stackoverflow.com/q/25304787
type: Tag
tag name: wear-os

http://stackoverflow.com/comment/96376525
comment on: http://stackoverflow.com/a/54797916
score: 0
type: AnswerComment
has text: No, there is no conversion with `Date::toInstant`. Both a `java.util.Date` and a `java.time.Instant` are in UTC, by definition, always in UTC. `Date` represents a count of milliseconds since the epoch of 1970-01-01T00:00:00Z, while `Instant` is also a count since the same epoch but in finer resolution of nanoseconds.
type: Comment

fileinputstream
tags question: http://stackoverflow.com/q/25280006
tags question: http://stackoverflow.com/q/25281999
tags question: http://stackoverflow.com/q/25315822
tag name: fileinputstream
type: Tag

http://stackoverflow.com/comment/39305558
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25232441
has text: `"Try it for yourself if you don't believe me."` -- I'd love to, but in order to do that, you should first create and post your small runnable/compilable [minimal code example program](http://stackoverflow.com/help/mcve) because your snippet won't compile nor run for me. `"It's a lot of code,..."` -- and that's the beauty of the minimal example program, -- it **isn't** a lot of code, making it much easier for us to get to the meat of the issue.

http://stackoverflow.com/comment/39341572
type: Comment
comment on: http://stackoverflow.com/a/25249646
score: 0
type: AnswerComment
has text: So I guess you are talking about a router provided by your ISP, not a professional one. In this case, what happen is that your computer is sending a request to the router in order to access a remote server on port xxxx. Your router will then check if it can match the port you are asking with a well known application (ex skype). If it can, it will allow the request to flow to the target server and will also open any other required port and forward data to your computer. This is called NAT, Network Adress Translator. But this will not work with an home made app since it will not be "well" known.

http://stackoverflow.com/a/25288172
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Use two patterns - then group names can be equal. You asked for efficient and elegant. Theoretical one pattern could be more efficient, but that is irrelevant here. First: the code will be slightly longer, but better readable - a weakness of regex. That makes it better maintainable. In pseudo-code: Matcher m = firstPattern.matcher ... if (!m.matches()) { m = secondPattern.matcher ... if (!m.matches()) { continue; } } name = m.group(NAME_GROUP); ... (Everyone want to do too clever coding, but simplicity may be called for.)
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25287851
has comment: http://stackoverflow.com/comment/39693606
accepted answer of: http://stackoverflow.com/q/25287851
has comment: http://stackoverflow.com/comment/39693886

http://stackoverflow.com/q/25346993
has title: OutputStream - Access Denied in AppData/Roaming
score: 0
tagged with: java
tagged with: outputstream
has body: I'm trying to copy a file into C:\Users\user.name\AppData\Roaming.minecraft\mods using Input/Output Stream and I am getting this errpr: FileStreamsTest: java.io.FileNotFoundException: C:\Users\Ethan\AppData\Roaming.minecraft\mods (Access is denied) Whats strange is that I am able to run another bit of code that actually makes the mods folder and downloads a file into it. Here is the input/output stream: String username = System.getProperty("user.name"); File file = chooser.getSelectedFile(); String fullPath = file.getAbsolutePath(); String filename = chooser.getSelectedFile().getName(); String dest = ("C:\\Users\\" + username + "\\AppData\\Roaming\\.minecraft \\mods\\"); try { FileInputStream fis = new FileInputStream(fullPath); FileOutputStream fos = new FileOutputStream(dest); int c; while ((c = fis.read()) != -1) { fos.write(c); } fis.close(); fos.close(); } catch (FileNotFoundException e1) { System.err.println("FileStreamsTest: " + e1); } catch (IOException e1) { System.err.println("FileStreamsTest: " + e1); } And if you want to take a look, heres the code where I make the folder and download a file into it. Folder Create: String username = System.getProperty("user.name"); String part1 = "C:\\Users\\"; String part2 = "\\AppData\\Roaming\\.minecraft\\mods\\"; File theDir = new File(part1 + username + part2); // if the directory does not exist, create it if (!theDir.exists()) { System.out.println("creating directory: " + part1 + username + part2); boolean result = false; try{ theDir.mkdir(); result = true; } catch(SecurityException se){ //handle it } if(result) { System.out.println("DIR created"); } } File Download: tmi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { URL website; try { website = new URL("http://marglyph.s3.amazonaws.com /TooManyItems2014_07_15_1.7.10_Forge.jar"); ReadableByteChannel rbc = Channels.newChannel(website.openStream()); FileOutputStream fos = new FileOutputStream("C:\\Users\\" + username + "\\AppDat…
tagged with: inputstream
answer count: 1
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25347060

http://stackoverflow.com/q/25354081
upvote count: 1
accepted answer: http://stackoverflow.com/a/25354126
score: -3
tagged with: vb.net
tagged with: batch-file
downvote count: 4
type: AnsweredQuestion
tagged with: java
answer count: 1
has body: I have created a programm... this programm need to write in a .bat file This is the code My.Computer.FileSystem.WriteAllText("C:\Server\Minecraft\Start.bat", "java -Xincgc -XX:PermSize=128m -Xmx" + TextBox1.Text + "m -Xms" + TextBox1.Text + "m -jar " + TextBox3.Text + " nogui", True) But the result when i start the "Start.bat" file is: ́╗┐'java is not recognized as an internal or external command How i resolve this problem? Thanks bye
has title: VB write ´╗┐ | ́╗┐'java is not recognized as an internal or external command
favorite count: 0
has answer: http://stackoverflow.com/a/25354126
has comment: http://stackoverflow.com/comment/39530667
type: Question

http://stackoverflow.com/a/45310132
upvote count: 6
has body: import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; public class MainClass { public static void main(String[] args) { try { Callable&lt;String&gt; c = () -&gt; { System.out.println(Thread.currentThread().getName()); return "true"; }; FutureTask&lt;String&gt; ft = new FutureTask&lt;String&gt;(c); Thread t = new Thread(ft); t.start(); String result = ft.get(); System.out.println(result); } catch (Exception e) { e.printStackTrace(); } } } /* Output: Thread-0 true */
downvote count: 0
type: Answer
score: 6
answers question: http://stackoverflow.com/q/25231149

http://stackoverflow.com/q/25252951
tagged with: android-layout
has answer: http://stackoverflow.com/a/25255168
tagged with: parse-platform
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39344926
tagged with: android
score: 0
answer count: 3
has title: Issues forming and executing if statements
has body: I am having issues forming and executing my if statements below. My problem is as follow - how do I set up a condition through parse that returns the list of users based on the gender the user has selected, and based on the gender that the user is looking for. In other words, I would want to return the opposite sex of the user, unless they are looking for the same sex. I have tried to achieve this using a series of if statements, but have encountered issues along with the way such as the following error: The operator &amp;&amp; is undefined for the argument type(s) ParseQuery&lt;ParseUser&gt;, boolean Below is the if statement code if(query.whereEqualTo("Looking_Gender","Male") != null) query.whereNotEqualTo("Looking_Gender","Male"); if(query.whereEqualTo("Looking_Gender","Female") != null) query.whereNotEqualTo("Looking_Gender","Female"); if(query.whereEqualTo("Looking_Gender","Female") &amp;&amp; (query.whereEqualTo("Gender","Female") != null) query.whereEqualTo("Looking_Gender","Female"); else query.whereEqualTo("Looking_Gender","Female"); if(query.whereEqualTo("Looking_Gender","Male") &amp;&amp; (query.whereEqualTo("Gender","Male") != null) query.whereEqualTo("Looking_Gender","Male"); else query.whereEqualTo("Looking_Gender","Female"); Below is my entire code public class MatchingActivity extends Activity { private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ListView usersListView; private Button logoutButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.matching); logoutButton = (Button) findViewById(R.id.logoutButton); logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ParseUser.logOut(); Intent intent = new Intent(getApplicationContext(), LoginActivity.class); startActivity(intent); } }); setConversationsList(); } private void setConversationsList() { c…
tagged with: java
has answer: http://stackoverflow.com/a/25252997
has answer: http://stackoverflow.com/a/25253007
has comment: http://stackoverflow.com/comment/39345537
tagged with: android-activity
type: Question

http://stackoverflow.com/comment/39419056
comment on: http://stackoverflow.com/q/25293309
score: 1
has text: seems like it should be pretty easy to test this...
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39398700
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25281200
has text: Hmm, you have to put the code in the doInBackground method. You can then let onPostExecute take a string as an argument, which is the downloaded JSON string (which you return from doInBackground) :)
score: 0

http://stackoverflow.com/comment/39519944
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25348108
has text: Alternatively, configure your browser to load local pictures: http://stackoverflow.com/questions/192080/firefox-links-to-local-or-network-pages-do-not-work
type: Comment

http://stackoverflow.com/a/25277747
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25247737
answers question: http://stackoverflow.com/q/25247737
type: Answer
has body: You can achieve whatever you want to do using teamcity. However what you actually need is a monitoring service like nagios/icinga . We use both tools in our team and I have normally found that the nagios/icinga are much quicker to trigger can be run repeatedly at very quick intervals(2-3 sec in some cases) can be setup to run event handlers on failed tasks also. The only problem I see in teamcity is that you can setup build steps to run anytime/"previous step succeeded" but there is no hook to run a build step "only if the previous step failed" Also teamcity's revenue model is agent based. So you are constrained on the max number of agents you can run at any given time. There is no such constraint on monitoring systems. Infact they are free
has comment: http://stackoverflow.com/comment/39406838
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39434957
type: Comment
type: AnswerComment
has text: I meant the top part of setActionListener
comment on: http://stackoverflow.com/a/25301605
score: 0

http://stackoverflow.com/q/25387576
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/25391000
tagged with: java
has comment: http://stackoverflow.com/comment/39596018
has title: getting excel from spring rest web service to download
has body: Can I produce a excel from spring rest. Could you provide sample code: I can see we can do with http://www.mkyong.com/webservices/jax-rs/download-excel-file-from-jax-rs/ . Not sure what code need to write inside: @RequestMapping(value = "/getexcel", method = RequestMethod.POST, produces="application/vnd.ms-excel") public Response getFile() { } Thanks rAm
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39604571
tagged with: spring
tagged with: excel
type: Question

http://stackoverflow.com/comment/39537000
comment on: http://stackoverflow.com/q/25357165
type: Comment
score: 0
has text: @AndrewThompson been there done that
type: QuestionComment

http://stackoverflow.com/q/25297412
has comment: http://stackoverflow.com/comment/39427277
upvote count: 3
score: 3
tagged with: java
answer count: 3
downvote count: 0
tagged with: collections
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25297511
tagged with: compare
has body: The output of the compare() method in the Comparator interface is either -1,0, or 1. This then gets passed to the Collections.sort() method which can be used to sort a list in a custom way. What does sort() do with the result of the compare() method though? (the -1,0 or 1) I think what I am most confused about is that there are three outputs of compare() negative, positive or 0). But why don't the algorithms only need two of these? Can't the action when a=b be the same as when a>b or when a&#60;b? and so don't we only really need two outputs? (ei. positive and negative) eg. comparing two numbers a and b, if a&#60;b or a=b then take the a (eg. compare() returns -1), and if a>b then take b (compare() return +1). Why does the algorithm need to differentiate between a&#60;b and a=b? eg. class ReverseAlphabeticalComparator implements Comparator&lt;Integer&gt; { @Override public int compare(Integer i1, Integer i2) { if(i1 &gt; i2) { return 1; } else if(i1 &lt; i2) { return -1; } return 0; } class App { public static void main(String[] args) { List&lt;Integer&gt; animals = new ArrayList&lt;Integer&gt;(); animals.add(6); animals.add(2); animals.add(4); animals.add(7); animals.add(8); animals.add(3); Collections.sort(numbers, new ReverseNumericalComparator()); for(String numbers: numbers) { System.out.println(numbers); //Prints numbers in reverse eg. 8,7,6,4,3,2 } } }
tagged with: sorting
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25297456
has answer: http://stackoverflow.com/a/25297438
has title: How does 'Collections.sort()' use the result of the 'compare()' method?
tagged with: comparator

http://stackoverflow.com/a/25359507
has body: I want to have access to certain method/fields of the real class If you want to access method/fields of the real class then use different overloaded methods class GenericClassUtil { public static void workWithRealTypeAttr(Bird objectClass) { // call a method specific to Bird (Easel) } public static void workWithRealTypeAttr(Mammal objectClass) { // call a method specific to Mammal (Cat, Dog etc) } } You can groups classes as Mammal, Bird and make the method more generic. You can group classes based on behavior as per design pattern. class GenericClassUtil { public static void workWithRealTypeAttr(Flyable objectClass) { // call a method specific to Flyable } public static void workWithRealTypeAttr(Swimmable objectClass) { // call a method specific to Swimmable } } interface Swimmable { public void swim() } interface Flyable { public void fly() } It's better explained in Head First Design Pattern
has comment: http://stackoverflow.com/comment/39540465
type: Answer
answers question: http://stackoverflow.com/q/25359358
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25325944
has comment: http://stackoverflow.com/comment/39479775
tagged with: java
has answer: http://stackoverflow.com/a/25326169
upvote count: 1
has comment: http://stackoverflow.com/comment/39479694
linked to: http://stackoverflow.com/q/5126082
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25325985
has comment: http://stackoverflow.com/comment/39479819
has comment: http://stackoverflow.com/comment/39479678
has title: Write an Chair class
possible better answer: http://stackoverflow.com/a/25325985
has comment: http://stackoverflow.com/comment/39479835
has comment: http://stackoverflow.com/comment/39480077
has body: Write an OfficeChair class. have two instance variables have one static int that is used to keep track of the number of OfficeChairs have a default constructor have an overloaded constructor – with both data members as input both constructors need to add to the static int Write two lines of code that show how to make an instance of the OfficeChair – one using the default constructor and one using the overloaded constructor. You do not need to write any getters/setters. I need know how would you write two lines of code to make an instance. public class OfficeChair { public string function chairSwivel; private int chairSoftness; static int chairCount = 0; } OfficeChair() { chairSwivel = “Yes”; chairSoftness = “Not Given”; chairCount = “Not Given”; } public OfficeChair( string Str, int num1, static int num2) { chairSwivel = str chairSoftness = num1 chairCount = num2 } } public Class officeChairs { public static void main(String args[]) { Chair officeChair = new OfficeChair(Yes, Very Soft, 8)
downvote count: 6
type: AnsweredQuestion
score: -5
answer count: 2
accepted answer: http://stackoverflow.com/a/25326169

http://stackoverflow.com/a/25301635
has comment: http://stackoverflow.com/comment/39435024
type: Answer
has comment: http://stackoverflow.com/comment/39435993
has comment: http://stackoverflow.com/comment/39435868
has comment: http://stackoverflow.com/comment/39434959
downvote count: 0
has comment: http://stackoverflow.com/comment/39435243
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39436399
has comment: http://stackoverflow.com/comment/39437330
has comment: http://stackoverflow.com/comment/39436447
has body: Because in java all fields (object variables) with primitive type always has default value. For boolean it is always false, what is interpreted as 0 for numeric type. If you want to store there null you should change its field's type to Boolean: private Boolean isMultiple; UPD: you should also remove DEFAULT false for is_multiple_activation table field from create-table-sql code, because it means, that this value is always false by default, i.e. it always has 0 value by default.
has comment: http://stackoverflow.com/comment/39434941
has comment: http://stackoverflow.com/comment/39435307
answers question: http://stackoverflow.com/q/25301593
has comment: http://stackoverflow.com/comment/39435403
has comment: http://stackoverflow.com/comment/39435087

http://stackoverflow.com/comment/85806301
type: Comment
score: 4
type: AnswerComment
has text: What about the case when I want to use many columns ? - I believe `@Query()` is a must, right ? With that approach I would have to make `or` that isn't actually a well suited solution for that case:`findByField1OrField2Containg(String phraseForField1, String phraseForField2)`
comment on: http://stackoverflow.com/a/35454524

http://stackoverflow.com/q/25319104
has answer: http://stackoverflow.com/a/25320374
accepted answer: http://stackoverflow.com/a/25320374
tagged with: actionlistener
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/39468211
has answer: http://stackoverflow.com/a/25319257
has comment: http://stackoverflow.com/comment/39469224
has comment: http://stackoverflow.com/comment/39468115
tagged with: jbutton
has body: I'm working on a calculator GUI, and I need help coding a backspace and clear button. Below is the code, and names[0][3] is the backspace character, names[0][4] is to clear the entire area. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.BadLocationException; import javax.swing.text.Document; public class CalcGUI extends JFrame { private Container contents; private final JPanel entryPanel, buttonPanel; private final JTextArea entryTA; private final JButton equalJB; private JButton [][] buttons; private final String [][] names = {{"7", "8", "9", "\u2190", "C"}, {"4", "5", "6", "+", "-"}, {"1", "2", "3", "*", "/"}, {"0", ".", "(", ")", "^"}}; public CalcGUI() { super("Calculator"); contents = getContentPane(); contents.setLayout(new BorderLayout()); buttons = new JButton [4][5]; buttonPanel = new JPanel(new GridLayout(4, 5)); ButtonHandler bh = new ButtonHandler(); for (int i = 0; i &lt; names.length; i++) { for (int j = 0; j &lt; names[i].length; j++) { buttons[i][j] = new JButton(names[i][j]); buttons[i][j].addActionListener(bh); buttonPanel.add(buttons[i][j]); } } contents.add(buttonPanel, BorderLayout.CENTER); entryTA = new JTextArea(3, 1); entryTA.setLineWrap(true); entryPanel = new JPanel(new GridLayout(1, 1)); entryPanel.add(entryTA); contents.add(entryPanel, BorderLayout.NORTH); equalJB = new JButton("="); equalJB.addActionListener(bh); contents.add(equalJB, BorderLayout.SOUTH); setSize(300, 300); setVisible(true); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private class ButtonHandler implements ActionListener { @Override public void actionPerformed (ActionEvent ae) { for (int i = 0; i &lt; names.length; i++) { for (int j = 0; j &lt; names[i].length; j++) { if (ae.getSource() == buttons[i][j]) { if (ae.getSource() != buttons[0][3] &amp;&amp; ae.getSource() != buttons[0][4]) { entryTA.append(names[i][j]); } } //backspace else if (ae.getSource() == buttons[0][3]) { try { Document doc =…
type: AnsweredQuestion
score: 0
answer count: 2
has title: JTextArea Backspace and Clear
tagged with: java
tagged with: user-interface
has comment: http://stackoverflow.com/comment/39485370
type: Question
possible better answer: http://stackoverflow.com/a/25319257

http://stackoverflow.com/a/25240628
type: Answer
has body: You'd rather use Document doc = Jsoup.connect("http://www.imdb.com").get(); for a remote website.
score: 0
answers question: http://stackoverflow.com/q/25240594

http://stackoverflow.com/q/25376841
has comment: http://stackoverflow.com/comment/39574930
score: 0
has answer: http://stackoverflow.com/a/25380012
answer count: 2
tagged with: cxf
has body: In our project, we have implemented SOAP webservices using Apache CXF framework. Clients used to request the server for some command execution. The request consists of host, port and the protocol used for connection. If the client uses a HTTPS configured port number and specify the protocol as HTTP, then we get a connection refused - socket exception as expected. But, I need to throw a proper error message like "Unable to connect to host "XYZ" with port "ABC" using http protocol". For this, I need to get the configured http and https port numbers from tomcat server.xml file at runtime and then compare it with my request parameters. Anyone, please help me out on how to retrieve that?
has title: How to get the configured HTTP and HTTPS port numbers in server.xml from Java code at runtime
tagged with: java
tagged with: apache
tagged with: web-services
tagged with: tomcat
has answer: http://stackoverflow.com/a/41362935
type: Question
linked to: http://stackoverflow.com/q/3867197
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39573930

http://stackoverflow.com/a/25270257
downvote count: 0
answers question: http://stackoverflow.com/q/25270185
score: 1
upvote count: 1
has body: An interface should be used to describe behaviour. That is not the case on Participate or any of these classes, that have no methods. Use an interface when you want to force the classes that implement it to have a particular set of methods. However, interfaces are a concept that only makes sense, when you have an application developed by different teams at different stages, or using certain frameworks. If you're going to develop an application by yourself on a single session, without using any framework, probably it makes no sense to use them. Unless you want to do it as an exercise.
type: Answer
has comment: http://stackoverflow.com/comment/39377955

http://stackoverflow.com/comment/39350210
type: Comment
type: QuestionComment
score: 0
has text: Yes, this is just not how android works. Android is event driven, so you really should turn your thinking inside out and write code which advances state on each event. Alternatively you can run your loop on a background thread and wait for the UI thread to signal that events have occurred.
comment on: http://stackoverflow.com/q/25254231

http://stackoverflow.com/q/25337233
has body: Context: String comparison using equals with double quotes and single quotes I tried checking the value of the field "parentId" (String) of one of my business objects as below: System.out.println("Status 1 = "+myBusObj.getParentId().equals("0")); System.out.println("Status 2 = "+myBusObj.getParentId().equals('0')); I get the below output: Status 1 = true //where parentId was of value 0 (String) Status 2 = false //where parentId was of value 0 (String) Problem: Why Status 1 is true but Status 2 is false?
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25337276
possible better answer: http://stackoverflow.com/a/25337276
linked to: http://stackoverflow.com/q/10430043
tagged with: string
type: Question
has title: Difference between .equals ("0") and .equals('0')
has comment: http://stackoverflow.com/comment/39501588
tagged with: equals
has answer: http://stackoverflow.com/a/25337252
accepted answer: http://stackoverflow.com/a/25337252
has answer: http://stackoverflow.com/a/25348809

http://stackoverflow.com/comment/39559829
type: Comment
comment on: http://stackoverflow.com/q/25369541
type: QuestionComment
score: 0
has text: I need it because of coverage. I need 100% of coverage. But Cobertura, Jacoco, and my InelliJ IDEA tools say that class in uncovered.

http://stackoverflow.com/comment/39423689
type: Comment
comment on: http://stackoverflow.com/a/25295334
has text: @Celeritas By creating a partially sorted set of data. Perhaps writing a short script to swap a few cells in a sorted array to create a bit of mixing would do the trick.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25342089
has comment: http://stackoverflow.com/comment/39511838
has comment: http://stackoverflow.com/comment/39510608
tagged with: multithreading
downvote count: 0
tagged with: process
has title: Processes vs threads in Java
tagged with: optimization
has comment: http://stackoverflow.com/comment/39510041
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25342139
possible better answer: http://stackoverflow.com/a/25364428
has comment: http://stackoverflow.com/comment/39511962
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25342139
has answer: http://stackoverflow.com/a/25364428
favorite count: 0
type: Question
has body: In the questions I have read we suggest to use threads over processes because threads are faster. I decided go with threads for my program that edit articles in a category in Wikipedia. The program get the list of articles to edit and then divide the articles between 10 threads. By this I do 6-7 edits per minute and it's the same speed as if I haven't used threads. When I launch multiple instance of my program and give for each instance a category to process I see that each process can do 6-7 edits per minute (I tested that with 5 processes). Why processes are much faster in my case? and why the threads haven't changed anything? The code (Not the complete just to have an idea) : public static wiki = new Wiki(); public process(){ String[] articles = wiki.getArticles(category); for(int i=0; i&lt; 10; i++){ String[] part = getPart(articles, i, 10); MyThread t = new MyThread(part); list.add(t); } ExecutorService.invokeAll(list); //I'm not sure about the syntax of the function } public class MyThread extends Thread { public String[] articles ; public MyThread(String[] articles) { this.articles = articles; } public void run() { //some logic wiki.edit(...) } }
answer count: 2
score: 5

http://stackoverflow.com/q/25374641
has title: How to write a java program to make a "cloud" of random dots?
answer count: 1
has comment: http://stackoverflow.com/comment/39569813
tagged with: applet
has answer: http://stackoverflow.com/a/25374705
accepted answer: http://stackoverflow.com/a/25374705
type: Question
has comment: http://stackoverflow.com/comment/39569920
has comment: http://stackoverflow.com/comment/39569822
has comment: http://stackoverflow.com/comment/39585735
has body: I'm having a lot of trouble with this one program and I was wondering if anyone could tell me what I'm doing wrong... Here's the prompt: Implement a class Cloud that contains an array list of Point2D.Double objects. Support methods public void add(Point2D.Double aPoint) public void draw (Graphics2D g2) Draw each point as a tiny circle. Write a graphical application that draws a cloud of 100 random points. Here's what I have, but it won't actually do anything, I'm just really confused and I could use any help! Cloud.java: import java.awt.*; import java.util.*; import java.awt.geom.Point2D; import java.awt.geom.Ellipse2D; public class Cloud { public void draw(Graphics2D g) { Random rand = new Random(); Graphics2D g2 = (Graphics2D) g; for (int i=0;i&lt;=20;i++) { this.add(new Point2D.Double(rand.nextInt(400)+1,rand.nextInt(300)+1)); } for (int i=0; i&lt;list.size();i++) { Ellipse2D.Double circle = new Ellipse2D.Double(list.get(i).getX()-5,list.get(i).getY()-5, 10, 10); g2.draw(circle); } } public void add(Point2D.Double aPoint) { list.add(aPoint); } private ArrayList&lt;Point2D.Double&gt; list = new ArrayList&lt;Point2D.Double&gt;(); } CloudTest.java: import java.applet.Applet; import java.awt.*; import java.awt.geom.Point2D; import java.util.*; public class CloudTest extends Applet { public void paint(Graphics2D g) { Graphics2D g1 = (Graphics2D) g; Cloud myCloud = new Cloud(); myCloud.draw(g1); } }
has comment: http://stackoverflow.com/comment/39569913
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/39578709
score: 0
has text: @Chris K: I reworded it to avoid the word “inline”.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25379308

http://stackoverflow.com/comment/39382131
type: Comment
has text: +1 and thank you for taking the time to think about my question. I resolved the error by simply creating the table and fields that were being specified in the error messages.
comment on: http://stackoverflow.com/a/25268134
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39586476
comment on: http://stackoverflow.com/q/25382930
has text: I just thought may be this is the difference since I don't have your described behavior in Intellij 13.1.4.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39368965
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25246026
type: AnswerComment
has text: Hmm, using @XmlSeeAlso may help, but it isn't essential for creating a list composed from objects of various subclasses. This annotation indeed extends the scope for creating the JAXBContext, but if the package path or class list in the JAXBContext.newInstance call already includes those classes, it can be omitted. Not seeing the class containing the list and how the marshaller is created, I can't say what *really* was the cause of the original problem.

http://stackoverflow.com/a/26414893
has body: And does redeployment has anything to do with my pictures being gone? It does. When you redeployed your application, GAS removed the application directory at ${GAS_INST_DIR}\domains\${YOUR_DOMAIN_NAME}\application{YOUR_APP_BUNDLE_NAME}. Once you decided to store you images there, they are gone after the redeployment. How and where to place these images The most straightforward way is to put your files somewhere outside application server folder could be a solution but I would say just half a solution. Let's assume you store your pictures in a local folder /var/application/data. Later you decided to cluster your application. Now you are again in trouble. Each instance has its own /var/application/data directory and as a rule you do not know what node will handle a request for storing an image. What are conventions, practices for this, and how is this generally done? I would say it is you who decides what way to go according to the needs of your application. I will list the ways that are the most obvious. All have their own strength and weaknesses. You can put the images in a local folder. The strong side is simplicity. Once you decide to cluster, you would have to remake this approach. If you go this way the most general approach would be to create a servlet that loads your images and in this case your src= will point to the servlet. Did not find a good example right away, but I think this example will give you an idea how to do it. The only thing I would suggest using finally block or if you use jdk 1.7 the try-with-resources for closing stream. Another thing you will need to pass file name as a parameter to the servlet. Store images in database. It could be RDBMS or noSql. Down side is that not all RDBMSs work efficiently with binary data. Again src could point to a servlet that loads images from the DB. Here you should design your DB accordingly so you can retrieve images effectively. I would not choose this approach, but this is just a personal opinion. Cannot sa…
answers question: http://stackoverflow.com/q/25234088
type: Answer
score: 0

http://stackoverflow.com/q/25324170
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25324382
answer count: 3
accepted answer: http://stackoverflow.com/a/25324374
has answer: http://stackoverflow.com/a/25324382
has answer: http://stackoverflow.com/a/25324374
favorite count: 0
has comment: http://stackoverflow.com/comment/39476434
has title: try and Finally giving exception with no return statement , but there is no exception when return statement is written in method
tagged with: return
has comment: http://stackoverflow.com/comment/39476513
type: Question
upvote count: 2
tagged with: try-finally
has answer: http://stackoverflow.com/a/25324462
has body: Please explain why Exception comes in first program but not in second program. 1) without return statement in read method class Example { public static void read() { try { int i = 9/0; } finally { System.out.println("This proogram is giving exception"); } } public static void main(String[] fel) { read(); } } 2)with return statement in read method class Example { public static void read() { try { int i = 9/0; } finally { System.out.println("This proogram is not giving exception"); return; } } public static void main(String[] fel) { read(); } }
has comment: http://stackoverflow.com/comment/39476639
has comment: http://stackoverflow.com/comment/39476430
score: -2
downvote count: 4

http://stackoverflow.com/a/25301680
score: 0
has body: Correct you locationURI as locationURI="menu:file?after=additions".
type: Answer
accepted answer of: http://stackoverflow.com/q/25300098
answers question: http://stackoverflow.com/q/25300098
type: AcceptedAnswer

http://stackoverflow.com/comment/39534906
comment on: http://stackoverflow.com/q/25356118
score: 1
type: Comment
type: QuestionComment
has text: do you know other way to solve this? without using a other library or frameworks? Thanks.

image
tags question: http://stackoverflow.com/q/25338127
tags question: http://stackoverflow.com/q/25327229
tags question: http://stackoverflow.com/q/25251193
tags question: http://stackoverflow.com/q/25338153
tags question: http://stackoverflow.com/q/25282873
tags question: http://stackoverflow.com/q/25285681
tags question: http://stackoverflow.com/q/25244799
tags question: http://stackoverflow.com/q/25382586
tags question: http://stackoverflow.com/q/25230909
tags question: http://stackoverflow.com/q/25256861
tags question: http://stackoverflow.com/q/25315197
tags question: http://stackoverflow.com/q/25361877
tags question: http://stackoverflow.com/q/25360131
tags question: http://stackoverflow.com/q/25317024
tags question: http://stackoverflow.com/q/25345172
tag name: image
tags question: http://stackoverflow.com/q/25301904
tags question: http://stackoverflow.com/q/25318380
tags question: http://stackoverflow.com/q/25257513
tags question: http://stackoverflow.com/q/25256725
tags question: http://stackoverflow.com/q/25314120
tags question: http://stackoverflow.com/q/25277567
tags question: http://stackoverflow.com/q/25246134
tags question: http://stackoverflow.com/q/25382093
tags question: http://stackoverflow.com/q/25269247
type: Tag
tags question: http://stackoverflow.com/q/25305280
tags question: http://stackoverflow.com/q/25368499
tags question: http://stackoverflow.com/q/25282104

tomcat
tags question: http://stackoverflow.com/q/25250025
tags question: http://stackoverflow.com/q/25256758
tags question: http://stackoverflow.com/q/25353584
tags question: http://stackoverflow.com/q/25299611
tags question: http://stackoverflow.com/q/25352081
tags question: http://stackoverflow.com/q/25243675
tags question: http://stackoverflow.com/q/25268716
tags question: http://stackoverflow.com/q/25292927
tags question: http://stackoverflow.com/q/25347360
tags question: http://stackoverflow.com/q/25332844
tags question: http://stackoverflow.com/q/25258083
tags question: http://stackoverflow.com/q/25256573
tags question: http://stackoverflow.com/q/25370785
tags question: http://stackoverflow.com/q/25306399
tags question: http://stackoverflow.com/q/25310828
tags question: http://stackoverflow.com/q/25359480
tags question: http://stackoverflow.com/q/25281549
tags question: http://stackoverflow.com/q/25385339
tags question: http://stackoverflow.com/q/25376630
tags question: http://stackoverflow.com/q/25268086
tags question: http://stackoverflow.com/q/25265629
type: Tag
tags question: http://stackoverflow.com/q/25375017
tags question: http://stackoverflow.com/q/25239944
tags question: http://stackoverflow.com/q/25261658
tags question: http://stackoverflow.com/q/25282874
tags question: http://stackoverflow.com/q/25253972
tags question: http://stackoverflow.com/q/25378429
tags question: http://stackoverflow.com/q/25272664
tags question: http://stackoverflow.com/q/25250352
tags question: http://stackoverflow.com/q/25288602
tags question: http://stackoverflow.com/q/25244041
tags question: http://stackoverflow.com/q/25263391
tags question: http://stackoverflow.com/q/25298537
tags question: http://stackoverflow.com/q/25307340
tags question: http://stackoverflow.com/q/25293886
tags question: http://stackoverflow.com/q/25315099
tags question: http://stackoverflow.com/q/25362984
tags question: http://stackoverflow.com/q/25307949
tags question: http://stackoverflow.com/q/25347593
tags question: http://stackoverflow.com/q/25328847
tags question: http://stackoverflow.com/q/25316012
tags question: http://stackoverflow.com/q/25279729
tags question: http://stackoverflow.com/q/25282442
tags question: http://stackoverflow.com/q/25338592
tags question: http://stackoverflow.com/q/25385351
tags question: http://stackoverflow.com/q/25253499
tags question: http://stackoverflow.com/q/25258153
tag name: tomcat
tags question: http://stackoverflow.com/q/25236036
tags question: http://stackoverflow.com/q/25356703
tags question: http://stackoverflow.com/q/25291057
tags question: http://stackoverflow.com/q/25275623
tags question: http://stackoverflow.com/q/25300103
tags question: http://stackoverflow.com/q/25375473
tags question: http://stackoverflow.com/q/25371200
tags question: http://stackoverflow.com/q/25319254
tags question: http://stackoverflow.com/q/25253711
tags question: http://stackoverflow.com/q/25242984
tags question: http://stackoverflow.com/q/25284532
tags question: http://stackoverflow.com/q/25313589
tags question: http://stackoverflow.com/q/25376841
tags question: http://stackoverflow.com/q/25305655
tags question: http://stackoverflow.com/q/25267369

http://stackoverflow.com/comment/39329705
has text: the corresponding tags even if they are empty like class-path and so
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25245021

linux
tags question: http://stackoverflow.com/q/25246007
tags question: http://stackoverflow.com/q/25281683
tags question: http://stackoverflow.com/q/25259785
tags question: http://stackoverflow.com/q/25379814
tags question: http://stackoverflow.com/q/25336123
tag name: linux
tags question: http://stackoverflow.com/q/25277127
tags question: http://stackoverflow.com/q/25312635
tags question: http://stackoverflow.com/q/25330071
tags question: http://stackoverflow.com/q/25389354
tags question: http://stackoverflow.com/q/25268716
tags question: http://stackoverflow.com/q/25309101
tags question: http://stackoverflow.com/q/25307720
tags question: http://stackoverflow.com/q/25257077
tags question: http://stackoverflow.com/q/25352557
tags question: http://stackoverflow.com/q/25263027
tags question: http://stackoverflow.com/q/25325492
tags question: http://stackoverflow.com/q/25282556
type: Tag
tags question: http://stackoverflow.com/q/25316103
tags question: http://stackoverflow.com/q/25341579
tags question: http://stackoverflow.com/q/25324308
tags question: http://stackoverflow.com/q/25289482
tags question: http://stackoverflow.com/q/25389290
tags question: http://stackoverflow.com/q/25339446
tags question: http://stackoverflow.com/q/25301528
tags question: http://stackoverflow.com/q/25332064
tags question: http://stackoverflow.com/q/25304103
tags question: http://stackoverflow.com/q/25255854

http://stackoverflow.com/comment/39463809
score: 0
type: Comment
type: QuestionComment
has text: @isim I have a similar question. Are you willing to help me with it? Here is the link: http://stackoverflow.com/questions/25316761/duplicate-entry-string1-string2-for-key-primary
comment on: http://stackoverflow.com/q/25295695

generator
type: Tag
tags question: http://stackoverflow.com/q/25295870
tag name: generator
tags question: http://stackoverflow.com/q/25298642

http://stackoverflow.com/comment/39644971
score: 0
type: Comment
type: QuestionComment
has text: I just want to know how to make it. But for example Battlefield 4, has lots of different guns.I want to make a ArrayList that will hold any gun name. So p90 for example(only the name not the weapon itself),if i write that name in setName or something, it automatically stores it in the ArrayList. And to be honest i have no idea how to make it, and I am a beginner so far I've learned how to make arraylist, add object and that stuff, making simple GUI's, polymorphisme, and how to use other Objects/Constructors. So please keep it to a simple answer ;) but thanks for your help.
comment on: http://stackoverflow.com/q/25386661

playframework-2.3
tags question: http://stackoverflow.com/q/25286904
tags question: http://stackoverflow.com/q/25315528
tags question: http://stackoverflow.com/q/25365707
type: Tag
tags question: http://stackoverflow.com/q/25340400
tag name: playframework-2.3

http://stackoverflow.com/comment/39546034
has text: Irrelevant to what part exactly? @EJP
score: 0
comment on: http://stackoverflow.com/q/25361420
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25374363
type: Answer
accepted answer of: http://stackoverflow.com/q/25373037
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25373037
type: AcceptedAnswer
has body: you should try this code JFrame frame = new JFrame("JList Test"); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); String[] selections = {"Java", "C++", "C", "Scala", "JavaScript"}; JList list = new JList(selections); frame.add(new JScrollPane(list)); frame.pack(); frame.setVisible(true); MouseListener mouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { if (mouseEvent.getClickCount() == 1) { int index = list.locationToIndex(mouseEvent.getPoint()); if (index &gt;= 0) { Object obj = list.getModel().getElementAt(index); JOptionPane.showMessageDialog(null, obj); } } } }; list.addMouseListener(mouseListener); }
downvote count: 0

http://stackoverflow.com/comment/39444958
type: Comment
comment on: http://stackoverflow.com/a/25285171
type: AnswerComment
has text: Sorry I don't understand? If a value provided is null it will throw an illegal argument exception.
score: 0

http://stackoverflow.com/comment/39447108
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25308389
type: Comment
has text: I have added the latest version of json.jar file only. http://search.maven.org/remotecontent?filepath=org/codeartisans/org.json/20131017/org.json-20131017.jar

http://stackoverflow.com/comment/39450599
comment on: http://stackoverflow.com/q/25310197
type: Comment
type: QuestionComment
has text: @AndreiStefan its covering the packages
score: 0

http://stackoverflow.com/q/25383777
has body: I would like to ask how does IBinder support as a base interface for a remotable object. Hence, how is its functionality applicable for a CountDownTimer in the following code? public class BackgroundProcessingService extends Service { @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub timer = new CountDownTimer(5 *60 * 1000, 1000) { public void onTick(long millisUntilFinished) { //Some code //inactivity = true; timer.start(); Log.v("Timer::", "Started"); } public void onFinish() { //Logout Intent intent = new Intent(LoginActivity.this,HomePageActivity.class); startActivity(intent); //inactivity = false; timer.cancel(); Log.v("Timer::", "Stoped"); } }; return null; } }
has comment: http://stackoverflow.com/comment/39612634
has comment: http://stackoverflow.com/comment/39611833
has comment: http://stackoverflow.com/comment/39612695
type: Question
has comment: http://stackoverflow.com/comment/39610448
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39586523
downvote count: 0
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39594812
has comment: http://stackoverflow.com/comment/39594270
has comment: http://stackoverflow.com/comment/39612440
tagged with: interface
score: 1
has title: IBinder in Android Subclass
has comment: http://stackoverflow.com/comment/39612267
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39345405
score: 0
type: AnswerComment
has text: Imageview imageview = null; when your fragment or activity finished.
type: Comment
comment on: http://stackoverflow.com/a/25252892

http://stackoverflow.com/a/25381325
type: Answer
has comment: http://stackoverflow.com/comment/39581676
has comment: http://stackoverflow.com/comment/39582274
has comment: http://stackoverflow.com/comment/39582326
has body: Here are methods which are explained Language recognition in Java What you could do is just check if the string is in English, if not it should be Persian. TextCat: http://textcat.sourceforge.net/
has comment: http://stackoverflow.com/comment/39581796
score: 0
answers question: http://stackoverflow.com/q/25381262

http://stackoverflow.com/a/25342059
has comment: http://stackoverflow.com/comment/50673326
has comment: http://stackoverflow.com/comment/39521438
answers question: http://stackoverflow.com/q/25341980
type: Answer
score: 0
has body: You will need to allow the iframe element and source attribute to your Html policy. You can do it like the following example modified from the java doc // Define the policy. Function&lt;HtmlStreamEventReceiver, HtmlSanitizer.Policy&gt; policy = new HtmlPolicyBuilder() .allowElements("a", "p", "iframe") .allowAttributes("href").onElements("a") .allowAttributes("source").onElements("iframe") .toFactory(); // Sanitize your output. HtmlSanitizer.sanitize(myHtml, policy.apply(myHtmlStreamRenderer));
has comment: http://stackoverflow.com/comment/39521449

http://stackoverflow.com/q/25323226
linked to: http://stackoverflow.com/q/10761696
type: Question
linked to: http://stackoverflow.com/q/20857256
tagged with: android
tagged with: java
has title: Why does my Emulator not work?
tagged with: eclipse
has body: I am using Eclipse 4.4 and for some reason whenever I try to start an emulator I get the following errors: Starting emulator for AVD 'doridX' emulator: Failed to open the HAX device! HAX is not working and emulator runs in emulation mode emulator: Open HAX device failed Does anyone know what causes this and how I can fix it? I have currently tried: Deleting the virtual device and recreating it. Closing Eclipse and restarting the programme. Closing all open emulators and try launching it again. Uninstalling all packages related that were installed on Eclipse and reinstalling them. The settings for my AVD are: AVD name: droidX Device: Nexus 5 (4.95", 1080 x 1920: xxhdpi) Target: Android 4.4.2 - API Level 19 CPU/ABI: Intel Atom (x86) Keyboard: Hardware keyboard present Skin: No skin Front Camera: None Back Camera: None Memory Options: RAM: 768 VM Heap: 64 Internal Storage: 50 MiB SD Card: 50 MiB Emulation Options: None
has comment: http://stackoverflow.com/comment/39479579
has comment: http://stackoverflow.com/comment/39474746
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39474806
accepted answer: http://stackoverflow.com/a/25324528
answer count: 1
tagged with: android-emulator
has answer: http://stackoverflow.com/a/25324528

http://stackoverflow.com/q/25377696
possible better answer: http://stackoverflow.com/a/25377742
has comment: http://stackoverflow.com/comment/39575293
score: -1
has title: Ignore string using regex
tagged with: regex
has comment: http://stackoverflow.com/comment/39575549
has answer: http://stackoverflow.com/a/25377742
has answer: http://stackoverflow.com/a/25377745
has comment: http://stackoverflow.com/comment/39575337
has body: I'm having list of strings like below core.advsearch.smartshow.event tpymt.pay.distaxdtls.event I know that I can match this pattern using Pattern.compile(".*.\\s*.\\.event"); But I want to eliminate .*.event and replace with .xml How to do that with regex? My Expected output is : core.advsearch.xml tpymt.pay.xml PS: these strings are dynamic
has answer: http://stackoverflow.com/a/25377932
has comment: http://stackoverflow.com/comment/39575379
answer count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/39575590
has comment: http://stackoverflow.com/comment/39575556
accepted answer: http://stackoverflow.com/a/25377932
upvote count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39575682
tagged with: java

http://stackoverflow.com/comment/39532963
score: 0
comment on: http://stackoverflow.com/q/25355299
type: Comment
has text: post the one that has a fragment layout?
type: QuestionComment

http://stackoverflow.com/comment/39401732
type: QuestionComment
comment on: http://stackoverflow.com/q/25283316
score: 0
has text: What is the concrete problem you need help with?
type: Comment

http://stackoverflow.com/a/25360720
has body: Use MouseInfo.getPointerInfo().getLocation() to get the current mouse position at any time.
has comment: http://stackoverflow.com/comment/39542966
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25360677
answers question: http://stackoverflow.com/q/25360677
score: 3
upvote count: 3
downvote count: 0
type: Answer

http://stackoverflow.com/a/25391986
answers question: http://stackoverflow.com/q/25311535
type: Answer
has body: For the sake of completeness, another option, which hides the complexity of the implementation, is to use StreamSupport.stream(Spliterator&lt;T&gt; spliterator, boolean parallel) to generate the stream and delegate a Spliterator to traversing elements of different sources. There are certain considerations to keep in mind for implementing forEachRemaining(Consumer&lt;? super T&gt; action)
score: 0

http://stackoverflow.com/comment/39339354
comment on: http://stackoverflow.com/q/25247737
type: Comment
type: QuestionComment
score: 0
has text: Have you considered asking on [Programmers](http://programmers.stackexchange.com)? This questions sounds like it might be more on-topic there.

http://stackoverflow.com/q/25238691
tagged with: eclipse
has body: I am currently trying to use a REST interface to create a login authentication service in the Google App Engine. After a bit of searching around, I decided I would use Restlets, and have managed a static string to deploy to the GAE, but as I am quite novice when it comes to Java programming, I'm struggling to make a login page. Could any of you guys provide some sample code to inform me how I would go about doing this? I'm really not sure where to start. using Java 7, Eclipse 4.2, Restlets GAE 2.3, GAE Java SDK 1.9.8
score: 2
tagged with: restlet-2.0
tagged with: java
answer count: 1
downvote count: 0
tagged with: authentication
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25384669
has title: Trying to make a login authentication page using Restlets on Google App Engine
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/comment/39587184
has text: ArrayList is not a Key/Value collection
type: Comment
comment on: http://stackoverflow.com/a/25384074
score: 2
type: AnswerComment

http://stackoverflow.com/comment/39579125
score: 0
comment on: http://stackoverflow.com/a/25379345
type: Comment
type: AnswerComment
has text: aren't you just passing in the variable into the innerclass (he/she could do the same by passing the `franchSize`)? Also `TextField` is a vaadin class and wrapping it again is overkill given that the value is there already from two sources.

http://stackoverflow.com/q/25300120
linked to: http://stackoverflow.com/q/18938152
has body: Given two date ranges, whether the two date ranges overlap? As an example, suppose we have ranges denoted by DateTime variables StartDate1 to EndDate1 and StartDate2 to EndDate2. eg: (A) StartDate1- 14-08-2014 EndDate1 - 14-08-2015 StartDate2- 14-08-2012 EndDate2 - 14-08-2013 (B) StartDate1- 14-08-2014 EndDate1 - 14-08-2015 StartDate2- 14-08-2013 EndDate2 - 14-08-2014 (C) StartDate1- 14-08-2014 EndDate1 - 14-08-2015 StartDate2- 15-08-2014 EndDate2 - 13-08-2015 (D) StartDate1- 14-08-2014 EndDate1 - 14-08-2015 StartDate2- 14-08-2015 EndDate2 - 14-08-2016 (E) StartDate1- 14-08-2014 EndDate1 - 14-08-2015 StartDate2- 15-08-2015 EndDate2 - 15-08-2016
tagged with: java
duplicate of: http://stackoverflow.com/q/18938152
score: -1
type: Question
has title: Overlapping of two Date Range
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25300160
downvote count: 1
has answer: http://stackoverflow.com/a/25300160
favorite count: 0
tagged with: jakarta-ee
type: AnsweredQuestion

http://stackoverflow.com/q/25339741
type: AnsweredQuestion
tagged with: freemarker
has title: Specify which ViewResolver to use per Controller?
tagged with: java
has body: I have a freemarker viewresolver in my spring application: &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"&gt; In my controller methods i can return the name of my freemarker template: return "timeline"; Works without any problems. Now i've created a new template language and i want a few controllers to use this custom template language. So i created a CustomViewResolver. &lt;bean id="viewResolver" class="org.CustomViewResolver"&gt; Now i have 2 view resolvers, a freemarker one and my custom one. How can i specify which ViewResolver should be used by which controller? Cause my backend will use freemarker and my frontend the custom one.
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25379107
has answer: http://stackoverflow.com/a/25379107
upvote count: 1
tagged with: spring

http://stackoverflow.com/comment/39577619
comment on: http://stackoverflow.com/a/25378141
type: Comment
score: 0
type: AnswerComment
has text: you can modify your properies file at compile time, for example - using Apache Ant. And in this case you don't need to change your code. Just modify properties file as you wish. Your code will extract all properties using the described approach.

http://stackoverflow.com/a/25334771
score: 0
answers question: http://stackoverflow.com/q/25334714
type: Answer
has body: According to the documentation, the constructor for Media can only take a string, not a Stream. The string should be a URL, which may be a JAR URL. You should be able to construct a JAR URL to the file in your JAR on the file system... documentation for a JAR URL is at http://docs.oracle.com/javase/6/docs/api/java/net/JarURLConnection.html.

http://stackoverflow.com/comment/39645144
comment on: http://stackoverflow.com/a/25358995
has text: @Zambonie I am serious mate, code really looks incredibly ugly and bad written just because of bad names. Trust me. Same with normal English btw ;)
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39596667
has text: @Pace I added more details on the option 2
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25388938

http://stackoverflow.com/a/25279884
answers question: http://stackoverflow.com/q/25279605
type: Answer
has body: But what is the usage of java script in ruby on rails project? Javascript in rails does the same thing what javascript does in general i.e to manipulate the DOM (change HTML contents) Change HTML elements Delete HTML elements Create new HTML elements Copy and clone HTML elements And much more ... have no idea where to put those script and how to make it function You need to put your javascript in assets/javascript folder. If you look at your layout file(assuming application.html.erb), you'll see you have &lt;%= javascript_include_tag "application" %&gt; Which basically loads all your javascript from app/assets/javascript/application.js so you can either write your js inside that file or you can make a new js file( will recommend you to make a new one) and require that file inside application.js by //= require file_name or if you have //= require_tree . in your application.js then it'll automatically require all files from app/assets/javascript. For more details you should check Rails Asset Pipeline
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25279605
score: 0
has comment: http://stackoverflow.com/comment/39394136
has comment: http://stackoverflow.com/comment/39394111
has comment: http://stackoverflow.com/comment/39394263

http://stackoverflow.com/q/25247737
accepted answer: http://stackoverflow.com/a/25277747
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25277747
has body: I am currently implementing a system that checks the status of my servers, eventually applies some fixes and alert the admisitrator in case of errors (basically a watchdog). I used to do it in a java container with scheduled tasks. On the other side I have my build server (Teamcity) which is really powerful but is used 1hr max per day. I am considering implementing my watchdog as build tasks. Surprisingly I haven't found any nice article talking about that. Does anyone have some feedback doing that? Anything that I should think of before doing that? Any cons? So far my pros/cons are : Pros CI server is powerful but this power is used only 1hr a day Watchdog is smarter if it knows what's running on the build server and doesn't get trigger when a project is being redeployed CI Server have an integrated notification system CI Server keep tracks of the build log and have a nice interface to show what's right/wrong Tasks can be run manually as well as being scheduled Cons Deployment is stuck can mean monitoring is stuck Harder to keep track of what happened in previous checks Please enrich this list! Thanks
tagged with: java
score: -1
has title: Using a Continuous Integration Server as a watchdog
type: Question
tagged with: watchdog
tagged with: continuous-integration
upvote count: 0
has comment: http://stackoverflow.com/comment/39339354
answer count: 1
tagged with: teamcity
downvote count: 1

http://stackoverflow.com/comment/49499093
has text: The REST API does not allow negative values. This works for me with the classic API, but not REST.
comment on: http://stackoverflow.com/a/25327132
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/39397551
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25279501
has text: removed static and it worked (Y). Post it as an answer and i'll expect it @M.Deinum

http://stackoverflow.com/a/25261237
type: AcceptedAnswer
has body: You can't instantiate enums. That was the reason why I couldn't call JNI's NewObject() method (enum permits only private constructors, so instantiation is not possible - you need public constructor). I solved it by making a method inside the outer class which takes enums index as an argument and returns corresponding enum instance. The method is called in JNI via CallObjectMethod() instead of NewObject().
accepted answer of: http://stackoverflow.com/q/25247893
type: Answer
answers question: http://stackoverflow.com/q/25247893
score: 2
upvote count: 2
downvote count: 0

polling
tags question: http://stackoverflow.com/q/25335795
type: Tag
tag name: polling

http://stackoverflow.com/q/25269148
has title: polymorphism and inheritance in hibernate and mysql
tagged with: spring
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/25269563
downvote count: 0
tagged with: mysql
score: 1
upvote count: 1
favorite count: 0
type: Question
has body: In a spring mvc app using hibernate over MySQL, I am encountering problems when I try to create polymorphic subclasses that inherit their id from a BaseEntity. You can see my intended use when you read my AccessLog class below, which has properties of type BaseEntity. The actor_entity and target_entity properties should each be fillable with a variety of different types of entities, such as User, OutsideSystem, Document, etc., each of which inherit from BaseEntity. How do I set this up in code? Here is my current java: @Entity @Inheritance(strategy = InheritanceType.JOINED) public class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE) protected Integer id; //other stuff } @Entity @Table(name="users") public class User extends BaseEntity{ //other stuff } @Entity @Table(name = "accesslogs") public class AccessLog extends BaseEntity{ @ManyToOne @JoinColumn(name = "actorentity_id") private BaseEntity actor_entity; @ManyToOne @JoinColumn(name = "targetentity_id") private BaseEntity target_entity; @Column(name="action_code") private String action; } Here is my current DDL: CREATE TABLE IF NOT EXISTS baseentity( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY )engine=InnoDB;SHOW WARNINGS; CREATE TABLE IF NOT EXISTS accesslogs( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, actorentity_id int(11) UNSIGNED NOT NULL, targetentity_id int(11) UNSIGNED NOT NULL, action_code varchar(100), access_date DATETIME )engine=InnoDB;SHOW WARNINGS; CREATE TABLE roles ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, role varchar(20) NOT NULL ) ENGINE=InnoDB; CREATE TABLE users ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, login varchar(20) NOT NULL, password varchar(20) NOT NULL ) ENGINE=InnoDB; CREATE TABLE user_roles ( user_id int(11) UNSIGNED NOT NULL, role_id int(11) UNSIGNED NOT NULL, KEY user (user_id), KEY role (role_id) ) ENGINE=InnoDB;
type: UnansweredQuestion

http://stackoverflow.com/a/25266440
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25266279
answers question: http://stackoverflow.com/q/25266279
has body: So now that I have a KeyStroke object, how do I go about checking it against a KeyEvent object in my KeyListener? You don't use a KeyListener. Swing was designed to be used with Key Bindings. Check out Key Bindings which contains a program to list the default bindings of each Swing component. It also give some example of how you might create your own ey Bindings. It also contains a link to the Swing tutorial on Key Bindings which explains the whole process in more detail
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/39372848
score: 3
upvote count: 3

http://stackoverflow.com/comment/39321984
comment on: http://stackoverflow.com/q/25240458
score: 0
has text: According to JavaDoc : Returns the workspace root, or null, if the runtime environment is stand-alone. Are you running in StandAlone mode?
type: Comment
type: QuestionComment

xcode
tag name: xcode
tags question: http://stackoverflow.com/q/25387238
type: Tag
tags question: http://stackoverflow.com/q/25251778

http://stackoverflow.com/comment/39441974
has text: as @ScottHunter said, it all depends on how you print stuff. if you using java to print, then show some codes.
type: QuestionComment
comment on: http://stackoverflow.com/q/25305380
score: 0
type: Comment

http://stackoverflow.com/q/25350178
answer count: 3
accepted answer: http://stackoverflow.com/a/25350192
tagged with: java
has comment: http://stackoverflow.com/comment/85438875
has answer: http://stackoverflow.com/a/25350202
has answer: http://stackoverflow.com/a/25350192
has body: Date fakeDate = sdf.parse("15/07/2013 11:00 AM"); Calendar calendar = Calendar.getInstance() calendar.setTime(fakeDate); int currentMonth = calendar.get(Calendar.MONTH); I get currentMonth == 6 instead of 7. why is that?
type: Question
tagged with: timer
linked to: http://stackoverflow.com/q/344380
possible better answer: http://stackoverflow.com/a/25350247
tagged with: calendar
has answer: http://stackoverflow.com/a/25350247
has title: why do I get wrong month when parsing with java calendar
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25334350
answers question: http://stackoverflow.com/q/25334139
has comment: http://stackoverflow.com/comment/100699614
has comment: http://stackoverflow.com/comment/108297103
has body: You can mock new Url instance with whenNew(URL.class).. Make sure you return a previously created mock object from that whenNew call. URL mockUrl = Mockito.mock(URL.class); whenNew(URL.class).....thenReturn(mockUrl ); Then you can add behavior to your mock as you want.
score: 5
upvote count: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39345537
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25252951
has text: You are right. I don't think I had the right syntax. Hence, i have updated my code under the update section of my initial post. Kindly take a look it.
type: Comment

http://stackoverflow.com/comment/39485044
type: AnswerComment
has text: @user3907211 the issue was that just putting the two constraints on the 1 query like you did, implies an 'and' query. The query will only give you results that match the first constraint, AND the second constraint.
type: Comment
comment on: http://stackoverflow.com/a/25321210
score: 0

http://stackoverflow.com/q/25357918
tagged with: database
has comment: http://stackoverflow.com/comment/39537621
tagged with: hashtable
has answer: http://stackoverflow.com/a/25357953
possible better answer: http://stackoverflow.com/a/25358565
answer count: 3
has body: if (!knowledge.isEmpty()) { Iterator&lt;Entry&lt;String, String&gt;&gt; classnmValsItrKW = knowledge .entrySet().iterator(); while (classnmValsItrKW.hasNext()) { Entry&lt;String, String&gt; p1 = classnmValsItrKW.next(); String nm = p1.getKey(); String val = p1.getValue(); String query3 = "insert into namevalue(seqid, name, value) values(" + seqId + ",'" + nm + "','" + val + "')"; //System.out.println("Insert query: " + query3); st = connect.createStatement(); st.executeUpdate(query3); } } "knowledge" is the hashtable where i have stored name value pairs which i want to insert into database. but for every iteration of while loop insert query is getting fired. which i think is inefficient. how do i insert multiple rows by firing insert query only once?
downvote count: 0
upvote count: 1
tagged with: sql
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39537598
has title: how to insert/update multiple rows into database without firing insert/ update query multiple times?
favorite count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25357948
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/25357948
has answer: http://stackoverflow.com/a/25358565

multithreading
tags question: http://stackoverflow.com/q/25380453
tags question: http://stackoverflow.com/q/25314123
tags question: http://stackoverflow.com/q/25317103
tags question: http://stackoverflow.com/q/25388406
tags question: http://stackoverflow.com/q/25329650
tags question: http://stackoverflow.com/q/25255337
tags question: http://stackoverflow.com/q/25359084
tags question: http://stackoverflow.com/q/25267352
tags question: http://stackoverflow.com/q/25245371
tags question: http://stackoverflow.com/q/25356703
tags question: http://stackoverflow.com/q/25259745
tags question: http://stackoverflow.com/q/25244539
tags question: http://stackoverflow.com/q/25313150
tags question: http://stackoverflow.com/q/25373149
tags question: http://stackoverflow.com/q/25240016
tags question: http://stackoverflow.com/q/25335874
tags question: http://stackoverflow.com/q/25354112
tags question: http://stackoverflow.com/q/25339134
type: Tag
tags question: http://stackoverflow.com/q/25239436
tags question: http://stackoverflow.com/q/25368054
tags question: http://stackoverflow.com/q/25283798
tags question: http://stackoverflow.com/q/25283316
tags question: http://stackoverflow.com/q/25346220
tags question: http://stackoverflow.com/q/25270668
tags question: http://stackoverflow.com/q/25374223
tags question: http://stackoverflow.com/q/25347664
tags question: http://stackoverflow.com/q/25314350
tags question: http://stackoverflow.com/q/25330591
tags question: http://stackoverflow.com/q/25306978
tags question: http://stackoverflow.com/q/25288539
tags question: http://stackoverflow.com/q/25385240
tags question: http://stackoverflow.com/q/25346951
tags question: http://stackoverflow.com/q/25231531
tags question: http://stackoverflow.com/q/25352037
tags question: http://stackoverflow.com/q/25289726
tags question: http://stackoverflow.com/q/25301913
tags question: http://stackoverflow.com/q/25360926
tags question: http://stackoverflow.com/q/25233383
tags question: http://stackoverflow.com/q/25313155
tags question: http://stackoverflow.com/q/25232564
tags question: http://stackoverflow.com/q/25320035
tags question: http://stackoverflow.com/q/25331139
tags question: http://stackoverflow.com/q/25307749
tags question: http://stackoverflow.com/q/25247340
tags question: http://stackoverflow.com/q/25278322
tags question: http://stackoverflow.com/q/25293196
tags question: http://stackoverflow.com/q/25344492
tags question: http://stackoverflow.com/q/25300627
tags question: http://stackoverflow.com/q/25277537
tags question: http://stackoverflow.com/q/25279568
tags question: http://stackoverflow.com/q/25377608
tags question: http://stackoverflow.com/q/25251478
tags question: http://stackoverflow.com/q/25307171
tags question: http://stackoverflow.com/q/25383945
tags question: http://stackoverflow.com/q/25361776
tags question: http://stackoverflow.com/q/25346767
tags question: http://stackoverflow.com/q/25330464
tags question: http://stackoverflow.com/q/25297338
tags question: http://stackoverflow.com/q/25345105
tags question: http://stackoverflow.com/q/25388989
tags question: http://stackoverflow.com/q/25304934
tags question: http://stackoverflow.com/q/25344897
tags question: http://stackoverflow.com/q/25378919
tags question: http://stackoverflow.com/q/25302186
tags question: http://stackoverflow.com/q/25385802
tags question: http://stackoverflow.com/q/25339072
tags question: http://stackoverflow.com/q/25372124
tags question: http://stackoverflow.com/q/25361173
tags question: http://stackoverflow.com/q/25359748
tags question: http://stackoverflow.com/q/25273818
tags question: http://stackoverflow.com/q/25333768
tags question: http://stackoverflow.com/q/25307953
tags question: http://stackoverflow.com/q/25341395
tags question: http://stackoverflow.com/q/25342089
tags question: http://stackoverflow.com/q/25333624
tags question: http://stackoverflow.com/q/25290733
tags question: http://stackoverflow.com/q/25279917
tags question: http://stackoverflow.com/q/25301785
tags question: http://stackoverflow.com/q/25321335

http://stackoverflow.com/comment/39553311
type: Comment
has text: Are you getting any error ?
comment on: http://stackoverflow.com/q/25365707
score: 0
type: QuestionComment

http://stackoverflow.com/q/25352102
tagged with: opengl-es
upvote count: 4
has title: Could not set scene2d.ui.Dialog size
type: UnansweredQuestion
has body: I'm trying to display a dialog in the middle of the screen. But I couldn't change the size of the dialog with setWidth() or setHeight(). I have the following code: private void showDialog() { Window.WindowStyle dialogStyle = new Window.WindowStyle(); dialogStyle.background = new TextureRegionDrawable(new TextureRegion(dialog_bg)); dialogStyle.titleFont = gameFont; Dialog dialog = new Dialog("Test Dialog", dialogStyle); dialog.setWidth(200); // will be ignored dialog.show(stage); } Any ideas?
has comment: http://stackoverflow.com/comment/39547894
downvote count: 0
answer count: 1
score: 4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/55253552
has comment: http://stackoverflow.com/comment/53732083
has comment: http://stackoverflow.com/comment/53732512
tagged with: libgdx
tagged with: scene2d
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39552450

http://stackoverflow.com/q/25352888
tagged with: android
has body: I'm developing a sort of parking meter counter app for a few specific locations. The app asks the user where he is (dropdown menu, saves column letter and number, like A6) and then shows a screen with the given location, a timer (chronometer class) counting up from 0 and the price that has to be paid on exit (calculated using elapsed hours * base price). This all works nicely, until the user or the OS kills the app (task manager or memory management). Then, the next time the user opens the app, he's back at the main menu and his location, time and price has been lost. I need a way to save all of the user's information and be able to load it up on app restart. Initially I had thought to save the user's location and the exact time the chronometer started (DateTime.Now() maybe?) to a .txt file in the internal storage so that it would read: mallname,columnLetter,columnNumber,startTime This way, if the app is killed, or any time the app is started up from scratch, the MainActivity will first check if a file.txt exists in the app's internal storage, if it does, it immediately starts the lastPage activity, reading the .txt file to pass the values as parameters (thus, the comma separation). If there's no such file, it would just carry on normally. The last page does contain a reset button that would delete the file so that the app can start up normally the next time it's used. I don't know how efficient this method is, but it's the first thing that came to mind. However, I don't know how to go about this. I have this same exact method programmed in C# for Windows Phone, but I don't know how to translate it into Java for Android. Also, in C# I didn't actually use a chronometer, rather, I had the startTime saved and used a timer that would calculate startTime - DateTime.now() on every tick (every second) and update the textBlock to show this. Any help would be greatly appreciated.
has answer: http://stackoverflow.com/a/25352965
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: file
upvote count: 1
tagged with: chronometer
favorite count: 0
type: Question
tagged with: timer
has title: How do I save chronometer elapsed time in android app
accepted answer: http://stackoverflow.com/a/25352965

http://stackoverflow.com/comment/39474855
type: QuestionComment
comment on: http://stackoverflow.com/q/25323202
has text: btw, kudos for managing to get an upvoted question that contains tags for multiple languages
type: Comment
score: 4

http://stackoverflow.com/q/25304179
has body: In my application clients are communicating via Websockets. So i want to know how many clients(browser) are connected to my Netty server. I want to maintain a list of all active clients by adding them in the order they join and remove any client who disconnects from the server.
score: 0
has answer: http://stackoverflow.com/a/25312241
upvote count: 1
tagged with: java
answer count: 1
has title: How do i get a list of all currently connected clients to my server in netty?
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: netty
downvote count: 1

http://stackoverflow.com/comment/39496679
comment on: http://stackoverflow.com/q/25334426
score: 0
type: QuestionComment
has text: What's the use case here? Or just language curiosity?
type: Comment

http://stackoverflow.com/comment/39527909
type: AnswerComment
has text: Thanks, but I'm sure the data is cached because when I clear entityManager the list will be updated.
type: Comment
comment on: http://stackoverflow.com/a/25352252
score: 0

http://stackoverflow.com/comment/39479295
type: Comment
has text: Thanks for the feedback. I removed the Autowired annotation from the setter and annotated the field instead, i.e. @Autowired private User user; but the User object is still not being generated with the Offer object and the NPE is still be thrown.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25320299

http://stackoverflow.com/comment/53732083
score: 0
has text: Isn't there any other solution ? Becasue it'd be nice to continue to use the show method instead.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25352102

http://stackoverflow.com/a/25281102
score: -1
has comment: http://stackoverflow.com/comment/39396047
upvote count: 0
has comment: http://stackoverflow.com/comment/39396168
has comment: http://stackoverflow.com/comment/39396293
downvote count: 1
answers question: http://stackoverflow.com/q/25280863
has comment: http://stackoverflow.com/comment/39396637
has body: In your example, you don't need tu use super to access the attributes defined in the super class since you are using package visibility for them (and both seems to be in the same package). However, this is NOT the proper way to write Java code. You should define a visibility for your attributes. In most case, it is recommended to use private visibility and to define getter and setter methods to access them: public class Person { private int id; private String name; private String surname; public Person() {} public Person(int id, String name, String surname) { this.id = id; this.name = name; this.surname = surname; } public int getId() { return id; } public void setId(int id) { this.id = id; } // And so on... } In sub-classes, you just have to call getId() or setId(...) to access the Id attribute. No need to call super.getId(). Since Employee extends Person, it has access to all of its public, protected (and package if they are in the same package) attributes and method. This means that in your current code, you can simply write name = n instead of super.name = n. public class Employee extends Person implements Serializable { private String username; private String password; private String date; private int hpw; private int recordSold; private float hourPay; public Employee() {} public Employee(String username, String name, String surname, String password, int id, int hpw, String date, int rSold, float hPay) { super(id, name, surname); this.username = username; this.password = password; this.hpw = hpw; this.date = date; this.recordSold = rSold; this.hourPay = hPay; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } // And so on... } Now to use these classes, you can write code like: Employee e = new Employee("user3149152", "Ulrich", "Ser", "passwd", 1234, 0, "2014/08/13", 0, 0); System.out.println("Employee " + e.getName() + ' ' + e.getSurname() + " has for id " + e.getId() + '.'); For reference, …
type: Answer

http://stackoverflow.com/q/25266156
answer count: 3
possible better answer: http://stackoverflow.com/a/25266318
tagged with: exception
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/39369500
has comment: http://stackoverflow.com/comment/39369673
has comment: http://stackoverflow.com/comment/39369010
upvote count: 10
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39368939
has comment: http://stackoverflow.com/comment/39370034
has comment: http://stackoverflow.com/comment/39368751
accepted answer: http://stackoverflow.com/a/25266203
has answer: http://stackoverflow.com/a/25266318
downvote count: 0
has answer: http://stackoverflow.com/a/25266550
has answer: http://stackoverflow.com/a/25266203
has body: We all write from time to time code like this: try { // ... some code. } catch (SomeException e) { // ... No action is required, just ignore. } Is there any standard code fragment like annotation to show we really intend to ignore exception? Something that shows to other team members and static analyzers we really need to skip this situation like InterruptedException after Thread.sleep()? Something like: Exception.ignore(e); Googled around but have not found something standard for such case. This is especially relevant to tests that assure exceptions: try { action(); fail("We expected this to fail."); } catch (ExpectedException e) { ignore(e, "OK, so far so good."); }
type: AnsweredQuestion
has title: How to properly ignore exception in Java?

http://stackoverflow.com/a/25390683
type: Answer
has comment: http://stackoverflow.com/comment/39604869
downvote count: 0
upvote count: 1
score: 1
has body: If you are using Java 8, you should consider the LongAdder class in java.util.concurrent.atomic: This class is usually preferable to AtomicLong when multiple threads update a common sum that is used for purposes such as collecting statistics, not for fine-grained synchronization control. Under low update contention, the two classes have similar characteristics. But under high contention, expected throughput of this class is significantly higher, at the expense of higher space consumption. Note that if you follow the suggestion in the accepted answer of never synchronizing, then it's possible that the statistics will never update (depending on what else is going on in your program, which architecture you're running on, which Java version, etc.).
answers question: http://stackoverflow.com/q/25388989

http://stackoverflow.com/comment/39362852
type: QuestionComment
type: Comment
has text: Just guessing, but are you trying to classify the big-O notation of a submitted programming puzzle? And then reject all answers which are for example slower than `O(n^2)`? If yes, than take a look at [domjudge](http://www.domjudge.org/) they execute each submission and test if it was fast enough
comment on: http://stackoverflow.com/q/25239301
score: 0

http://stackoverflow.com/q/25326199
tagged with: integer
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/39480986
has answer: http://stackoverflow.com/a/25326303
has comment: http://stackoverflow.com/comment/39480208
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39480202
tagged with: string
linked to: http://stackoverflow.com/q/13942701
has title: Make the scanner.nextInt() read a "q" as quit instead of reading it as a wrong input
has answer: http://stackoverflow.com/a/25326242
favorite count: 0
has answer: http://stackoverflow.com/a/25326259
has answer: http://stackoverflow.com/a/25326262
has comment: http://stackoverflow.com/comment/39480205
score: 1
upvote count: 1
tagged with: java
has body: int rollnumber; do { try { System.out.println("how many times"); rollnumber = scanner.nextInt(); nigh=2; if (Integer.toString(rollnumber).equals("q") ) { System.exit(0); } } catch (Exception e){ System.out.println("invalid. re-enter"); scanner.nextLine()'; } }while (nigh==1); Basically, I'm trying to make a "q" (quit) option but it just keeps jumping to the catch statement when I press q. Help me make it so that the "scanner.nextInt()" reads the q as the actual quit command.
answer count: 4

http://stackoverflow.com/a/25351769
accepted answer of: http://stackoverflow.com/q/25341261
score: 2
upvote count: 2
has body: First of all, the time 24:00 is a valid time according to ISO-8601 and means midnight start at the next day. java.util.GregorianCalendar does not support the hour 24. Please feel free to study following example code with my comments: // By default lenient behaviour with overflow of 24:00 to next day SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); GregorianCalendar gcal = new GregorianCalendar(2014, Calendar.AUGUST, 17, 0, 0, 0); gcal.set(Calendar.HOUR_OF_DAY, 24); System.out.println("HOUR_OF_DAY: " + gcal.get(Calendar.HOUR_OF_DAY)); // 0 System.out.println(sdf.format(gcal.getTime())); // 2014-08-14 00:00 // now switch to strict mode gcal.setLenient(false); gcal.set(Calendar.HOUR_OF_DAY, 24); gcal.getTime(); // triggers recomputation which will fail with following abort // abort relates to set()-method =&gt; java.lang.IllegalArgumentException: HOUR_OF_DAY Most other libraries do not support setting the time to 24:00, too. Neither Java-8-time nor its predecessor Joda-Time give support. However, Java-8-time can parse such times but never set. My library Time4J partially allows setting this time, namely for the type PlainTime which indeed has an extended value range from 00:00 until 24:00 (inclusive). However, I have decided to handle it differently for the type PlainTimestamp(combination of calendar date and wall time) because I want to preserve a bijective unique mapping between timestamp and a single incrementing counter (otherwise the values 2014-08-17 24:00 and 2014-08-18 00:00 would stand for the same timestamp counter causing problems in sorting). The Time4J-solution for this problem is here automatic normalization (with overflow similar to lenient behaviour in the class GregorianCalendar).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25341261
type: Answer

http://stackoverflow.com/a/25348108
answers question: http://stackoverflow.com/q/25347957
has comment: http://stackoverflow.com/comment/39519944
downvote count: 0
has comment: http://stackoverflow.com/comment/39519898
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39519937
has body: You can't embed a local picture like that due to security issues. Browsers simply don't allow this behavior. See this question.
has comment: http://stackoverflow.com/comment/39519935
has comment: http://stackoverflow.com/comment/39519990
has comment: http://stackoverflow.com/comment/39519959
type: Answer

http://stackoverflow.com/q/25239108
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: cucumber-jvm
tagged with: exception
tagged with: java
has title: Cucumber '@allow-rescue' tag not working
has body: I have a java cucumber(version 1.1.8) acceptance tests that uses shazamcrest for assertion. Shazamcrest throws org.junit.ComparisonFailure in case of a mismatch so that the IDE can display the difference between the two objects in a nice diff window. Cucumber on the other hand catches all the Throwables thrown during the test execution and prevent this Errors/Throwables from reaching the IDE, hence not getting the diff window from the IDE. I have read that you can add the tag @allow-rescue in your scenarios to prevent this from happen, but this is not helping... Cucumbers still catches all my Errors and Exceptions. This is the structure of my feature file : @allow-rescue Feature: feature descrioption Scenario: scenario According to the docs, scenarios inherits all tags from the Feature. Can someone please tell me if there is something I am doing wrong or if there is another way to overcome this issue.
score: 2
tagged with: cucumber

http://stackoverflow.com/q/25261618
has comment: http://stackoverflow.com/comment/39360413
tagged with: java
has comment: http://stackoverflow.com/comment/39360461
type: Question
accepted answer: http://stackoverflow.com/a/25261787
has answer: http://stackoverflow.com/a/25261787
tagged with: http://stackoverflow.com/tag/csv
has title: My Java program is not making CSV output
has comment: http://stackoverflow.com/comment/39360387
possible better answer: http://stackoverflow.com/a/25261876
tagged with: jpql
has body: My explanation might not be clear, sorry about that! I am using NetBeans IDE 8.0 to create Java projects. I'm a beginner to Java programming and only started last Wednesday for work experience. Also for my CSV I'm using the following library: CSVReader My mentor told me to create a program which outputs data as CSV so I can go to the CSV file and make a graph of the data. What it does is obtain the data size(Long) and create time(XML Gregorian Calendar) of the files in an online database using JPQL. If you want to have a read here is the schema: [SCHEMA](http://icatproject.org/mvn/site/icat/server/4.3.2/icat.core/schema.html#Datafile"ICAT schema"). Seems like the program is able to find the datafiles(I checked using debugger: 8 files on a 2 day range), but it does not seem to output the data as CSV, even though it creates the CSV files. In my code there will be a part for data count, I haven't done that yet. Also the user can input the date range in which they want the data from, although for testing purpose, I have made that part a comment so that I have a small range. Could you please check my code(I have edited out any unnecessary info. like the login part): String outputFileCount = "C:\\Users\\me\\Documents\\CSV\\dataByCount.csv"; String outputFileSize = "C:\\Users\\me\\Documents\\CSV\\dataBySize.csv"; boolean alreadyExistsCount = new File(outputFileCount).exists(); boolean alreadyExistsSize = new File(outputFileSize).exists(); String FileSize; Long DatafileCount; Calendar calendar; SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss"); String Date; List&lt;Object&gt; dfSearch = null; CsvWriter csvOutputCount = new CsvWriter(new FileWriter(outputFileCount, true), ','); CsvWriter csvOutputSize = new CsvWriter(new FileWriter(outputFileSize, true), ','); if (typeOutput.equals("count")) { if (!alreadyExistsCount) { csvOutputCount.write("DataFile Create Time"); csvOutputCount.write("Datafile Count"); csvOutputCount.endRecord(); } } else if (typeOut…
has answer: http://stackoverflow.com/a/25261876
type: AnsweredQuestion
tagged with: netbeans
score: 0
answer count: 2

http://stackoverflow.com/q/25368590
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1
has title: How to add external resources to dynamic web project eclipse?
tagged with: eclipse
tagged with: servlets
favorite count: 0
type: Question
has body: I'm creating a dynamic web project in eclipse using jsps and java servlets, however I want to add some external files to be edited using the app. Where do I put them such that I can open them from my app and save an edited version - and finally provide a link for a download of the edited file? Thanks
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25369600
tagged with: war
linked to: http://stackoverflow.com/q/4543936
has answer: http://stackoverflow.com/a/25369600
linked to: http://stackoverflow.com/q/18664579

http://stackoverflow.com/q/25383864
has comment: http://stackoverflow.com/comment/39619787
has comment: http://stackoverflow.com/comment/39617097
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39771063
favorite count: 0
type: Question
tagged with: graph
has body: I am trying to model a weighted and directed graph in java. I am using jgraph and jgraphT libraries to do it. By reading the tutorials I managed to model a directed graph but I am confused how I can add weight to the edges. In fact, using "setEdgeWeight", I can do it but I also need to visualize this on the graph. Anyone knows how to it? Following is my code: ListenableDirectedWeightedGraph&lt;String, DefaultWeightedEdge&gt; g = new ListenableDirectedWeightedGraph&lt;&gt;( DefaultWeightedEdge.class); // create a visualization using JGraph, via the adapter jgAdapter = new JGraphModelAdapter&lt;&gt;(g); jgraph = new JGraph(jgAdapter); adjustDisplaySettings(jgraph); getContentPane().add(jgraph); resize(DEFAULT_SIZE); // add some hard-coded sample data (graph manipulated via JGraphT) //First the vertices g.addVertex("input page"); g.addVertex("vertex1"); g.addVertex("vertex2"); g.addEdge("vertex2", "input page"); g.addEdge("vertex1", "input page"); g.setEdgeWeight(g.getEdge("vertex2", "input page"), 1000); Although the code assigns weight, while I try to visualize it, I see no weight label on the edges. positionVertexAt("input page", 130, 40); positionVertexAt("vertex2", 150, 10); positionVertexAt("vertex1", 110, 70); adjustDisplaySettings(jgraph); getContentPane().add(jgraph); resize(DEFAULT_SIZE); JFrame frame = new JFrame(); frame.getContentPane().add(jgraph); frame.setTitle("JGraphT Adapter to JGraph Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); Using the following class, I can generate a static value of weight. But I need to generate the weights dynamically while expanding the graph. public class MyWeightedEdge extends DefaultWeightedEdge { public MyWeightedEdge() { super(); } @Override public String toString() { return Double.toString(2.0); } }
has title: Visualizing Weighted Graph using jgrapht java
linked to: http://stackoverflow.com/q/24517434
has comment: http://stackoverflow.com/comment/39707654
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39615725
has comment: http://stackoverflow.com/comment/39594317
tagged with: jgrapht
has comment: http://stackoverflow.com/comment/39715647
tagged with: visualization
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/25298537
has comment: http://stackoverflow.com/comment/39429172
tagged with: war
has body: Tomcat is still running, I can access the tomcat homepage. However, every few hours tomcat undeploys the wars. No idea why. the apps show a blank white page. Sometimes, when I end the ssh session the wars undeploy as well. However, ssh'ing into server auto redeploys all wars without needing to restart tomcat. Catalina.out shows this at time of undeployment. Aug 13, 2014 7:58:19 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory /home/tapestry/apache-tomcat-7.0.55/webapps/host-manager has finished in 44 ms Aug 13, 2014 8:01:59 PM org.apache.catalina.startup.HostConfig undeploy INFO: Undeploying context [/tapestry] Aug 13, 2014 8:01:59 PM org.apache.catalina.core.ApplicationContext log INFO: Destroying Spring FrameworkServlet 'mvc-dispatcher' Aug 13, 2014 8:01:59 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Aug 13, 2014 8:01:59 PM org.apache.catalina.core.StandardContext listenerStop
answer count: 0
has comment: http://stackoverflow.com/comment/39429224
tagged with: java
has comment: http://stackoverflow.com/comment/39429478
downvote count: 0
has comment: http://stackoverflow.com/comment/39429568
has comment: http://stackoverflow.com/comment/39429595
upvote count: 1
score: 1
tagged with: tomcat
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39429540
has comment: http://stackoverflow.com/comment/39429301
has comment: http://stackoverflow.com/comment/39429362
has comment: http://stackoverflow.com/comment/39429160
has title: Tomcat undeploys apps after ssh session or after few hours.
type: UnansweredQuestion
tagged with: apache
has comment: http://stackoverflow.com/comment/39429323

http://stackoverflow.com/a/25272874
has body: You probably need to set the path variable name in the @PathVariable annotation. In your case: @PathVariable("dirFile").
type: Answer
answers question: http://stackoverflow.com/q/25272144
score: 0

http://stackoverflow.com/a/25384074
has body: An ArrayList or an HashMap would be fine if your keys are Integer. Both are O(1) and expect unique keys. Otherwise, if they are String, HashMap only would fit.
has comment: http://stackoverflow.com/comment/39588813
has comment: http://stackoverflow.com/comment/39587309
has comment: http://stackoverflow.com/comment/39587211
has comment: http://stackoverflow.com/comment/39587409
has comment: http://stackoverflow.com/comment/39587383
has comment: http://stackoverflow.com/comment/39588693
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39588710
has comment: http://stackoverflow.com/comment/39587713
score: 6
has comment: http://stackoverflow.com/comment/39587054
accepted answer of: http://stackoverflow.com/q/25384023
has comment: http://stackoverflow.com/comment/39587184
downvote count: 1
has comment: http://stackoverflow.com/comment/39587812
has comment: http://stackoverflow.com/comment/39587273
has comment: http://stackoverflow.com/comment/39587387
answers question: http://stackoverflow.com/q/25384023
has comment: http://stackoverflow.com/comment/39587261
has comment: http://stackoverflow.com/comment/39587108
has comment: http://stackoverflow.com/comment/39587224
has comment: http://stackoverflow.com/comment/39587343
has comment: http://stackoverflow.com/comment/39588770
upvote count: 7
has comment: http://stackoverflow.com/comment/39588548
has comment: http://stackoverflow.com/comment/39588609
type: Answer
has comment: http://stackoverflow.com/comment/39587755

http://stackoverflow.com/comment/39466964
comment on: http://stackoverflow.com/q/25318732
score: 0
has text: @InputUsername : Use the `onPostExecute(...)` method of `AsyncTask`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39455274
has text: I think [Adam Adamaszek's answer](http://stackoverflow.com/questions/4967885/jvm-option-xss-what-does-it-do-exactly) explains how this option is useful - if that is not the case for you, can you clarify what else you are looking for?
score: 0
comment on: http://stackoverflow.com/q/25309748
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25302790
score: 2
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
has title: Seam Transactions and Arjuna TransactionReaper
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/46437566
has comment: http://stackoverflow.com/comment/46461670
linked to: http://stackoverflow.com/q/28992996
tagged with: transactions
tagged with: seam
tagged with: java
has comment: http://stackoverflow.com/comment/46355124
tagged with: jboss
has answer: http://stackoverflow.com/a/54008179
has body: So in a project I'm working on I've got a Seam component that gets triggered by a TimerService and executes a method to update some data. This method usually runs a few seconds, but sometimes it may take a few minutes. My problem is that if this method takes too long, the Arjuna TransactionReaper kicks in and kills the component. The default timeout is set to 5 minutes, which is sufficient for all the other components and I'd prefer not to change it. Here is some simplyfied bits of my code: @Name("myComp") @Stateful(mappedName = "myComp") @Scope(APPLICATION) @TransactionManagement(TransactionManagementType.CONTAINER) @TransactionTimeout(timeout = 3600) //own implementation, used by Transaction class, see below public class MyComp implements MyCompLocal { @Override public void update() {/*...*/} } Somewhere here on StackOverflow (I fail to find the exact question that contained this, otherwise I'd link to it) I found a solution, that did sound good: Overwrite Seams Transaction class and set the timeout on the UserTransaction, so I did this: @Name("org.jboss.seam.transaction.transaction") @Scope(ScopeType.EVENT) @Install(precedence=APPLICATION) @BypassInterceptors public class Transaction extends org.jboss.seam.transaction.Transaction { @Override protected UserTransaction getUserTransaction() throws NamingException { UserTransaction ut = super.getUserTransaction(); ut.setTransactionTimeout(getTimeout()); //getTimeout() uses the value set by the TransactionTimeout annotation, done by analyzing the stacktrace and reflection return ut; } } This actually seemed to work in the sense that the code is called and the timeout is set on the UserTransaction. Problem however is that Arjuna doesn't seem to care about this, I'm still getting: WARN [arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a88364:126a:53eb7613:8a in state RUN WARN [arjuna] ARJUNA-12095 Abort of action id 0:ffffc0a88364:126a:53eb7613:8a invoked while multiple threads active within it. WARN…

http://stackoverflow.com/q/25334518
favorite count: 0
has body: After wondering whether disposing my frame would return a null (if checked) I went ahead and tested it out. I've searched on dispose() but most of the articles I read just state when to use it, not what it actually does. I tried out the sample code, maybe my code is simply incorrect but if it's not. What does dispose() actually do inside the JVM? If someone does find a link related to this, please post it so I can remove this question
has comment: http://stackoverflow.com/comment/39496703
type: Question
has comment: http://stackoverflow.com/comment/39496731
answer count: 2
has comment: http://stackoverflow.com/comment/39496671
upvote count: 1
has comment: http://stackoverflow.com/comment/39496726
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/25334585
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39498944
has comment: http://stackoverflow.com/comment/39496668
score: 1
has answer: http://stackoverflow.com/a/25334581
possible better answer: http://stackoverflow.com/a/25334581
tagged with: java
has comment: http://stackoverflow.com/comment/39496684
has title: Swing dispose() doesn't actually null the current object reference?
has comment: http://stackoverflow.com/comment/39496693
linked to: http://stackoverflow.com/q/2486136
accepted answer: http://stackoverflow.com/a/25334585
linked to: http://stackoverflow.com/q/6309407

http://stackoverflow.com/q/25337856
has body: Please Help me in my code. This is polymorphism! I can't call all my class as you can see below, only the addition shows the output. I need some explanation too because I really need to know how this happened. This is my code: import java.util.Scanner; class Variation{ public void reality(){ } public int reality(int n1,int n2,int n3,int n4,int n5){ Scanner keyboard = new Scanner(System.in); System.out.println("Enter 5 numbers for addition: "); n1=keyboard.nextInt(); n2=keyboard.nextInt(); n3=keyboard.nextInt(); n4=keyboard.nextInt(); n5=keyboard.nextInt(); int sum=n1+n2+n3+n4+n5; System.out.println("The answer is: "+sum); return sum; } } class multi extends Variation{ public double reality(double n1,double n2, double n3, double n4, double n5){ Scanner keyboard = new Scanner(System.in); System.out.println("Enter 5 numbers for multiplication: "); n1=keyboard.nextInt(); n2=keyboard.nextInt(); n3=keyboard.nextInt(); n4=keyboard.nextInt(); n5=keyboard.nextInt(); double prod=n1*n2*n3*n4*n5; System.out.println("The answer is: "+prod); return prod; } } class sub extends Variation{ public int reality(int n1,int n2, int n3, int n4, int n5){ Scanner keyboard = new Scanner(System.in); System.out.println("Enter 5 numbers for Subtraction: "); n1=keyboard.nextInt(); n2=keyboard.nextInt(); n3=keyboard.nextInt(); n4=keyboard.nextInt(); n5=keyboard.nextInt(); int diff=n1-n2-n3-n4-n5; System.out.println("The answer is: "+diff); return diff; } } class Calling { public static void main(String[] args) { int n1=0,n2=0,n3=0,n4=0,n5=0; Variation variaTions = new Variation(); System.out.println(variaTions.reality(n1, n2, n3, n4, n5)); } }
upvote count: 0
accepted answer: http://stackoverflow.com/a/25337883
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25337883
tagged with: polymorphism
downvote count: 1
favorite count: 0
type: Question
score: -1
has title: Polymorphism Call
type: AnsweredQuestion

http://stackoverflow.com/comment/39443901
type: QuestionComment
comment on: http://stackoverflow.com/q/25306508
has text: change `<beans:beans xml ...` to `<beans xml ...` that should help.
score: 0
type: Comment

http://stackoverflow.com/comment/82517322
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25368187
type: Comment
has text: superEb was right! FYI - in gradle it's: dependencies { compile 'org.springframework.hateoas:spring-hateoas' }

http://stackoverflow.com/comment/39512726
type: Comment
comment on: http://stackoverflow.com/q/25343033
score: 0
has text: i tired 2 jar's actually
type: QuestionComment

http://stackoverflow.com/comment/39511980
score: 0
comment on: http://stackoverflow.com/q/25342885
type: QuestionComment
type: Comment
has text: @Chris Culter sorry I am using point map -if (!map.containsKey(slope)) {map.put(slope, pointmap.get(points[j]));} like if there are points like (0,0)(0,0) it will put the value 2 in the map.

http://stackoverflow.com/comment/39558278
comment on: http://stackoverflow.com/q/25368740
score: 0
type: Comment
type: QuestionComment
has text: Try IBM-1047 as charset.

http://stackoverflow.com/q/25282104
type: Question
has answer: http://stackoverflow.com/a/25316729
tagged with: fxml
has comment: http://stackoverflow.com/comment/39405109
has comment: http://stackoverflow.com/comment/39404825
tagged with: imageview
has comment: http://stackoverflow.com/comment/39398189
type: UnansweredQuestion
has body: I want to get id or name of imageview that defined in FXML. The id or name of imageview is something like 'img001'. When I called 'getid()' Imageview tempImg = (ImageView) event.getTarget(); targetNode = new Node(); targetNode.setImage(tempImg.getImage()); System.out.println(targetNode.getId()); the result is null. in FXML, MyNode is extended from ImageView class. how can i get the id...?
answer count: 1
has comment: http://stackoverflow.com/comment/39397965
has comment: http://stackoverflow.com/comment/39402035
has comment: http://stackoverflow.com/comment/39397828
has comment: http://stackoverflow.com/comment/39405852
has comment: http://stackoverflow.com/comment/39398287
score: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39397891
tagged with: image
has title: (JAVAFX) How can I get the 'id' or 'name' of imageview defined in FXML?

http://stackoverflow.com/comment/39450736
type: AnswerComment
has text: alt-/ is a text-only command (no syntax awareness). It cycles through all words in this editor window that start with the prefix to the left of cursor. For example, " ne|" (where | == cursor) will expand to new, newPrice, next, never - as long as all these words are in your editor window.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25309632

string-matching
tags question: http://stackoverflow.com/q/25338558
tag name: string-matching
type: Tag

http://stackoverflow.com/q/25263793
has title: SWING - Multiple JCheckBox in a JTable cell
favorite count: 0
accepted answer: http://stackoverflow.com/a/25263878
tagged with: cell
answer count: 2
linked to: http://stackoverflow.com/q/15787379
has answer: http://stackoverflow.com/a/25263878
has body: I've a JTable where each cell from a column to contain a list of JCheckBox (to select multiple skills from the list) Any idea how to do that or an alternate way? Thanks,
tagged with: jcheckbox
downvote count: 0
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25267642
type: Question
tagged with: jtable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39364251
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25267642

http://stackoverflow.com/a/25279144
has comment: http://stackoverflow.com/comment/39395283
upvote count: 1
has body: try using a boolean which can set to true if found. I assume that you can break when you have found the String for (String string : hashSet ) { boolean found = false; for(Object obj: hashSet2){ if(obj.equals(string)){ found = true; break; } } if (found) { System.out.println(string + "\t is present in tracking sheet"); } else { System.out.println(string + "\t is not sheet"); } }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25279033
type: Answer

http://stackoverflow.com/q/25242212
has answer: http://stackoverflow.com/a/25242285
tagged with: graphics
tagged with: java
type: AnsweredQuestion
has title: How to know if it was clicked on a graphics object
has body: I have encountered a problem. I have a mouse event. @Override public void mouseClicked(MouseEvent e){ } And it works fine. But I have shapes. Rectangle r = new Rectangle(); r.setSize(50, 50); r.setLocation(200, 200) g2d.draw(r); And when the mouse event is triggered I need something check if it was clicked on my rectangle. Not just anywhere on the screen. if (e.ClickedOnRectangle) { //Do stuff } Something like that. Any solutions? How do check if my mouse was clicked on a AWT (graphics) object?
tagged with: mouselistener
score: 1
answer count: 1
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25242285
tagged with: awt
favorite count: 0
type: Question

http://stackoverflow.com/comment/39447647
type: Comment
score: 0
has text: Which version of Minecraft Forge?
comment on: http://stackoverflow.com/q/25299300
type: QuestionComment

http://stackoverflow.com/q/25324967
has title: Java .properties file and C# .settings file
upvote count: 2
has answer: http://stackoverflow.com/a/25325047
downvote count: 0
has body: I'm working on converting a Java code to C#. The Java code writes and reads 3 key pieces of data in the application into a .properties file. This may even go on for several hundred lines. Properties prop = new Properties(); I have looked at several C# replacements for .properties files and I've come up with 3 possibilities. .settings .ini .config From the non-existent experience I have with these 3 file types, I was thinking that .settings is what I need. Please correct me if I'm wrong and give me some info on how to work with the best file type. (I've looked into reading and writing to .settings files and there's not much to go on) Thanks all!
favorite count: 0
type: Question
tagged with: c#
tagged with: java
tagged with: settings
possible better answer: http://stackoverflow.com/a/25325053
tagged with: properties-file
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25325053
accepted answer: http://stackoverflow.com/a/25325047
answer count: 2

http://stackoverflow.com/a/25235752
score: 3
type: Answer
has body: Yes, it is obviously proguard "michief". Put the following line in proguard-project.txt -keepclassmembers class * extends full-package-name.AbstractSetting { public protected &lt;init&gt;(...); } and you will have it all right.
accepted answer of: http://stackoverflow.com/q/25234128
upvote count: 3
answers question: http://stackoverflow.com/q/25234128
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39431119
comment on: http://stackoverflow.com/a/25285869
score: 0
type: Comment
has text: Why do you want to send header? Above code didn't work?
type: AnswerComment

http://stackoverflow.com/comment/39434946
score: 0
type: AnswerComment
has text: not invokeAndWait and if yes then must be tested for false from isEventDispatchThread, if yes then invokeLater must be used, reasons 1. invokeAndWait shouldn't be called on EDT, 2. exception from RepaintManager can kill your JVM instance, 3. another 3-5 less important reasons (too lazy to....)
comment on: http://stackoverflow.com/a/25301718
type: Comment

http://stackoverflow.com/comment/39445652
comment on: http://stackoverflow.com/q/25305717
score: 0
type: QuestionComment
has text: The thing is, that I just wanna "ignore" the whole rest of that statement. But for logging purposes it would be nice to access the text of in that case the check constraint. It just seems strange to me, that `content=~(';')*` and `content=new_rule ... new_rule: ~(';')*;` produces 2 different values when calling getText(). Anyways, thanks for your help!
type: Comment

http://stackoverflow.com/comment/39569417
type: AnswerComment
has text: How does my answer require creating a new thread? All I'm suggesting is that you should call `Thread.sleep(1000)` inside the `doInBackground()` method.
score: 3
type: Comment
comment on: http://stackoverflow.com/a/25374324

http://stackoverflow.com/a/26998845
has body: I created a complete/standalone C program of your question: #include &lt;stdio.h&gt; #define CRC_POLYNOM 0x9c #define CRC_PRESET 0xFF int main() { unsigned int crc = CRC_PRESET; unsigned char FRAME[] = {1, 56, -23, 3, 0, 19, 0, 0, 2, 0, 3, 13, 8, -34, 7, 9, 42, 18, 26, -5, 54, 11, -94, -46, -128, 4, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, -32, -80, 0, 98, -5, 71, 0, 64, 0, 0, 0, 0, -116, 1, 104, 2}; for(int i = 0; i &lt; sizeof(FRAME); i++) { crc ^= FRAME[i]; for(int j = 0; j &lt; 8; j++) { if(crc &amp; 0x01) { crc = (crc &gt;&gt; 1) ^ CRC_POLYNOM; } else { crc = (crc &gt;&gt; 1); } } } printf("%u\n", crc); return 0; } Here the equivalent Java code automatically created on https://www.mtsystems.com: package demo; public class DemoTranslation { public final static int CRC_POLYNOM = 0x9c; public final static int CRC_PRESET = 0xFF; public static void main(String[] args) { int crc_U = CRC_PRESET; byte[] frame_U = {1, 56, -23, 3, 0, 19, 0, 0, 2, 0, 3, 13, 8, -34, 7, 9, 42, 18, 26, -5, 54, 11, -94, -46, -128, 4, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, -32, -80, 0, 98, -5, 71, 0, 64, 0, 0, 0, 0, -116, 1, 104, 2}; for(int i = 0; i &lt; frame_U.length; i++) { crc_U ^= Byte.toUnsignedInt(frame_U[i]); for(int j = 0; j &lt; 8; j++) { if((crc_U &amp; 0x01) != 0) { crc_U = (crc_U &gt;&gt;&gt; 1) ^ CRC_POLYNOM; } else { crc_U = (crc_U &gt;&gt;&gt; 1); } } } System.out.println(Integer.toUnsignedString(crc_U)); } }
score: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25284556
upvote count: 2

http://stackoverflow.com/a/25245483
type: Answer
has comment: http://stackoverflow.com/comment/39331355
has comment: http://stackoverflow.com/comment/39332646
answers question: http://stackoverflow.com/q/25243946
downvote count: 0
upvote count: 1
score: 1
has body: The interceptor you have created does already override all methods, regardless of being abstract or not. What you seem to have missed is how to invoke the original method that you have overridden: public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if ("valueMethod".equals(method.getName())) return constantValue; else if("sayHello".equals(method.getName())) { System.out.println("before original sayHello()"); // equivalent of saying super.sayHello() inside subclass Object result=proxy.invokeSuper(obj, args); System.out.println("after original sayHello()"); return result; } else return null; }
accepted answer of: http://stackoverflow.com/q/25243946
type: AcceptedAnswer

http://stackoverflow.com/comment/39472617
has text: do this in onCreate --> friendSpinner.setAdapter(dataAdapter); & in place of above line write adapter.notifydatasetchanged();
type: QuestionComment
comment on: http://stackoverflow.com/q/25322046
type: Comment
score: 0

cifs
tags question: http://stackoverflow.com/q/25242268
tag name: cifs
type: Tag

http://stackoverflow.com/comment/39471270
score: 0
comment on: http://stackoverflow.com/q/25321186
type: Comment
type: QuestionComment
has text: Why did you start a new question? It would have been better to add the additional information to your other question to keep everything in one place.

http://stackoverflow.com/a/25484006
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39774761
accepted answer of: http://stackoverflow.com/q/25365532
has body: Replace &lt;module name="javax.resource"/&gt; with &lt;module name="javax.resource.api"/&gt; in the dependencies section.
answers question: http://stackoverflow.com/q/25365532
type: AcceptedAnswer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/71591849
comment on: http://stackoverflow.com/a/25381936
score: 0
type: Comment
has text: Some official docs on this technique: https://developer.android.com/training/improving-layouts/smooth-scrolling.html#ViewHolder
type: AnswerComment

http://stackoverflow.com/q/25328589
favorite count: 0
type: Question
tagged with: extract
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39486002
has answer: http://stackoverflow.com/a/25328716
has comment: http://stackoverflow.com/comment/39487150
tagged with: regex
linked to: http://stackoverflow.com/q/20445947
has comment: http://stackoverflow.com/comment/39486991
has title: tExtractRegexFields Talend, using regex to seperate column into multiple columns by length
answer count: 3
score: 2
has body: I have a job that has a column that is unbounded coming from an xml file and the length of the column can exceed more than 4000 characters, however, this is the maximum length of Oracle varchar column. I need to be able to use the tExtractRegexFields component in Talend to separate the columns every 3000-4000 characters into a separate column. I however, am not good with Regex and am having some trouble. The text is generally formatted like this: " #Principal Responsibilities: INSERT EXTREMELY LONG DESCRIPTION HERE " I tried using something like this: "([a-zA-Z0-9]{0,4000})" but I was having no luck, it was only capturing 1 word. Job is set up like this: tFileInputXML------>tExtractRegexFields----->tMap------tOracleOutput I know it is something simple I am missing, but I just cant figure out what!
tagged with: talend
has comment: http://stackoverflow.com/comment/39485116
tagged with: java
has answer: http://stackoverflow.com/a/25329064
has answer: http://stackoverflow.com/a/25350391
has comment: http://stackoverflow.com/comment/39486892
downvote count: 0
has comment: http://stackoverflow.com/comment/39485815

http://stackoverflow.com/a/55573102
downvote count: 0
has body: Implementation says both are the same. ARROW_UP calls Keys.UP
type: Answer
answers question: http://stackoverflow.com/q/25268131
score: 2
upvote count: 2

http://stackoverflow.com/q/25337191
tagged with: jsp
tagged with: spring
favorite count: 0
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/41510294
has comment: http://stackoverflow.com/comment/70297295
has comment: http://stackoverflow.com/comment/39502392
tagged with: java
score: 2
upvote count: 2
tagged with: spring-webflow
downvote count: 0
type: UnansweredQuestion
has title: Newbie Spring webflow end-state view error
has body: I am customizing a CAS 4.0.0 with a war overlay. I have added a x509 cert authenticator, and I want a custom error page. I added this action-state: &lt;action-state id="startAuthenticate"&gt; &lt;evaluate expression="x509Check" /&gt; &lt;transition on="success" to="sendTicketGrantingTicket" /&gt; &lt;transition on="warn" to="warn" /&gt; &lt;transition on="error" to="certFailPage" /&gt; &lt;/action-state&gt; and this end-state: &lt;end-state id="certFailPage" view="certFailPageView" /&gt; and of course a certFailPageView.jsp with all the other views. When I try and log in with a bad cert I am getting this error: SEVERE: Servlet.service() for servlet [cas] in context with path [/cas] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.springframework.webflow.action.ViewFactoryActionAdapter@313c6dd3 in state 'certFailPage' of flow 'login' -- action execution attributes were 'mapempty'] with root cause java.lang.NullPointerException However, If I change the the transition on="error" to a pre-defined page (like casBadHoursView) everything works fine. What else do I need to do to make my jsp work? I looked at the ViewResolver and it is a standard .jsp resolver. I have been doing spring for a wile, but this is my first webflow exposure. Is there some other place I need to register this view? EDIT: Full stack trace as requested: SEVERE: Servlet.service() for servlet [cas] in context with path [/cas] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.springframework.webflow.action.ViewFactoryActionAdapter@5a4b4352 in state 'certFailPage' of flow 'login' -- action execution attributes were 'mapempty'] with root cause java.lang.NullPointerException at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:55) at org.springframewo…
answer count: 1
has comment: http://stackoverflow.com/comment/70349032

http://stackoverflow.com/a/65206433
answers question: http://stackoverflow.com/q/25323258
score: 0
has body: As you note, the problem is that your other sources depend on some of the sources you've excluded: Because Maven passes -sourcepath to javac, javac can find and compile those "missing" sources. If you want the build to fail in that case, you can explicitly specify a dummy value for -sourcepath: maven-compiler-plugin 3.8.1 -sourcepath doesnotexist See MCOMPILER-174 and this longer explanation of how javac handles -sourcepath and other arguments.
type: Answer

http://stackoverflow.com/comment/39565479
score: 0
type: AnswerComment
type: Comment
has text: Yeah, seems like I completely missed that. I'm not sure I have an answer then.
comment on: http://stackoverflow.com/a/25371881

http://stackoverflow.com/q/25262491
tagged with: android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39361887
tagged with: android-layout
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25263530
answer count: 1
has title: Getting view from child-layout from tablerow (Android)
has body: I have a tablerow in a tablelayout. Now, I can get tablerows without problem. Tablerow contains a linearlayout and the linearlayout contains views that I need. Is there any possibility to get the linearlayout, and then the from it views? I cannot do this, because View doesn't have getChildAt method: View layout = row.getChildAt(j); EditText first = (EditText)layout.getChildAt(0); I cannot do this either, because it leads to runtime error when converting View to Layout: LinearLayout layout = (LinearLayout)row.getChildAt(j); EditText first = (EditText)layout.getChildAt(0);
score: 0

http://stackoverflow.com/q/25330493
duplicate of: http://stackoverflow.com/q/23905333
type: Question
has body: Following is my getConnection class: package connection; import java.sql.*; public class getConnection { public static Connection getConnectionBuilder(){ String username="system"; String password="root"; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); try { Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE",username,password); return conn; } catch (SQLException e) { System.err.println("Problem in getting connection with URL or username or password"); e.printStackTrace(); } }catch(ClassNotFoundException ex){ System.err.println("Error loading driver"); ex.printStackTrace(); } return null; } } Another 2 JSP pages are there in my project which are using this connection class. But I am getting error Error loading driver. As per my connection class, this error means Driver is not getting loaded properly. My Oracle is 10g, JAVA is JDK 1.6.0.18 and I am using both ojdbc14.jar and ojbc6.jar. Still I am getting the same error. STACKTRACE GENERATED: 15 Aug, 2014 10:20:03 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/Bank_Web] threw exception [An exception occurred processing JSP page /Insert_To_Account_Master.jsp at line 24 21: System.out.println("blah"); 22: 23: 24: Connection con=getConnection.getConnectionBuilder(); 25: PreparedStatement pstmt=con.prepareStatement("Insert into account_master(name,acct_opn_date,cif_id,address) values(?,?,?,?)"); 26: pstmt.setString(1,fullname); 27: pstmt.setString(2,accopndate); Stacktrace:] with root cause java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver at connection.getConnection.getConnectionBuilder(getConnection.java:11) at org.apache.jsp.Insert_005fTo_005fAccount_005fMaster_jsp._jspService(Insert_005fTo_005fAccount_005fMaster_jsp.java:86) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrappe…
tagged with: ojdbc
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39489221
has comment: http://stackoverflow.com/comment/39489392
has comment: http://stackoverflow.com/comment/39488791
has comment: http://stackoverflow.com/comment/39489271
has title: Connection is failing between Oracle 10g and JDK 1.6.0.18
score: 0
linked to: http://stackoverflow.com/q/23905333
has comment: http://stackoverflow.com/comment/39489352
answer count: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39489659
has comment: http://stackoverflow.com/comment/39489021
tagged with: java
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39488786

http://stackoverflow.com/a/25352239
has body: It is very Simple to import a certificate (of any type p12, x509) to tomcat trust store. Follow the below steps and you should be able to import the certificate into the trust store of your tomcat. Find the JRE (not JDK) that your tomcat is using. See the tomcat startup for JRE_HOME. Use the Keytool in the JREBin directory to import the certificate you EXPORTED with the browser into trust store using the below commands. jre\bin\keytool -importkeystore -srckeystore .\Certs\sample.p12 \ -destkeystore .\Certs\server.keystore -srcstoretype pkcs12 \ -deststoretype jks -srcstorepass changeit -deststorepass changeit and type YES when prompted whether to trust the certificate. Reference: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html http://support.citrix.com/proddocs/topic/command-center-40/cc-install-import-cert-truststore-tsk.html
score: 0
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/39530686
upvote count: 1
answers question: http://stackoverflow.com/q/25352081
has comment: http://stackoverflow.com/comment/39530975

http://stackoverflow.com/comment/39552788
type: AnswerComment
comment on: http://stackoverflow.com/a/25363311
type: Comment
has text: The class UserGroup is not really necessary, you can use a String with userId + " "+group concatenated, provided that userId does not contain any spaces.
score: 0

http://stackoverflow.com/comment/39532262
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25345401
score: 0
has text: @rafaelosipov I'm assuming it's a session, I'm just learning web stuff so that could be the wrong term. What I mean is, if I've logged into the site shouldn't it know that I'm logged in when I make a request for the page that requires authentication? The HTML I get back does indeed say that I'm not logged in.

http://stackoverflow.com/comment/39315623
type: AnswerComment
has text: Yeah he can use Threading as I mentioned, but as far as I understood, s/he just need to disable/hide the buttons. It is not a rocket launcher app :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25236720

http://stackoverflow.com/comment/39559101
type: AnswerComment
has text: I want to uncompress different files, if it is test.txt.bz2, then uncompress to test.txt and 6223.webvis.html_20130803195241.bz2 to 6223.webvis.html_20130803195241. How can I make my code generic such that it will work for these two different scenarios.
type: Comment
comment on: http://stackoverflow.com/a/25367479
score: 0

http://stackoverflow.com/q/25245345
accepted answer: http://stackoverflow.com/a/25245723
tagged with: java
has answer: http://stackoverflow.com/a/25245723
type: Question
has body: Hi guys i have the following issue in my program. I have several tablecellrenderers which are applied by column. The problem is if a column appears two times in my table the cellrenderer won't work, and leaves both columns unformatted. I am also not able to change the column names because my customer has a specific idea of how this table should look like I asked google, the stackoverflow search but i can't find any solution for this. Do you know a workaround for this? Thanks in advance The Lines where i apply the cellrenderer for(int i=0;i&lt;(columnnames.length-anz_col);i++){ //Berechnung einmalig durchführen actcol=i+anz_col; //CellFormater tbl_patchstand.getColumn(columnnames[actcol]).setCellRenderer(new PatchstandCellRenderer(tbl_patchstand.getDefaultRenderer(Object.class), actcol, maxfpatches[i])); tbl_patchstand.getColumn(columnnames[actcol]).setCellRenderer(new PatchstandCellRenderer(tbl_patchstand.getDefaultRenderer(Double.class), actcol, maxfpatches[i])); tbl_patchstand.getColumn(columnnames[actcol]).setCellRenderer(new PatchstandCellRenderer(tbl_patchstand.getDefaultRenderer(Integer.class), actcol, maxfpatches[i])); } The Cellrenderer itself: public class PatchstandCellRenderer extends DefaultTableCellRenderer { /** * */ private int maxval,col; private double oldval,newval; public PatchstandCellRenderer(TableCellRenderer cellRenderer, int col, int maxval) { super(); this.maxval=maxval; this.col=col; } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column){ Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if((column==col) &amp;&amp; value!=null &amp;&amp; (!((String)value).trim().equals("-")) &amp;&amp; (!((String)value).trim().equals(""))){ //Umrechnen Wert auf Range oldval=Double.parseDouble((String) value); newval=(oldval)/(maxval); c.setBackground(GetColor.getColor(newval)); } else c.setBackground(Color.WHITE); return c; } } …
answer count: 1
tagged with: swing
tagged with: tablecellrenderer
has title: How to handle duplicate columnheaders in tablecellrenderer?
tagged with: jtable
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39324048
type: Comment
comment on: http://stackoverflow.com/a/25242035
has text: I'm also not sure if it deserves a down vote. But, still i think it helps OP's problem. @user3571223 can you show us what is the change you did?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39433032
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25290317
has text: Finally, it was a firewall problem. It's strange however that the firewall behavior depends on whether the tcp server was started from ant or from the command line.
type: Comment

http://stackoverflow.com/comment/39452652
type: QuestionComment
comment on: http://stackoverflow.com/q/25311457
has text: If you're going to hardwire questions in source code, why even write them to a database?
score: 0
type: Comment

http://stackoverflow.com/q/25248681
tagged with: mysql
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25248732
has title: Error in query for getting result in descending order by row id
type: AnsweredQuestion
score: 0
tagged with: web-applications
answer count: 1
has answer: http://stackoverflow.com/a/25248732
type: Question
tagged with: java
has body: I have been trying to execute following query over MYSQL instance and its running fine, however same query which am making to mysql instance through my web application am getting below error. String query = "SELECT * from "+getTable(type)+" LIMIT ?,? ORDER BY _id DESC;"; Am new to all this, am really not understanding issue, please help. below is stack trace 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 'ORDER BY _id DESC' 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.executeQuery(PreparedStatement.java:1467) at com.mkgcorp.data.DatabaseManager.getLogs(DatabaseManager.java:56) at com.mkgcorp.controller.DataSynchronizer.doGet(DataSynchronizer.java:99) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) 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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBa…

http://stackoverflow.com/a/43110944
has comment: http://stackoverflow.com/comment/115598793
upvote count: 2
answers question: http://stackoverflow.com/q/25339856
downvote count: 0
type: Answer
has body: You can use a simple loop on all the POS value: Set&lt;String&gt; lexicon = new HashSet&lt;&gt;(); for (POS p : POS.values()) { IIndexWord idxWord = dict.getIndexWord("name", p); if (idxWord != null) { System.out.println("\t : " + idxWord.getWordIDs().size()); IWordID wordID = idxWord.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset(); System.out.print(synset.getWords().size()); for (IWord w : synset.getWords()) { lexicon.add(w.getLemma()); } } } for (String s : lexicon) { System.out.println("wordnet lexicon : " + s); }
score: 2

http://stackoverflow.com/comment/39433197
has text: No, not at all. It says that the Hibernate native API doesn't need to be wrapped into a HibernateTemplate.
score: 0
comment on: http://stackoverflow.com/q/25296615
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25378366
has comment: http://stackoverflow.com/comment/39579605
tagged with: jsp
has answer: http://stackoverflow.com/a/25379956
tagged with: spring
tagged with: spring-mvc
has title: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.Dao.ApplicationDaoImpl] for bean with name '
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25378539
has body: I'm working on a Spring MVC (3.2) + JDBC project, I'm very new to Spring. I'm using Eclipse Europa,Tomcat server and oracle database, I'm not using maven. I have seen many questions on stackoverflow, but none of the answers solve my issue. When I'm running my project I'm getting this error: SEVERE: Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.Dao.ApplicationDaoImpl] for bean with name 'ApplicationDao' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.Dao.ApplicationDaoImpl at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1275) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1344) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:910) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet…
favorite count: 0
type: Question
tagged with: spring-jdbc
answer count: 2
has comment: http://stackoverflow.com/comment/39576612
possible better answer: http://stackoverflow.com/a/25378539
accepted answer: http://stackoverflow.com/a/25379956
downvote count: 0

http://stackoverflow.com/q/25341920
has body: My custom similarity class PercentageSimilarityClass has been added to the classloader, but the results are ranked the same as before. This is my code. What am I doing wrong? package org.apache.lucene.search.similarities; import org.apache.lucene.search.similarities.DefaultSimilarity; public class PercentageSimilarityClass extends DefaultSimilarity { @Override public float coord(int overlap, int maxOverlap) { return ((overlap /(float)maxOverlap)*(overlap/(float)maxOverlap)); } @Override public float queryNorm(float sumOfSquaredWeights) { return (float) 1.0; } @Override public float tf(float freq) { return (float) 1.0; } @Override public float sloppyFreq(int distance) { return (float) 1.0; } @Override public float idf(long docFreq, long numDocs) { return (float) 1.0; } } I also tried to add in public PercentageSimilarityClass(){ super(); } but it didn't make a difference. Any help would be greatly appreciated! Edit I want Solr to rank documents based on how many of the query's words are found in the document; the more words the higher the ranking. So, I am trying to increase the weighting of the coord() factor, (by squaring it), and decrease the other factors, (by having them return (float) 1.0). I've calculated what percentage of each returned document is made up of the query's words and, both before and after I added my custom similarity, my top ten ranked documents got a percentage of 21.74% 12.5% 15.38% 27.59% 10.34% 44.44% 37.5% 14.29% 19.3% 20.0% The document that is 44.44% comprised of the query's words should have ranked first in this instance, and when I extend the search beyond 10 documents, to 100 or 500 documents, I get many documents that are 70%+ comprised of words in the query term, which have not been ranked first.
favorite count: 0
has comment: http://stackoverflow.com/comment/39519443
upvote count: 4
has comment: http://stackoverflow.com/comment/39560864
type: Question
has comment: http://stackoverflow.com/comment/39509802
has comment: http://stackoverflow.com/comment/57014990
answer count: 0
has comment: http://stackoverflow.com/comment/39512314
downvote count: 0
type: UnansweredQuestion
tagged with: lucene
score: 4
has comment: http://stackoverflow.com/comment/39561004
tagged with: java
has title: Solr Custom Similarity Class loaded but no effect on ranking result. Why is override not working?
tagged with: solr
has comment: http://stackoverflow.com/comment/39521973

http://stackoverflow.com/q/25305380
has answer: http://stackoverflow.com/a/25305581
tagged with: servlets
answer count: 4
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/39441637
possible better answer: http://stackoverflow.com/a/25305510
has comment: http://stackoverflow.com/comment/39441662
score: 0
has comment: http://stackoverflow.com/comment/39441639
tagged with: mysql
tagged with: jsp
has answer: http://stackoverflow.com/a/25305510
has title: how to loop a INNER JOIN
accepted answer: http://stackoverflow.com/a/25305796
has body: Some users on this forum helped me creating this inner join SELECT a.*, p.* FROM artist a INNER JOIN pics p on p.id_artist = a.id to query these tables artist pics ------------------- --------------------------------------- | id | name | age | | id_artist | picUrl | picDescription | ------------------- --------------------------------------- | /\ ---------------------------- Now what i get when i loop the resultSet is: 1 michael jackson 50 img/435432.jpg concert 1 michael jackson 50 img/213234.jpg family 1 michael jackson 50 img/123163.jpg concert What id like to "get" is: 1 michael jackson 50 img/435432.jpg concert img/213234.jpg family img/123163.jpg concert but i can't understand how loop it. I have to put the outcome of the query in many object called Artist. These are it's field int id; String name; int age; Pic pics []; this is the object Pic int idArtist; String Url; String Description So what i should do is something like: while(resulset.next()){ Artist artist = new Artist(); artist.setId(resulset.getInt("a.id")); ........ Pic pic = new Pic(); pic.setIdArtist(resulset.getInt("a.id")); pic.setUrl(resulset.getInt("p.picUrl")); ..... artist.setPic(pic ); } But this is not correct, because this way i get an Artist object for every pic that is in the db. What i want is just one Artist object and many Pic objects inside the artist object.
has answer: http://stackoverflow.com/a/25305796
type: Question
has comment: http://stackoverflow.com/comment/39441974
tagged with: java
has answer: http://stackoverflow.com/a/25305934

http://stackoverflow.com/comment/92929141
comment on: http://stackoverflow.com/a/25352939
type: Comment
type: AnswerComment
has text: @mark : actually no. Anywhere. Apparently it's an open bug since 2013. Refer https://bugs.openjdk.java.net/browse/JDK-8027682?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aworklog-tabpanel
score: 0

http://stackoverflow.com/q/25357165
has comment: http://stackoverflow.com/comment/39536160
tagged with: swing
has comment: http://stackoverflow.com/comment/39536708
tagged with: java
has comment: http://stackoverflow.com/comment/39536197
has answer: http://stackoverflow.com/a/25358011
has comment: http://stackoverflow.com/comment/39537000
has title: Netbeans FrameView CenterScreen,ChangeSize
type: Question
tagged with: netbeans
score: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39536302
has body: I am modifying a Java Desktop Application made using NetBeans 6.9.1 . No matter what i do i am unable to change the size of the main application neither can I centralise it. Netbeans uses something called FrameView it extends JFrame . So no Jframe object is directly available what i have tried already this.getFrame().setLocationRelative(null); this.getFrame().setSize(whatever,whatever); above 2 dont work neither can i find any option in GUI Builder I have a feeling this question may have been asked but i have failed to find the correct answer
answer count: 1
has comment: http://stackoverflow.com/comment/39537038
has comment: http://stackoverflow.com/comment/39536275

http://stackoverflow.com/comment/39336500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25248428
has text: @CommonsWare Yeah, I had a feeling that would be the case too. This is the problem with hobby projects; you just go for it without planning it out properly
score: 0

http://stackoverflow.com/comment/39375729
type: Comment
type: QuestionComment
has text: They need to bring back "lacks minimal understanding"
comment on: http://stackoverflow.com/q/25269774
score: 3

http://stackoverflow.com/comment/39457833
comment on: http://stackoverflow.com/a/25297453
has text: @789 I don't actaully know SWT well, but standard java conurrency classes like ExecutorService and Future should work anyway.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25384503
accepted answer: http://stackoverflow.com/a/25386248
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25386248
answer count: 1
has title: Java Web Start application blocked by security settings if launched from one server but not another
type: Question
score: 0
tagged with: java
tagged with: java-web-start
has body: I don't know if anyone can spread any light on this but basically we have a java web start application which works just fine and is signed by a valid certificate. I'm trying to move the code over onto a new test machine and all seems fine except it won't launch, just shows the message: ---------------------------------------------------- 'Application Blocked by Security Settings Name: [app name] Location: [address] The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.' ---------------------------------------------------- The site it launches from has a self signed certificate, but this is the case also for my dev machine which the app launches from fine. It also works perfectly from our live site so I'm at a bit of a loss as to the cause/cure. Changing the settings in the Java Control panel has no effect, neither does adding the site to the exception list (I've also tried with port number appended). Both windows 7 and windows 8 client machines display the same behavior (i.e launches from my dev machine not the test one) the code is identical, it's the same jar and it's signed by a genuine Thwaite cert. I tried turning on logging and tracing but just get an empty log file and a .trace file with 'Log started: Tue, 19 Aug 2014 13:57:42 +0100 Java Web Start 10.67.2.01 Using JRE version 1.7.0_67-b01 Java HotSpot(TM) Client VM' Any help would be appreciated, i.e. what exactly is the cause of the issue? Or where could I find the information as this is a fairly unhelpful error message? Is the certificate for the site the WS app is launched from even a part of the check, or does it just check the jar signature?

http://stackoverflow.com/a/25344920
accepted answer of: http://stackoverflow.com/q/25344897
has body: if we use Reflection API to change an instance variable, will it cause race condition? Absolutely, it will. If it does,how should we properly use Reflection API? You can synchronize on the object whose properties you set, like this: Object obj = ... Field f = c.getDeclaredField("..."); synchronize(obj) { f.set(obj, newVal); }
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25344897
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39352894
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25257045
has text: Thanks a lot for your detailed info, appreciate a lot.

http://stackoverflow.com/comment/41345001
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25329965
type: QuestionComment
has text: have you solved this issue? if yes, how did you solve it?

http://stackoverflow.com/comment/39592764
comment on: http://stackoverflow.com/a/25385610
score: 0
type: AnswerComment
has text: Hey, thanks a lot for all the effort you spend to help me! Still I have the feeling, that the timestamp is not interpreted as the number of millis from 1970-01-01T00:00:00Z (= UTC). When I do: new DateTime(3600000L, DateTimeZone.UTC), then I have everything in UTC, right? The base is UTC, my DateTime is in UTC, but the result is: 1970-01-01T01:00:00.000Z. Still I loose this one hour somewhere even without converting the DateTime into a LocalDateTime. I don't get it!
type: Comment

http://stackoverflow.com/q/25361705
has comment: http://stackoverflow.com/comment/39544475
tagged with: generics
has answer: http://stackoverflow.com/a/25361853
favorite count: 0
type: Question
has body: Arraylist with List&lt;interfaceI&gt; and List&lt;? extends InterfaceI&gt; both will have objects of classes implementing interfaceI. Then when what should be used?
score: 6
has title: List<interfaceI> vs List<? extends InterfaceI> in java
tagged with: collections
accepted answer: http://stackoverflow.com/a/25361853
has answer: http://stackoverflow.com/a/25436052
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39544667
answer count: 3
upvote count: 7
tagged with: java
has answer: http://stackoverflow.com/a/25362136
possible better answer: http://stackoverflow.com/a/25362136
downvote count: 1

http://stackoverflow.com/q/25320955
type: Question
has body: I have a LinkedBlockingQueue and I want to check if there is a certain order of elements in the queue without removing the elements. I was hoping there was method I could use to peek at a particular spot in the queue. For example, queue.peekSpot(0) would return the head and quque.peekSpot(queue.size()) would return the tail. Right now I have this method but it removes the things it is reading. The queue is a type char by the way. public boolean checkString(String string) { if (string.length() &lt; 1) { return true; } char input = queue.take(); if (input == string.charAt(0)) { return checkString(string.substring(1)); } return false; } If I could use a peekSpot() method, this could be done as follows, greatly simplifying the code. public boolean checkString(String string){ for(int i = 0; i &lt; string.length(); i++){ if(!(string.charAt(i) == queue.peekSpot(i))){ return false; } } return true; } Somebody might say, what if that spot doesn't exist? Well then it might wait for that spot to exist. I am using a queue instead of an ordinary string because this is a serial feed and the string would have to constantly change. Any ideas?
has answer: http://stackoverflow.com/a/25321280
accepted answer: http://stackoverflow.com/a/25321280
has title: LinkedBlockingQueue peek at particular spot
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: queue

http://stackoverflow.com/comment/39517507
type: Comment
type: QuestionComment
has text: Works for me (OS X + [Java8u20b17](https://jdk8.java.net/download.html)). Also works if the javascript function is replaced with a bind for the label text: `text="${textfield.text}"`.
comment on: http://stackoverflow.com/q/25345307
score: 0

http://stackoverflow.com/q/25315354
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39460102
has comment: http://stackoverflow.com/comment/39480353
has comment: http://stackoverflow.com/comment/39812392
has title: Is it necessary to use SessionMap in struts2?
has comment: http://stackoverflow.com/comment/39475362
type: Question
has body: HttpSession session; session=request.getSession(false); session.invalidate(); i m working on struts2 and hibernate framework.i have written this code in Logoutaction class but on pressing the back button in browser,its taking me to the old profile,which shouldn't happen after invalidating the session.So,should i use SessionMap or Map instead of HttpSession to invalidate the session?? i have searched for this but all i could find was the use of map and SessionMap.
has comment: http://stackoverflow.com/comment/39465482
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25346029
tagged with: struts2
linked to: http://stackoverflow.com/q/22632794
has answer: http://stackoverflow.com/a/25315467
score: 0

http://stackoverflow.com/q/25341801
accepted answer: http://stackoverflow.com/a/25342662
has body: I'm trying to populate a sub-menu dynamically, and in case there are no elements in it, I want to add a disabled JMenuItem in it with the text "(empty)". However, since the L&amp;F is set to the System L&amp;F (Windows, in my case), the JMenuItem highlights on mouseover. How do I avoid this? It works exactly as desired without setting L&amp;F, but the fact that the L&amp;F is set to that of the system is not something that I can change (since this is part of something larger). Here's an SSCCE: import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class HelpMenuItem { public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } protected static void createAndShowGUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } JFrame frame = new JFrame(); JMenuBar menuBar = new JMenuBar(); menuBar.setVisible(true); JMenu menu = new JMenu("Test"); JMenu sub = new JMenu("SubMenu"); JMenuItem empty = new JMenuItem("(empty)"); empty.setEnabled(false); menuBar.add(menu); menu.add(sub); sub.add(empty); frame.setJMenuBar(menuBar); JPanel panel = new JPanel(); panel.add(new JLabel("Test")); frame.setContentPane(panel); frame.pack(); frame.setVisible(true); } }
tagged with: java
tagged with: look-and-feel
answer count: 1
tagged with: user-interface
favorite count: 0
type: Question
has title: setEnable(false) does not prevent JMenuItem from getting highlighted with WindowsLookAndFeel
has comment: http://stackoverflow.com/comment/39509899
tagged with: swing
has comment: http://stackoverflow.com/comment/39518781
tagged with: menuitem
upvote count: 2
has comment: http://stackoverflow.com/comment/39509678
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25342662
downvote count: 0

http://stackoverflow.com/a/25340434
type: AcceptedAnswer
downvote count: 0
has body: EDIT: The Log4jConfigurer doesn't work with log4j2 since it depends on the (log4j1-only) DOMConfigurator class. Please remove it from your spring config. Instead, use the mechanism log4j2 provides to control the config file location: system property "log4j.configurationFile", or alternatively see the Web Applications log4j2 manual page.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25328038
answers question: http://stackoverflow.com/q/25328038
type: Answer
score: 4

http://stackoverflow.com/q/25244799
tagged with: image-compression
linked to: http://stackoverflow.com/q/1069095
has comment: http://stackoverflow.com/comment/58377288
has comment: http://stackoverflow.com/comment/39329186
tagged with: image-scaling
downvote count: 0
has comment: http://stackoverflow.com/comment/39330616
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39329991
has body: I want to reduce the image file size below 100 KB while preserving the image quality like whatsapp and facebook did. I tried almost all the code of android image compression available on stackoverflow but that doesn't work for me. Right now i am following this blog to reduce the image size, and i am getting the image below 100 KB but image quality is poor. Is there any way that i can reduce image size below 100 KB while preserving the quality??? (Original Image size can vary from 20 KB to 8 MB) I tried JAI library in Java Project, and it work good. Can i Use JAI library in android to reduce image size??? Thanks in Advance. Source Code to compress an Image: import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.media.ExifInterface; import android.os.Environment; import android.util.Log; public class CompressBitmap { private String path; public CompressBitmap(String path){ this.path= path; } public ByteArrayOutputStream getBitmap(){ ByteArrayOutputStream outStream = new ByteArrayOutputStream(); getscaledImage(path).compress(Bitmap.CompressFormat.JPEG, 100, outStream); return outStream; } public ByteArrayOutputStream getBitmap(int quality){ ByteArrayOutputStream outStream = new ByteArrayOutputStream(); getscaledImage(path).compress(Bitmap.CompressFormat.JPEG, quality, outStream); return outStream; } public String getComressFile(){ FileOutputStream out = null; String filename = createImageFile(); try { out = new FileOutputStream(filename); getscaledImage(path).compress(Bitmap.CompressFormat.JPEG, 80, out); } catch (FileNotFoundException e) { e.printStackTrace(); } File file = new F…
has comment: http://stackoverflow.com/comment/39329357
has comment: http://stackoverflow.com/comment/39329734
has comment: http://stackoverflow.com/comment/39333071
has comment: http://stackoverflow.com/comment/39332568
type: Question
has title: Resizing pictures while still preserving quality in android
score: 3
upvote count: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39329341
has answer: http://stackoverflow.com/a/25246293
linked to: http://stackoverflow.com/q/11081598
tagged with: image
favorite count: 0

http://stackoverflow.com/q/25309748
upvote count: 7
tagged with: jvm
accepted answer: http://stackoverflow.com/a/25318740
favorite count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25318740
has comment: http://stackoverflow.com/comment/39466634
score: 7
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/39450746
tagged with: jvm-arguments
has comment: http://stackoverflow.com/comment/39455274
has title: What is thread stack size option(-Xss) given to jvm? Why does it have a limit of atleast 68k in a windows pc?
linked to: http://stackoverflow.com/q/4967885
downvote count: 0
has body: I have seen JVM option -Xss - What does it do exactly? this link, but my question is how is this option useful. Because, if we set a very minimum limit to the -Xss value, maybe the threads are not going to work properly as it may throw stackOverflow error most of the times. Why is there a 64k limit at least for this value? How i got this 64k limit is when i was trying to configure the runtime vm options on the IntelliJ iDE, I tried to give some thing like 10k and it popped up this error stating it needs at least 64k for thread stack size. Another question is that, how to find the default thread stack size of my jvm running in my embedded device from a java program? Thanks, Sen
answer count: 1

http://stackoverflow.com/comment/39542707
type: Comment
type: QuestionComment
has text: Can't you add the package as well in that XML setting?
score: 2
comment on: http://stackoverflow.com/q/25360664

http://stackoverflow.com/q/25261833
answer count: 0
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/39360839
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39362193
has comment: http://stackoverflow.com/comment/39361097
has title: ClassNotFoundException for MessagingException class even though it exists in mail.jar included by Maven
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39361240
tagged with: maven
has body: [1]:Package explorer showing that mail.jar included in maven dependencies indeed has javax.mail.MessagingException class [2]:Console output showing that javax.mail.MessagingException is missing. Basically, I have included mail.jar in Maven dependencies and it has MessagingException class as well, but while executing the jar file using Maven, it throws a ClassNotFoundException for the aforementioned class. Any ideas why that could be happening ?
has comment: http://stackoverflow.com/comment/39363269
has comment: http://stackoverflow.com/comment/39362911
score: 0
tagged with: jakarta-mail

http://stackoverflow.com/q/25376089
favorite count: 0
type: Question
upvote count: 4
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/71509250
answer count: 2
has comment: http://stackoverflow.com/comment/39578828
has answer: http://stackoverflow.com/a/25376449
has comment: http://stackoverflow.com/comment/39572632
downvote count: 2
linked to: http://stackoverflow.com/q/7888064
has body: I'm new in JasperReports and I want to integrate a JasperReports into my Java program, so when I click print button the program will show the report. But I get a NoClassDefFoundError when I click the button. Code JButton btnReport= new JButton("Report"); btnReport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try{ String fileName= "src/learnReport/Leaf_Grey.jasper"; Connection con = connect.getConnect(); File file = new File(NameFile); JasperReport jasperReport = (JasperReport) JRLoader.loadObject(file); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null,con); JasperViewer.viewReport(jasperPrint,false); } catch(Exception ex){ System.out.println(ex); } } }); Runtime error Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at net.sf.jasperreports.engine.util.JRLoader.&lt;clinit&gt;(JRLoader.java:81) at learnReport.Learning$6.actionPerformed(Learning.java:195) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source)
linked to: http://stackoverflow.com/q/3988788
has title: NoClassDefFoundError: org/apache/commons/logging/LogFactory
accepted answer: http://stackoverflow.com/a/25376449
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39573260
has comment: http://stackoverflow.com/comment/39572666
tagged with: java
tagged with: noclassdeffounderror
possible better answer: http://stackoverflow.com/a/71509250

http://stackoverflow.com/comment/39360638
has text: Hi, thanks for your comment. Testing will be useful, but I don't think we can test every possible input and output. We can write many tests, and obtain a high degree of confidence that these base64 encoders are compatible, but we still will have some concerns I think.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25261714
score: 0

http://stackoverflow.com/comment/39572145
has text: Keep in mind the code is incomplete and I am a student.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25375408

http://stackoverflow.com/comment/39354903
has text: `File` cannot describe jar entries, you should not use it for that. Instead use `URL`s which can, and you can get their content by `URL.openStream()` which works fine both for files and jar/zip entries.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25258380

http://stackoverflow.com/comment/39462647
has text: By the way, readjusting priorities of already enqueued items is indeed slow but that's generally not a problem, as it's something that happens very infrequently compared to the two main operations. In an OS what might easily happen is that you adjust the `nice` but it won't change anything in the queue. Only when the thread reaches the front of the queue, is removed and requeued, does `nice` take effect.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25316190

http://stackoverflow.com/comment/39653762
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25381269
has text: thx Daniel I wil give it a try. Meanwhile I settle with ajax call to controller to retrieve values when 1st dropdown changed,
type: Comment

http://stackoverflow.com/q/25324773
tagged with: google-plus
tagged with: google-play-services
type: Question
has comment: http://stackoverflow.com/comment/66671221
has answer: http://stackoverflow.com/a/29510578
upvote count: 2
type: UnansweredQuestion
downvote count: 0
favorite count: 0
has title: "Choose an account" form does not disappear when clicking cancel
score: 2
has body: When the app is running for the first time. I ask the user to login to their Google Plus account. However, if the user clicks off the dialogue or clicks cancel. The dialogue to "Choose an account" will reappear continually. How do I change it so that the dialogue will only appear once, if cancelled, it will not show again. This code is stored in my OnCreate: if(VariableStore.loggedIn == false){ mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_PROFILE) .build(); }
tagged with: dialog
tagged with: android
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39597594
has text: Are you sure Java is right choice of technology for what you are trying to achieve ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25389376

http://stackoverflow.com/comment/39419457
type: QuestionComment
comment on: http://stackoverflow.com/q/25292666
type: Comment
score: 0
has text: Another thing that worked - when I choose Export on my MyLibrary project, I expand the swt project and from the main folder, select the DLL's to include in my JAR file. This also executes correctly. Plus, it is a single JAR zip, so it is a clean build to distribute.

http://stackoverflow.com/comment/39667514
comment on: http://stackoverflow.com/q/25345075
score: 0
type: Comment
type: QuestionComment
has text: Thanks Duncan. I'll try using the keys directly and see if that speeds anything up.

http://stackoverflow.com/a/25236727
score: 0
has comment: http://stackoverflow.com/comment/39314124
has body: Try this way,hope this will help you to solve your problem. activity_main.xml MainActivity.java public class MainActivity extends Activity { private LinearLayout lnrItems; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lnrItems = (LinearLayout) findViewById(R.id.lnrItems); for (int i=1;i<=15;i++){ ImageView imageView = new ImageView(this); imageView.setId(i); imageView.setTag(String.valueOf(i)); imageView.setImageResource(R.drawable.ic_launcher); imageView.setAdjustViewBounds(true); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this,"You've chosen ImageViews "+v.getTag().toString(),Toast.LENGTH_SHORT).show(); } }); lnrItems.addView(imageView); } } }
type: Answer
answers question: http://stackoverflow.com/q/25236546

http://stackoverflow.com/comment/39347319
score: 0
type: Comment
type: QuestionComment
has text: @dimoniy yes around 30 MB, I said 2 apps as an example but we are growing and new apps are getting added with same shared library(ies).
comment on: http://stackoverflow.com/q/25253711

jinternalframe
tags question: http://stackoverflow.com/q/25375813
tags question: http://stackoverflow.com/q/25322707
type: Tag
tag name: jinternalframe

http://stackoverflow.com/q/25290277
linked to: http://stackoverflow.com/q/7229226
has answer: http://stackoverflow.com/a/25290898
tagged with: jscrollpane
downvote count: 0
answer count: 1
tagged with: scroll
upvote count: 1
tagged with: swing
favorite count: 0
type: AnsweredQuestion
has title: ScrollBar is not working when Layout is null
has comment: http://stackoverflow.com/comment/39413956
score: 1
tagged with: java
tagged with: scrollbar
has body: Scroolbar doesnt appear when the layout set to null. How to get the scrollbar inside the panel? Is there any other way to achieve it. I want to get the scroll bar in the scrollPane import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; public class ScrollBarExample { public static void main(String... args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(); panel.setLayout(null); for (int i = 0; i &lt; 10; i++) { JButton jbutton = new JButton("Hello-" + i); jbutton.setBounds(i * 100, i*30, 100, 40); panel.add(jbutton); } JScrollPane scrollPane = new JScrollPane(panel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setBounds(50, 10, 320, 100); JPanel contentPane = new JPanel(null); contentPane.setPreferredSize(new Dimension(500, 400)); contentPane.add(scrollPane); frame.setContentPane(contentPane); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); } }
type: Question
accepted answer: http://stackoverflow.com/a/25290898

http://stackoverflow.com/a/25441419
has comment: http://stackoverflow.com/comment/60460316
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25367130
has body: Please see Meo's tip for com.intellij.ide.actions.CreateClassAction#doCreate. The code does the following: return JavaDirectoryService.getInstance().createClass(dir, className, templateName, true); And from here we can see different signatures in JavaDirectoryService Perhaps this one might be relevant: public abstract PsiClass createClass(@NotNull PsiDirectory dir, @NotNull String name) throws IncorrectOperationException;
answers question: http://stackoverflow.com/q/25367130
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/25260490
has title: How to create my own proxy for EJB stubs on AS level
favorite count: 0
has body: Is there a way how I can create my own proxy for remote EJB stubs? On application server level? I was researching the ORB related configuration, such is the property javax.rmi.CORBA.PortableRemoteObjectClass, but application servers do not implement it correctly (e.g. https://issues.apache.org/jira/browse/YOKO-429). And it is only related to CORBA, which I understood is only one of possible implementations. EDIT: the point of doing it at application server level is that I cannot modify application source code, all I get is EAR:
score: 1
tagged with: java
tagged with: stub
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25261666
tagged with: ejb
type: UnansweredQuestion
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39360014
has comment: http://stackoverflow.com/comment/39361748

http://stackoverflow.com/a/25239363
has body: Try using @repository or @EnableMongoRepositories
answers question: http://stackoverflow.com/q/25238573
type: Answer
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39337166
has text: Is there a reason you would want to do this without an `if`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25249082
score: 5

http://stackoverflow.com/q/25253713
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25253855
tagged with: http://stackoverflow.com/tag/csv
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25253855
has body: I am trying to make a program that is basically virtual notecards. Each notecard has a string for a question and an answer as well as a count for now many times it has been asked. I am using a scanner in many instances and I think i am using it incorrectly, and am not quite sure why. The program will let me answer the first 2 questions, tell me they are incorrect no matter what, and skip letting me answer the last one. Here is the notecard class: public class Notecard { public String ans; public String q; public int count; public Notecard(String q, String ans) { this.q = q; this.ans = ans; this.count = 0; } public Boolean answer(String effort) { if (this.q.toUpperCase().equals(effort.toUpperCase())) { System.out.println("Correct!"); return true; } else { System.out.println("Incorrect! Correct answer:" + this.ans); count++; return false; } } public void clearCount() { this.count = 0; } public String getQ() { return this.q; } } and here is my other file: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import java.util.Scanner; public class CreateNotecard { int trys; public static void main(String[] args) { System.out.println("Get ready to be quizzed \n\n"); ArrayList&lt;Notecard&gt; notecards = makeCards(); quiz(notecards); } static ArrayList&lt;Notecard&gt; makeCards() { ArrayList&lt;Notecard&gt; notecards = new ArrayList&lt;Notecard&gt;(); try { BufferedReader in = new BufferedReader(new FileReader( "notecards.txt")); String str; str = in.readLine(); while ((str = in.readLine()) != null) { String[] argg = str.split(","); notecards.add(new Notecard(argg[0], argg[1])); } in.close(); } catch (IOException e) { System.out.println("File Read Error"); } return notecards; } static void quiz(ArrayList&lt;Notecard&gt; notecards) { ArrayList&lt;Notecard&gt; backupList = notecards; Scanner sc = new Scanner(System.in); long seed = System.nanoTime(); Collection…
possible better answer: http://stackoverflow.com/a/25253793
has title: Java Scanner issues, Notecard class
type: Question
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39346552
has answer: http://stackoverflow.com/a/25253793

http://stackoverflow.com/a/25348090
answers question: http://stackoverflow.com/q/25347981
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The lines where you write l = lengthField.getText(); length = Float.parseFloat(l); and so on with width. This is because the value of l is null. You are writing this code inside constructor and expecting that user will give input. But before even he can give input in your constructor you are trying to get text which is never set by the user and thus a null value. A null value cannot be converted to float. Try catching the exception and pribt stack trace which will reveal where your problem is and what value you are trying to parse
accepted answer of: http://stackoverflow.com/q/25347981

http://stackoverflow.com/a/25349628
has body: You are searching for "Belgium France", but you don't have this item in your list (in one String object). You will have to create custom Adapter which implements Filterable with custom Filter.
type: Answer
answers question: http://stackoverflow.com/q/25349576
score: 0

http://stackoverflow.com/q/25322046
type: Question
has comment: http://stackoverflow.com/comment/39472617
type: UnansweredQuestion
has title: Spinner items not showing at first time
tagged with: android
has answer: http://stackoverflow.com/a/25339588
score: 0
answer count: 2
tagged with: java
has body: I have activities- StartupActivity and MainActivity. In StartupActivity i am inserting some data in a table and staring the MainActivity by using intent. Code inside StartupActivity : db.addFriend("userNameTest"); //db is a DataBase handler class and has been initialized inside onCreate() Intent home = new Intent(StartUp.this, MainActivity.class); startActivity(home); finish(); Data is inserting successfully, as i can see them in the DB table. Also, MainActivity is starting properly. Inside MainActivity i am retrieving the data from table and showing in a spinner. Code inside onCreate method of MainActivity : List&lt;String&gt; list = db.getFriends(); dataAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); friendSpinner.setAdapter(dataAdapter); friendSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int position, long id) { String frnd_name = (String)dataAdapter.getItem(position); } @Override public void onNothingSelected(AdapterView&lt;?&gt; adapter) { } }); Spinner is not showing any data for the first time but if i press back button and than again navigate back to the activity it shows data in spinner. Plus, it only dosent show data when first run at installation time; after that for each run it shows data. What can be the reason for this? Help me out please. Another thing will be also helpful. if i add some data in the table and than try to refresh the dataAdapter of spinner or spinner itself. How am i going to do that? For now, i am just using the above code again; as i have tried dataAdapter.notifyDataSetChanged();- which isn't working.
has answer: http://stackoverflow.com/a/25323841

http://stackoverflow.com/comment/39413514
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25290036
has text: Guys, I've just edited the question. I formulated it incorrectly. The code is checking whether the search string contains any of the string in the collection. Not whether any string in the collection contains the search string. Sorry about the confusion.

http://stackoverflow.com/a/25354210
has comment: http://stackoverflow.com/comment/39531078
type: Answer
answers question: http://stackoverflow.com/q/25354112
has body: If you run this code it could lead to unpredictable results, as two threads can at the same time invoke newInstance method, both would see the entity field as null and both would create new Entity. In that case those two threads would have different instances of this class. You should have a static private field Entity entity in your class instead of getting it from the map. That's why you should use synchronization. You could synchronize the whole method like that: public synchronized static Entity newInstance(UUID entityId) As an alternative you could use Double Check Locking which is better, but has to be done carefully - take a look at comments below. As to the thread safety of this class there's another matter - the map you are using. It makes the class Mutable because the state of the Entity object changes when the map is changed. Final is not sufficient in that case. You should store the map in some other class like EntityManager. I think your entity should be simple and should not be interested in the question 'am I unique' - it should be someone elses duty. So thats why I would suggest that Entity looked like this: public class Entity { private final UUID entityId; public Entity(UUID entityId) { this.entityId = entityId; } public UUID getEntityId() { return entityId; } } Now it's Immutable and will stay that way because its field is final and Immutable. If you want to add some fields make sure those are Immutable as well. As for storing I would suggest some holder class: import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public class EntityHolder { private static Map&lt;UUID, Entity&gt; entities; private static volatile EntityHolder singleton; public EntityHolder() { entities = new ConcurrentHashMap&lt;UUID, Entity&gt;(); } public Entity getEntity(final UUID id) { return entities.get(id); } public boolean addEntity(final UUID id, final Entity entity) { synchronized (entities) { if (entities.containsKey(id)) { return …
has comment: http://stackoverflow.com/comment/39534647
has comment: http://stackoverflow.com/comment/39536316
score: 0
has comment: http://stackoverflow.com/comment/39531353

http://stackoverflow.com/a/25302121
type: Answer
accepted answer of: http://stackoverflow.com/q/25301531
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: I think you are overcomplicating yourself a lot. The two apps should never have anything to do with each other. No matter what ecosystem they're running on (whether iOS, Android, Windows, etc) they shouldn't have to be aware of each other at all. The same applies to the service. It shouldn't be concerned about which client is being consumed by. It should only care about receiving a "client-agnostic" request and serve the response. Now, the service would be SOAP/XML, plain json text, whatever. It's the client's responsibility to produce the correct request and understand the response from the server. So, to answer your question... Is there a way that I can read those Streams with Swift? And it is of course not only the reading of the Stream. As I do send Java Object, for example a String, can I receive this Object in Swift? No, you're iOS app shouldn't have to deal with java code, it should only need to make the correct request to the server and understand the response...i.e. by making a service request using a NSURLConnection and parsing the response So, just focus on making the service endpoint(s) platform-agnostic so that any client can consume it
answers question: http://stackoverflow.com/q/25301531
has comment: http://stackoverflow.com/comment/39435801
has comment: http://stackoverflow.com/comment/39435935

http://stackoverflow.com/q/25386666
has comment: http://stackoverflow.com/comment/39592507
has comment: http://stackoverflow.com/comment/39592629
answer count: 1
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39592510
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39592569
has body: This code is only reading the first line. how can i read all the lines. here is my full code: package com.example.gdrgrg; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import android.os.Bundle; import android.app.Activity; import android.app.ProgressDialog; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends Activity { ProgressDialog dialog = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //////////////////////// final Button b=(Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog = ProgressDialog.show(MainActivity.this, "", "wait...", true); new Thread(new Runnable() { public void run() { uploadFile(); } }).start(); } }); //////////////////////////// }//on create end public int uploadFile() { final EditText et = (EditText) findViewById(R.id.editText1); // final TextView tv =(TextView)findViewById(R.id.textView1); HttpURLConnection connection = null; InputStream is = null; try{ connection = (HttpURLConnection) (new URL("http://sinhaladic.com/a/?enask=go" )).openConnection(); connection.setRequestMethod( "GET" ); connection.setConnectTimeout(5000); connection.setReadTimeout(10000); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setDoInput( true ); connection.setDoOutput( true ); connection.connect(); //Read the response is = connection.getInputStream(); BufferedReader br = new BufferedReader( new InputStreamReader( is )…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39592861
has comment: http://stackoverflow.com/comment/39592253
tagged with: readline
has title: readLine is only reading the first line. how can i read all the lines ? android
has comment: http://stackoverflow.com/comment/39592578
has answer: http://stackoverflow.com/a/25386805
tagged with: java

http://stackoverflow.com/q/25281639
type: UnansweredQuestion
tagged with: program-slicing
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/25672034
answer count: 1
downvote count: 0
has title: Backward slice generation for a java file
has body: I have a java file and I want to get all the lines that have impact on result of a specific line (Backward Slice Generation). I know the solution but is there any java code to do that? as an example cosider the following code: System.out.println("Start") Random r = new Random(); int i = r.nextInt(10); int n = 0; if(i<8) { n = 1; System.out.println("In if"); } int j = n * i; I need a code that find the following lines when I run it for line 10: Random r = new Random(); int i = r.nextInt(10); int n = 0; if(i<8) { n = 1; } int j = n * i;
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/39489225
comment on: http://stackoverflow.com/q/25330769
type: Comment
has text: Well do you know which class declares the method? Look at the documentation for `Class.getDeclaredMethods` etc.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25244259
answers question: http://stackoverflow.com/q/25244044
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39328069
has body: for updating data of fields in table : public void updateField(){ Query q=getSessionFactory().getCurrentSession().createQuery( " update SapOrderHDR set SAP_ORDER_STATUS = 'A' where BC_ORDER_NO='" + bcOrderNo + "'"); q.executeUpdate(); } This query will update table where BC_ORDER_NO=var and set BC_ORDER_NO ='A'. SapOrderHDR is table entity class
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25244044

http://stackoverflow.com/comment/39444271
type: AnswerComment
has text: Thanks for the answer. I have editing my question to explain more fully what I am confused about
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25297438

regex
tags question: http://stackoverflow.com/q/25315405
tags question: http://stackoverflow.com/q/25373220
tags question: http://stackoverflow.com/q/25292270
tags question: http://stackoverflow.com/q/25264731
tags question: http://stackoverflow.com/q/25242128
tags question: http://stackoverflow.com/q/25249105
tags question: http://stackoverflow.com/q/25336361
tags question: http://stackoverflow.com/q/25351421
tags question: http://stackoverflow.com/q/25349418
tags question: http://stackoverflow.com/q/25361475
tags question: http://stackoverflow.com/q/25353138
tags question: http://stackoverflow.com/q/25272230
tags question: http://stackoverflow.com/q/25293099
tag name: regex
tags question: http://stackoverflow.com/q/25381568
tags question: http://stackoverflow.com/q/25375738
tags question: http://stackoverflow.com/q/25290663
tags question: http://stackoverflow.com/q/25319343
tags question: http://stackoverflow.com/q/25266880
tags question: http://stackoverflow.com/q/25314324
tags question: http://stackoverflow.com/q/25277300
tags question: http://stackoverflow.com/q/25295935
tags question: http://stackoverflow.com/q/25369154
tags question: http://stackoverflow.com/q/25384728
tags question: http://stackoverflow.com/q/25235552
tags question: http://stackoverflow.com/q/25335183
tags question: http://stackoverflow.com/q/25235854
tags question: http://stackoverflow.com/q/25249375
tags question: http://stackoverflow.com/q/25287851
tags question: http://stackoverflow.com/q/25377696
tags question: http://stackoverflow.com/q/25386065
tags question: http://stackoverflow.com/q/25308478
tags question: http://stackoverflow.com/q/25238763
tags question: http://stackoverflow.com/q/25344296
tags question: http://stackoverflow.com/q/25366779
tags question: http://stackoverflow.com/q/25245725
tags question: http://stackoverflow.com/q/25284067
tags question: http://stackoverflow.com/q/25276477
tags question: http://stackoverflow.com/q/25238782
tags question: http://stackoverflow.com/q/25235583
tags question: http://stackoverflow.com/q/25253418
tags question: http://stackoverflow.com/q/25354465
tags question: http://stackoverflow.com/q/25365667
tags question: http://stackoverflow.com/q/25357666
tags question: http://stackoverflow.com/q/25240988
tags question: http://stackoverflow.com/q/25260093
tags question: http://stackoverflow.com/q/25337621
tags question: http://stackoverflow.com/q/25245892
tags question: http://stackoverflow.com/q/25230947
tags question: http://stackoverflow.com/q/25338558
tags question: http://stackoverflow.com/q/25333714
tags question: http://stackoverflow.com/q/25367207
tags question: http://stackoverflow.com/q/25369407
tags question: http://stackoverflow.com/q/25332362
tags question: http://stackoverflow.com/q/25284059
tags question: http://stackoverflow.com/q/25364918
tags question: http://stackoverflow.com/q/25314004
tags question: http://stackoverflow.com/q/25328610
tags question: http://stackoverflow.com/q/25312505
tags question: http://stackoverflow.com/q/25328589
tags question: http://stackoverflow.com/q/25308435
tags question: http://stackoverflow.com/q/25269493
tags question: http://stackoverflow.com/q/25349213
type: Tag
tags question: http://stackoverflow.com/q/25347010
tags question: http://stackoverflow.com/q/25250553
tags question: http://stackoverflow.com/q/25360121
tags question: http://stackoverflow.com/q/25377533
tags question: http://stackoverflow.com/q/25321089

http://stackoverflow.com/comment/39411424
comment on: http://stackoverflow.com/a/25282325
score: 0
type: AnswerComment
type: Comment
has text: Au contraire it would make the generic much more powerful. A static function is bound to a type and so is a generic argument. When you specify that you want and Array<Integer> you are binding your Array to the type Integer. If it weren't for type erasure we would be able to call static functions declared in Integer (e.g. GetMaxInteger).

http://stackoverflow.com/q/25360173
has title: Error installing R package
tagged with: http://stackoverflow.com/tag/r
has answer: http://stackoverflow.com/a/25365702
score: 0
linked to: http://stackoverflow.com/q/7019912
has comment: http://stackoverflow.com/comment/39542615
tagged with: java
has comment: http://stackoverflow.com/comment/39547073
has comment: http://stackoverflow.com/comment/39542234
tagged with: rjava
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26348222
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/39542168
tagged with: bigdata
has body: EDIT:1 I have already seen Using the rJava package on Win7 64 bit with R I have Windows 7 64-bit Machine with R 3.1.0, Java 7u67 64-bit installed. (NOTE: I am not allowed to update R) JAVA_HOME is set to C:\Program Files\Java\jre7 and PATH includes C:\Program Files\Java\jre7\bin and C:\Program Files\Java\jre7\server (the last entry is for jvm.dll file) From R prompt I can see that RStudio is using 64-bit R R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) &gt; .Machine$sizeof.pointer [1] 8 I can load rJava library just fine &gt; options(java.home="C:\\Program Files\\Java\\jre7\\") &gt; library(rJava) Warning message: package ‘rJava’ was built under R version 3.1.1 But when I try to install install bigR package on my machine and I am getting following error message &gt; install.packages("C:/local/bigr-1.0.tar.gz", repos = NULL, type = "source") Installing package into ‘C:/Users/alex/Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) * installing *source* package 'bigr' ... ** R ** inst ** preparing package for lazy loading Warning: package 'rJava' was built under R version 3.1.1 Error : .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'C:/Program Files/R/R-3.1.0/library/rJava/libs/x64/rJava.dll': LoadLibrary failure: The specified module could not be found. Error : package 'rJava' could not be loaded ERROR: lazy loading failed for package 'bigr' * removing 'C:/Users/alex/Documents/R/win-library/3.1/bigr' Warning in install.packages : running command '"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\alex\Documents\R\win-library\3.1" "C:/local/bigr-1.0.tar.gz"' had status 1 Warning in install.packages : installation of package ‘C:/local/bigr-1.0.tar.gz’ had non-zero exit status Any help to solve this problem will be much appreciated..

http://stackoverflow.com/q/25333658
has comment: http://stackoverflow.com/comment/39495113
tagged with: java
has comment: http://stackoverflow.com/comment/39495173
downvote count: 1
has comment: http://stackoverflow.com/comment/39495442
accepted answer: http://stackoverflow.com/a/25333974
tagged with: string
has title: String equals() doesn't work
has answer: http://stackoverflow.com/a/25333815
tagged with: integer
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39495360
has comment: http://stackoverflow.com/comment/39495318
tagged with: equals
has comment: http://stackoverflow.com/comment/39495104
has answer: http://stackoverflow.com/a/25334020
has comment: http://stackoverflow.com/comment/39495161
tagged with: android
has answer: http://stackoverflow.com/a/25333974
has comment: http://stackoverflow.com/comment/39495174
score: -1
answer count: 4
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25333764
possible better answer: http://stackoverflow.com/a/25333764
has comment: http://stackoverflow.com/comment/39495463
has body: This is a problem I've been trying to fix for 3 hours now. How the app works: I've got a list of numbers in a txt file (in assets). I'm reading that txt file line by line and I set the text of a TextView to the current line. Now I have to type the same number in an EditText. But if I compare the EditText and the current line, the app says they are not the same, although they are. I've got a file in assets with different numbers, like this: 3 9 8 14 [finish] The [finish] tag will be used later so I can finish the application, but is pretty unnecessary now. I've defined the following strings and views: public String curval; public EditText etds; public TextView curvalte; A part of my onCreate() method: etds = (EditText)findViewById(R.id.editText1); buttonds = (Button)findViewById(R.id.button1); curvalte = (TextView)findViewById(R.id.textView2); try { inds = this.getAssets().open(assetname); } catch (IOException e) { e.printStackTrace(); } readerds = new BufferedReader(new InputStreamReader(inds)); Now I'm reading from the file and setting it as text of curvalte: curval = readerds.readLine(); curvalte.setText(curval); And it works just fine. But then you have to type the same number that is now shown in curvalte in the EditText. If I try to use equals() on the text in EditText with curval, it always says that EditText.getText().toString doesn't equal curval: if(etds.getText().toString().equals(curval.toString()){ // The code here }else{ // This is what I get Toast.makeText(getBaseContext(), "Wrong answer!", Toast.LENGTH_LONG).show(); } Even if I enter the correct answer, I get that toast saying it's wrong. Removing the .toString() didn't fix it and I've got no idea what I could try. Maybe it's because of the string that actually contains a number?

http://stackoverflow.com/comment/39547207
type: Comment
type: AnswerComment
has text: That's the purpose of the `readBoolean`, which expect the writer to know when it is finished to tell the reader there is nothing left to read. Beside, he is reading a `file`, which you can expect to have an end.
comment on: http://stackoverflow.com/a/25361953
score: 0

filenotfoundexception
type: Tag
tag name: filenotfoundexception
tags question: http://stackoverflow.com/q/25242287
tags question: http://stackoverflow.com/q/25298582

http://stackoverflow.com/a/25345363
has body: TextureView was added in API level 14. In order to use it, you must target your app to at least this API level.
answers question: http://stackoverflow.com/q/25345350
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25345350

http://stackoverflow.com/q/25389354
score: 0
tagged with: linux
tagged with: java
has answer: http://stackoverflow.com/a/25392615
tagged with: classpath
tagged with: servlets
type: Question
has title: best way to specify packages location on linux machine
has comment: http://stackoverflow.com/comment/39597856
has comment: http://stackoverflow.com/comment/39597407
answer count: 1
accepted answer: http://stackoverflow.com/a/25392615
has body: I have several servlets that import many packages: import java.util.*; import java.security.*; import java.util.Date; import java.util.Properties; import java.util.ResourceBundle; import java.io.*; import java.io.FileWriter; import javax.naming.*; import java.text.SimpleDateFormat; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.*; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; import javax.naming.directory.*; import javax.naming.directory.Attribute; import javax.naming.directory.BasicAttribute; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.ModificationItem; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.activation.*; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import javax.crypto.Cipher; import java.security.KeyStore; import java.net.*; import java.sql.*; import java.awt.*; import java.awt.event.*; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.DriverManager; import org.apache.commons.codec.binary.Base64; My CLASSPATH has folowing in it: echo $CLASSPATH .:/usr/lib64/jvm/java:/usr/lib64/logi-lib:/usr/share/java:…
type: AnsweredQuestion

http://stackoverflow.com/a/25259107
answers question: http://stackoverflow.com/q/25258876
has comment: http://stackoverflow.com/comment/107898957
has body: It looks like the method is not mocked and the real method is called instead. PowerMock uses special test runner that can mock static methods. Put @RunWith(PowerMockRunner.class) and @PrepareForTest(IOUtils.class) annotations on your test class. See example at docs
has comment: http://stackoverflow.com/comment/39360389
type: AcceptedAnswer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/107789071
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25258876
type: Answer

http://stackoverflow.com/q/25255646
has answer: http://stackoverflow.com/a/25255759
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39349897
score: 3
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/39356352
downvote count: 1
has comment: http://stackoverflow.com/comment/39349859
has comment: http://stackoverflow.com/comment/39349964
favorite count: 0
possible better answer: http://stackoverflow.com/a/25256736
type: Question
has body: I encountered a problem when I tried to run the following code: ArrayList paretoSet=new ArrayList(); // contains a collection of ArrayList ArrayList&lt;Integer&gt; toPass=new ArrayList&lt;Integer&gt;(); int[] fParetoSet=new int[ParetoSet.size()]; int[] gParetoSet=new int[ParetoSet.size()]; for (int i=0;i&lt;paretoSet.size();i++){ toPass.clear(); toPass.add((Integer)paretoSet.get(i)); int [] totake=calculate(toPass); fParetoSet[i]=totake[0]; gParetoSet[i]=totake[1]; } ` where claculate(ArrayList x) is a method that takes an integer arraylist and returns an integer array. I can not make Paretoset an integer arraylist as it creates problem in other parts of my program. I encountered an exception in the line toPass.add((Integer)paretoSet.get(i)); as java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer How should I fix this problem? Thanks in advance
has comment: http://stackoverflow.com/comment/39350054
has title: How to fix: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer
accepted answer: http://stackoverflow.com/a/25255759
upvote count: 4
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39350028
has answer: http://stackoverflow.com/a/25256736

http://stackoverflow.com/a/25265399
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39368091
has body: There are 2 problems with the following: class HelloWorld { static main(args) { def server = Server.builder() .setHandler(new HttpHandler() { public void handle(final Ev ev){ ev.dispatch(this) } } }).build() server.start() } } One is mismatched curly braces in the anonymous inner class definition. There are 3 closing curly braces (}) in a row when there should only be 2. The other appears to be a bug in Groovy. See https://jira.codehaus.org/browse/GROOVY-7020.
score: 1
answers question: http://stackoverflow.com/q/25233327
accepted answer of: http://stackoverflow.com/q/25233327
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25341564
has comment: http://stackoverflow.com/comment/39509400
type: Answer
answers question: http://stackoverflow.com/q/25341507
has comment: http://stackoverflow.com/comment/39509324
score: 0
has body: I strongly encourage you to use a JSON library, such as Jackson, when dealing with JSON input, but: Since you write that you're working with {name=abc, key=[{name=1, value=2}, {name=3, set=4}]} and you say that you have an ArrayList&lt;Object&gt; I'm going to make an educated guess and say that your ArrayList contains a Map with name and key as keys. (And that you printed this map with System.out.println. Now if you have a map it's quite simple: Map&lt;String, Object&gt; map = (Map&lt;String, Object&gt;) myList.get(0); for (String key : map.keySet()) System.out.println("Key: " + key + " maps to value: " + map.get(key));
accepted answer of: http://stackoverflow.com/q/25341507
has comment: http://stackoverflow.com/comment/39509335
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39509315
has comment: http://stackoverflow.com/comment/39509444
has comment: http://stackoverflow.com/comment/39509423
has comment: http://stackoverflow.com/comment/39509506

http://stackoverflow.com/a/25285354
score: 4
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25285095
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25285095
has body: The short answer is yes. The garbage collector searches the object graph and can identify when object sub-trees have been disconnected and sweep the entire sub-tree; regardless of the fact a cycle exists in the subtree. If the instance of the C class gets collected; the GC will execute the finalizer and then destroy the object.
type: Answer

http://stackoverflow.com/comment/39342957
type: AnswerComment
has text: Yep: "The value must be of type int. It is popped from the operand stack and compared against zero."
type: Comment
comment on: http://stackoverflow.com/a/25251773
score: 2

http://stackoverflow.com/comment/39400237
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25281370
type: Comment
has text: The Twitch username is set in the MyBot.Java Class. Of Course its a username of a twitch acount i created for the bot purposes. should i edit the post above and write down the MyBot aswell?

http://stackoverflow.com/q/25286788
favorite count: 0
type: AnsweredQuestion
score: 0
has body: How can i share image with facebook sdk without installed native app? I need make one share button, but i don't know how can i log in without LoginButton. Thanks in Advance
tagged with: android
tagged with: java
downvote count: 1
has title: How to share image from app with facebook sdk without native app?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25287002
upvote count: 1
tagged with: facebook
has answer: http://stackoverflow.com/a/25287002
has answer: http://stackoverflow.com/a/25287054
accepted answer: http://stackoverflow.com/a/25287054
tagged with: share

http://stackoverflow.com/a/25234189
score: 0
has body: Change your main method as follows, and it will work public static void main(String[] args) { String x = "There was once a sword in the stone"; String[] tempstring = WordParser.getWords(x); for (int i = 1; i &lt;= tempstring.length; i++){ System.out.println("Word " + i + " : " + tempstring[i - 1]); } } For the WordParser you could use, public class WordParser { public static String[] getWords(String tempone) { return tempone.split(" "); } }
answers question: http://stackoverflow.com/q/25234032
type: Answer

http://stackoverflow.com/comment/39423234
type: QuestionComment
has text: @yshavit - Yep. And ideally you should figure out some way to "crowd source" step 3 as well.
comment on: http://stackoverflow.com/q/25295265
score: 0
type: Comment

http://stackoverflow.com/comment/39539945
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25358983
has text: thanks for helping anyway but i'm self learning on past school work and it states i have to use the `try-catch exception` :D

http://stackoverflow.com/comment/39446040
score: 0
type: Comment
type: AnswerComment
has text: Yes you are right! I changed it but no chance! Still experiencing the same problem.
comment on: http://stackoverflow.com/a/25307880

http://stackoverflow.com/comment/39650070
type: Comment
type: QuestionComment
score: 0
has text: The android emulator is shown. It looks great in there. I'm going to try Shai's suggestion and see how it goes.
comment on: http://stackoverflow.com/q/25388435

http://stackoverflow.com/q/25367100
linked to: http://stackoverflow.com/q/25191190
has comment: http://stackoverflow.com/comment/39555190
type: AnsweredQuestion
score: 0
has title: How to get facebook permissions (contents)?
has body: I read the docs a lot from Facebook, but I don't see something which helps me to get the email or the id. I searched also in Google but there was nothing helpful. I have an app to log in and log out, but I need to use the email and the id!
answer count: 1
linked to: http://stackoverflow.com/q/15127783
has comment: http://stackoverflow.com/comment/39555953
has comment: http://stackoverflow.com/comment/39555154
type: Question
accepted answer: http://stackoverflow.com/a/25367428
tagged with: android
tagged with: java
tagged with: facebook
has answer: http://stackoverflow.com/a/25367428
has comment: http://stackoverflow.com/comment/39554986

http://stackoverflow.com/a/25386935
has comment: http://stackoverflow.com/comment/39605512
type: Answer
has body: Make use of multiple threads, although you should read up on concurrency if you're going to edit the same objects from multiple threads. public static void main(String[] args) { new Thread() { public void run() { method1(); } }.start(); new Thread() { public void run() { method2(); } }.start(); //etc //or, as kingdamian42 pointed out, if you use java8, use this new Thread(() -&gt; method1()).start(); new Thread(() -&gt; method2()).start(); }
upvote count: 11
has comment: http://stackoverflow.com/comment/39592772
accepted answer of: http://stackoverflow.com/q/25386839
has comment: http://stackoverflow.com/comment/39592880
answers question: http://stackoverflow.com/q/25386839
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39592843
score: 11
has comment: http://stackoverflow.com/comment/39592732
has comment: http://stackoverflow.com/comment/39592830

http://stackoverflow.com/comment/39381868
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25270819
has text: One of the classic examples of "Use the source Luke!"

http://stackoverflow.com/comment/39420305
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25293368
has text: @laune: It seemed to me that his intent may have been to plug the sysout post the braces. If not its as u said compiler rejection in which case my apologies
type: Comment

http://stackoverflow.com/q/25247556
tagged with: lucene
tagged with: n-gram
tagged with: sentence
answer count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3656762
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39354373
favorite count: 0
type: Question
has title: N-grams from a Sentence [Lucene 4.9]
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39338465
linked to: http://stackoverflow.com/q/13433670
has body: I am trying to implement an example that is able to generate n grams from a sentence (same question asked here N-gram generation from a sentence) with the current latest version of Lucene (Lucene 4.9). I found several examples, but made ​​with previous versions of Lucene (one on all http://toolongdidntread.com/lucene/using-lucene-to-generate-n-grams/). In all the examples, if you do not use the correct libraries (the correct version), I get an "abstract method error". Can someone help me to implement an example, using libraries of version 4.9? Thanks in advance.

http://stackoverflow.com/a/25320808
score: 0
answers question: http://stackoverflow.com/q/25320756
has body: you can use the in your servlet
type: Answer

http://stackoverflow.com/comment/39342161
type: QuestionComment
comment on: http://stackoverflow.com/q/25251529
type: Comment
score: 0
has text: Yep, not nearly enough info to go on.

http://stackoverflow.com/comment/39330969
comment on: http://stackoverflow.com/q/25245421
type: QuestionComment
has text: @JonSkeet:I have started with a string..but i am getting that from other system which is tibco BW.Where this output was in bytes...i am assuming it as string and then reading the bytes out of it.If i can directly take bytes in places of that String bwmsg,please let me know.
score: 0
type: Comment

http://stackoverflow.com/comment/39456755
score: 0
comment on: http://stackoverflow.com/a/25291418
type: Comment
type: AnswerComment
has text: The exact opposite. I know everything about the dll because it is generated at the same time as its Java wrapper. That is why an equivalent of Reflection.Emit that produces Java code would help, and why generating Java in text format then compiling it with javac would work. Doing that feels like living in the early 90s again though :-)

http://stackoverflow.com/a/25761041
type: Answer
has body: Ok, i found for my case, I must create new thread in order to make server can chatting like client. Create a new thread for server before it's close sync, im using ChatServerBroadcast. then call it direct to handler using static to send to all channels active. ChatServer.java/run ChannelFuture f = boostrap.bind(PORT).sync(); ChatServerBroadcast cst = new ChatServerBroadcast(); f.channel().closeFuture().sync(); ChatServerBroadcast.java public class ChatServerBroadcast implements Runnable{ private String message = ""; public ChatServerBroadcast() { new Thread(this).start(); } @Override public void run() { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Ready to chat "); while(true) { try { message = in.readLine(); } catch (IOException e) { message = ""; } if(!message.isEmpty()) { message = "[SERVER BROADCAST] " + message + "\r\n"; ChatServerhandler.sendServerMessage(message); message = ""; } } } } ChatServerHandler.java/sendServeMessage(String) public static void sendServerMessage(String message) { if (channels.isEmpty()) { return; } channels.writeAndFlush(message); } Maybe it can help someone looking answer in case like me.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25378256
has comment: http://stackoverflow.com/comment/49933908
answers question: http://stackoverflow.com/q/25378256

http://stackoverflow.com/comment/39496448
comment on: http://stackoverflow.com/a/25334000
type: Comment
score: 0
has text: You should be able to use int x from the for loop. If that works out for you please make sure you up vote my answer and accept the answer by clicking the gray check box :).
type: AnswerComment

http://stackoverflow.com/a/25308539
has body: That happens because the increment in RP (note, double-check variable conventions) is taking place one level above your while loop iteration. A quick solution would be to invert the hierarchy of the loops, placing the for loop inside the while loop. As such: String line; while ((line = br.readLine()) != null){ for (int RP = 0; RP &lt; noOfRPs; ++RP){ String pattern = "^RP" + RP; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(line); if (m.find()) System.out.println("match = " + line); } }
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25308435
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39330696
type: Comment
type: QuestionComment
has text: All the answers so far are correct - you'll need to increment the PermGen Space. However, setting -Xmx256m sounds like ridiculously low - you'll most likely need to increase this next. Code and static blocks end up in PermGen, thus more plugins require more permgen space. You'll typically set this in tomcat's setenv.bat or setenv.sh in CATALINA_OPTS. To learn more, see the "Related" questions and answers on the right of this page - there's a lot of information already available about exactly this issue
score: 0
comment on: http://stackoverflow.com/q/25242984

http://stackoverflow.com/comment/39518967
score: 0
has text: Servlet container manages the servlets lyfecycle. You shouldn't instatiate servlets manually
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25347360

http://stackoverflow.com/a/25332337
upvote count: 1
has comment: http://stackoverflow.com/comment/40922797
has comment: http://stackoverflow.com/comment/39516820
has comment: http://stackoverflow.com/comment/40923682
accepted answer of: http://stackoverflow.com/q/25310915
has comment: http://stackoverflow.com/comment/39516841
type: Answer
has comment: http://stackoverflow.com/comment/40924250
answers question: http://stackoverflow.com/q/25310915
has comment: http://stackoverflow.com/comment/39531541
score: 1
has body: Every node needs to have the same configuration/jars etc. Currently the MapLoader.loadAllKeys is executed on one of the nodes in the cluster. Once the keys are loaded, they are assigned to the owning partitions where the actual data is loaded using the MapLoader.loadAll(keys) method. Do you think sharing the same configuration/jars is a problem?
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39494046

http://stackoverflow.com/comment/39475166
has text: @Sayse, yeah, maybe you right. But it's so sad, because we can't be sure about that. I think compiler developers may know the true answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25323202
score: 0

http://stackoverflow.com/q/25278852
has answer: http://stackoverflow.com/a/25279087
has body: I am using graphviz to parse a code to tree image. You know, Graphviz is read a file and then write to file image. So, how to write that file into temporary folder in windows and then read that file again. This is my code : DOTTreeGenerator gen = new DOTTreeGenerator(); StringTemplate st = gen.toDOT(tree); String OS = System.getProperty("os.name"); Runtime rt = Runtime.getRuntime(); try { File file = new File("D:\\workspace\\output.dot"); // create a file BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsoluteFile())); bw.write(st2); bw.close(); String dotPath = "C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe"; String fileInputPath = "D:\\workspace\\output.dot"; String fileOutputPath = "D:\\workspace\\treeImage.png"; String tParam = "-Tpng"; String tOParam = "-o"; String[] cmd = new String[5]; cmd[0] = dotPath; cmd[1] = tParam; cmd[2] = fileInputPath; cmd[3] = tOParam; cmd[4] = fileOutputPath; rt.exec(cmd); } catch (IOException ex) { System.out.println("Failed to write to file"); } }
type: Question
has title: How to write and read file to temporary folder in windows
type: UnansweredQuestion
tagged with: graphviz
has answer: http://stackoverflow.com/a/25278994
score: 0
answer count: 2
tagged with: java

http://stackoverflow.com/comment/39350076
score: 0
has text: I'm curious though, now that it's working, if you delete the xml file, then running the dev server regenerate it again?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25254514

http://stackoverflow.com/comment/39354610
has text: `java.io.File` is for referencing artefacts on the file system. Individual JAR entries are not visible to the file system.
comment on: http://stackoverflow.com/q/25258144
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39314096
score: 0
has text: you can get json objects from jsonarray for ex. JSONArray jarray = new JSONArray(jsonStr); JSONObject c = new JSONObject(); c = jarray.getJSONObject(i);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25236687

http://stackoverflow.com/comment/39474421
has text: When copying different input files (every copy has its own source file), the results are the same. When copying to different output file, then closing is fast of course. Fix is easy - delete the file if doing overwrite (as Files.copy do it). I didn't want to measure throughput - I was just curious why it is happening and your answer is the best so far when it comes to question "Why?" :-)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25309351
score: 0

http://stackoverflow.com/comment/39419185
type: QuestionComment
score: 0
has text: paste the logcat error here... alteast give the error line where the error is mentioned in logcat
comment on: http://stackoverflow.com/q/25290790
type: Comment

http://stackoverflow.com/q/25375269
tagged with: multidimensional-array
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25375612
favorite count: 0
tagged with: user-input
type: Question
has title: getting an index from array and output it in java
answer count: 1
downvote count: 0
tagged with: bufferedreader
upvote count: 1
has comment: http://stackoverflow.com/comment/39571384
has answer: http://stackoverflow.com/a/25375612
has body: I want to be able to choose an array index using input. Object stud1 [][] = { {1,2,3}, {"favorite food: ","pet name: ","bday: "} } System.out.println("how many inputs?"); If a user inputs 1, then "favorite food:" will prompt the user and if the user inputs 2, then both "favorite food: " and "pet name: " will prompt the user and so on. After the user completes the prompt input, this will display: favorite food: chicken pet: doge birthday: december 25,1994 /////////////////////////////////////////my code///////////////////////////////////////////// This question is similar to my other question, I just could not find the right answer for my question because I think it was confusing and not specific enough. It's kind of working already but the problem is that when I input 1 then it still outputs everything. I only want it to output everything if the user inputs 3 which is the number of indexes in my array. I am not pretty good with arrays yet especially multi array, I'm still experimenting. String ctr1; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter How Many Inputs: "); int num1 = Integer.parseInt(in.readLine()); if (num1 &lt;= stud1.length) { for (int x = 1; x&lt;stud1.length;x++){ for (int i = 0; i&lt;stud1[x].length;){ /*System.out.print("Enter Value #" + x++ +":"); ctr1 =Integer.parseInt(in.readLine()); i++;*/ System.out.println(stud1[x][i]); ctr1 =in.readLine(); i++; } }
type: AnsweredQuestion

http://stackoverflow.com/comment/57371235
comment on: http://stackoverflow.com/a/25363398
has text: It may be useful also to ignore case for a query, using: findByPlaceIgnoreCaseContaining(String place);
type: Comment
score: 41
type: AnswerComment

http://stackoverflow.com/q/25332776
tagged with: jpa
has comment: http://stackoverflow.com/comment/39496203
downvote count: 0
upvote count: 1
tagged with: spring
has body: I'm working on a software that uses JSF(2.1)/JPA(Hibernate)/Spring/Jboss7.1. The user will have many clients, and their data wont be used together. So, I have these tables: Company ID | Name 1 | Foo 2 | Bar Products ID | Company_ID | Name 1 | 1 | Doll 01 2 | 1 | Doll 02 3 | 2 | Candy When working on company 1, the user doesn't need the data from Company 2. Today, all I have to do is use a where clause. However the DBA thinks we might have problems when the data get really high, and suggests we should use One scheme for each company. So, the above structure would be something like this: GeneralScheme.Company ID | Name 1 | Foo 2 | Bar Company1.Products Company2.Products ID | Name ID | Name 1 | Doll 01 3 | Candy 2 | Doll 02 He says, this way would be easier to make specifics backups, and performance could be better as well. But, is it possible to work this way on JPA? Changing the scheme at runtime? And creating new schemes as well since the user might add others companies? Thanks.
has answer: http://stackoverflow.com/a/25333402
linked to: http://stackoverflow.com/q/25041000
tagged with: postgresql
has comment: http://stackoverflow.com/comment/39493411
tagged with: java
has answer: http://stackoverflow.com/a/25333442
tagged with: hibernate
score: 1
has title: Jpa with dynamic scheme
favorite count: 0
type: Question
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/25299687
downvote count: 0
answer count: 1
tagged with: monitoring
favorite count: 0
type: Question
has title: Use AspectJ to monitor database access methods
tagged with: java
has body: I want to use AspectJ to monitor database statements. When I define the pointcut as @Pointcut("execution(* java.sql.*Statement.execute*(..))") it does not work. But when I define the pointcut as @Pointcut("execution(* *.*(..))") it can monitor all methods. How can I define the pointcut to monitor database access methods only?
tagged with: aop
score: 2
tagged with: aspectj
has answer: http://stackoverflow.com/a/25303621
upvote count: 2
tagged with: sql
type: UnansweredQuestion

http://stackoverflow.com/a/25370330
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25370256
has body: Here you read 2 lines: while(bf.readLine() != null){ array[i] = bf.readLine(); // System.out.println(array[i]); This line is for testing i++; } You have to change your Code to: String line = null; while((line =bf.readLine()) != null){ array[i] = line; // System.out.println(array[i]); This line is for testing i++; }
type: Answer

http://stackoverflow.com/comment/39556086
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59523/discussion-between-2851999-and-diversity).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25366080
type: AnswerComment

http://stackoverflow.com/a/25313271
type: Answer
answers question: http://stackoverflow.com/q/25297909
downvote count: 0
upvote count: 1
has body: Here's a combo with the effect of a custom popup of JMenu's. The actual popup is hidden, and a second popup is displayed when appropriate. Upon selection of a JMenuItem, the combo is populated with just that one item, displayed in breadcrumb format. import java.awt.*; import java.awt.event.*; import java.util.*; import java.util.List; import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.basic.*; import javax.swing.plaf.metal.*; public class JMenuComboBoxDemo implements Runnable { private Map&lt;String, String[]&gt; menuData; private JComboBox&lt;String&gt; combo; private AbstractButton arrowButton; private JPopupMenu popupMenu; private List&lt;String&gt; flattenedData; public static void main(String[] args) { SwingUtilities.invokeLater(new JMenuComboBoxDemo()); } public JMenuComboBoxDemo() { menuData = new HashMap&lt;String, String[]&gt;(); menuData.put("Colors", new String[]{"Black", "Blue"}); menuData.put("Flavors", new String[]{"Lemon", "Lime"}); popupMenu = new JPopupMenu(); popupMenu.setBorder(new MatteBorder(1, 1, 1, 1, Color.DARK_GRAY)); List&lt;String&gt; categories = new ArrayList&lt;String&gt;(menuData.keySet()); Collections.sort(categories); // copy of the menuData, flattened into a List flattenedData = new ArrayList&lt;String&gt;(); for (String category : categories) { JMenu menu = new JMenu(category); for (String itemName : menuData.get(category)) { menu.add(createMenuItem(itemName)); flattenedData.add(category + " &gt; " + itemName); } popupMenu.add(menu); } combo = new JComboBox&lt;String&gt;(); combo.setPrototypeDisplayValue("12345678901234567890"); combo.setUI(new EmptyComboBoxUI()); for (Component comp : combo.getComponents()) { if (comp instanceof AbstractButton) { arrowButton = (AbstractButton) comp; } } arrowButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { setPopupVisible(! popupMenu.isVisible()); } }); combo.addMouseListener(new MouseAdapter() { @Override public void mouseCli…
score: 1

http://stackoverflow.com/comment/39590020
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25344111
has text: Thanks. Even if I parse developer certificate under element from embedded.provison. Does it signifies the vendor of the app? like in java.

http://stackoverflow.com/comment/39356095
score: 0
type: QuestionComment
has text: That's a very useful post. I decided to make use of JDialog and it works perfectly. Thanks.
comment on: http://stackoverflow.com/q/25250726
type: Comment

http://stackoverflow.com/comment/39449168
type: Comment
comment on: http://stackoverflow.com/a/25233366
score: 0
has text: See also: http://stackoverflow.com/questions/25283767/how-to-use-spring-managed-hibernate-interceptors-in-spring-boot
type: AnswerComment

http://stackoverflow.com/comment/39430467
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25299092
has text: Thank you!!! I did as you said and added this line of code for it to work... `qnum[i] = new Q_Panel();` However, I it allows me to select more than one radio button. That I could not figure out how to fix it.. Thank you so much!

http://stackoverflow.com/comment/39472775
type: Comment
has text: But OP wants "Bart12","Lisa", "Marge", "Homer"
type: AnswerComment
comment on: http://stackoverflow.com/a/25318219
score: 0

http://stackoverflow.com/a/25258483
type: Answer
upvote count: 1
has body: 1) setBounds() is bad practice with null LayoutManager(setLayout(null)). 2) When you use FlowLayout, it calculates positions and sizes of components. So, you can't mixing 2 approaches. Examine how to use LayoutManager.
accepted answer of: http://stackoverflow.com/q/25258318
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/25258318
has comment: http://stackoverflow.com/comment/39355030
has comment: http://stackoverflow.com/comment/39354969
downvote count: 0

http://stackoverflow.com/comment/39422191
type: Comment
comment on: http://stackoverflow.com/a/25294907
score: 0
has text: id love too but i haven't the reputation to do this. Hopefully another user will up vote this as it is the correct answer
type: AnswerComment

http://stackoverflow.com/comment/39546923
type: AnswerComment
has text: Yes you can as Integer extends Number
score: 0
comment on: http://stackoverflow.com/a/25361853
type: Comment

http://stackoverflow.com/a/25320074
has body: Java Preferences is what you are looking for then. Or, instead of using XML file you can use Properties. ...i've heard that control the language from the database is an insult... I do not agree with that. I think it is scenario dependent, and in your case I think you should keep it the way it is to avoid unnecessary work, unless there is an absolute need for keeping the preferred idiom outside your DB.
type: Answer
has comment: http://stackoverflow.com/comment/39481236
has comment: http://stackoverflow.com/comment/39469600
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25319596

http://stackoverflow.com/comment/39476782
type: AnswerComment
comment on: http://stackoverflow.com/a/25324339
score: 1
has text: missed code important code line super.paintComponent and repaint is for JPanel, nor for JFrame
type: Comment

http://stackoverflow.com/comment/39478393
type: AnswerComment
score: 0
has text: @RuchiraGayanRanaweera OP told `infinity` which means he entered something which Scanner was not expecting so scanner.nextLine(); in catch probably fix it by telling scanner to allow him to re-enter
comment on: http://stackoverflow.com/a/25324929
type: Comment

http://stackoverflow.com/comment/39506224
type: Comment
has text: I found the failure: http://stackoverflow.com/questions/25338377/java-ee-class-not-found-despite-valid-import/25338542#25338542
comment on: http://stackoverflow.com/a/25333961
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39493627
type: Comment
comment on: http://stackoverflow.com/a/25332897
score: 2
type: AnswerComment
has text: That is actually allowed per SQLlite documentation. Its originally a SQL Server thing to allow spaces and other non-standard characters in names. http://www.sqlite.org/lang_keywords.html

http://stackoverflow.com/a/25246945
has comment: http://stackoverflow.com/comment/39334167
score: 0
answers question: http://stackoverflow.com/q/25246716
type: Answer
has body: Is it a capitalization problem? Nam vs Nam and String vs string. You have used all of these in your question. Variable and type names are case sensitive.
has comment: http://stackoverflow.com/comment/39346577

http://stackoverflow.com/q/25257920
tagged with: java
tagged with: hibernate
downvote count: 1
has comment: http://stackoverflow.com/comment/39354006
has body: I was checking the performance of my site on gtmatrix and found that Leverage browser caching is not well.They are showing that expiration date not specified to my css,js and images.For that i need to specify expiration date of them in .htaccess file.I read this but didn't understand how to make .htaccess file in java.My project is based on hibernate and i am using glassfish server.Could anybody tell me how to create .htaccess file in java.
linked to: http://stackoverflow.com/q/15067719
has comment: http://stackoverflow.com/comment/39354054
has comment: http://stackoverflow.com/comment/39355131
type: Question
has comment: http://stackoverflow.com/comment/39360745
linked to: http://stackoverflow.com/q/10528552
answer count: 0
has comment: http://stackoverflow.com/comment/39353924
upvote count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9031079
has comment: http://stackoverflow.com/comment/39362187
has comment: http://stackoverflow.com/comment/39362164
has comment: http://stackoverflow.com/comment/39354131
tagged with: .htaccess
has title: How to make .htaccess file in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/39354184
score: 0

http://stackoverflow.com/comment/39475267
type: Comment
comment on: http://stackoverflow.com/q/25323202
score: 0
type: QuestionComment
has text: @Eminem, thanks :) I think all .NET based languages will return 1.

http://stackoverflow.com/a/25364327
accepted answer of: http://stackoverflow.com/q/25363403
upvote count: 1
has comment: http://stackoverflow.com/comment/39550186
answers question: http://stackoverflow.com/q/25363403
has body: The error is, in jsp it should be modelAttribute="application": &lt;form:form method="post" action="/insert" modelAttribute="application"&gt; PS: you'd better add method="POST" in @RequestMapping
type: Answer
score: 1
type: AcceptedAnswer
downvote count: 0

android-listview
tags question: http://stackoverflow.com/q/25376922
tags question: http://stackoverflow.com/q/25244090
tags question: http://stackoverflow.com/q/25330067
tags question: http://stackoverflow.com/q/25282804
tags question: http://stackoverflow.com/q/25247224
tags question: http://stackoverflow.com/q/25336811
tags question: http://stackoverflow.com/q/25333387
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/25251876
tags question: http://stackoverflow.com/q/25367060
tags question: http://stackoverflow.com/q/25335715

http://stackoverflow.com/q/25232290
type: UnansweredQuestion
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39305245
has body: so im making a text based game and i want it so that every(number)XP you level up or PlayerLevel+1 static int Xp = 0; static int PlayerLevel = 1+XP/300 ; can not reference a field before it is defined
downvote count: 7
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39305279
score: -6
has title: static int Xp = 0; static int PlayerLevel = 1+XP/300 ; can not reference a field before it is defined
tagged with: java
has comment: http://stackoverflow.com/comment/39305252
has answer: http://stackoverflow.com/a/25232301
has comment: http://stackoverflow.com/comment/39305361
has comment: http://stackoverflow.com/comment/39305240
has comment: http://stackoverflow.com/comment/39305261

http://stackoverflow.com/q/25331064
tagged with: spring-4
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25337543
tagged with: authentication
type: Question
has title: Spring 4 - Authentication with preAuthorize & PostAuthorize
type: UnansweredQuestion
has body: NOTE: My application uses the latest version of the Spring framework, 4.0.6, 3.2.4 for security, and, it uses no xml but only Java-Config to configure the application. I have a set of services which I would like to secure with roles and other business specific authorization conditions. This services are grouped into a module (a jar) which is used by a REST application and a web application. I already have an AuthenticationProvider in the web application (REST application is in initial phase). I use @EnableGlobalMethodSecurityin the web application. Having said that, I now need to secure the methods in the services too. In that case, do I need to provide another authentication provider? Or, is right to move the authentication provider to the services module so that the web/rest apps uses the authentication provider in the services jar? If I configure @EnableGlobalMethodSecurity in the ApplicationServiceConfig.java of the services module, I get the blow exception. com.name.mvoice.project.service.ApplicationServiceConfig: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: An AuthenticationManager is required How do I configure the security if the application requires double authentication, one from the RDBMS and the other from the LDAP. The condition should be that the user information should be present and be enabled in both the systems. Do I need to write this in the existing authentication manager itself or shall I provide separate auth provider for the LDAP? If so how? WebSecurityConfig.java @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { AuthenticationProvider dbAuthenticationProvider = new DatabaseAuthenticationProvider(); auth.authenticationProvider(dbAuthenticationProvider ); // is it right to do like this AuthenticationProvider ldapAuthenticationProvider = new LDAPAuthenticationProvider(); auth.authenticationProvider(ldapAuthenticationProvider ); } Though, I seeAuthenticationMa…
tagged with: spring
tagged with: spring-mvc
score: 0

http://stackoverflow.com/q/25375482
has title: how to return a detail information of URL/author from cidoc crm rdf file using sparql
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/39800827
tagged with: jena
downvote count: 2
has body: Thank you for the answer but unfortunately i am not getting any result in the console, here i am attaching my code, please guide that where i am making a mistake. FileManager.get().addLocatorClassLoader(test.class.getClassLoader()); Model model=FileManager.get().loadModel("H:/EclipseWorkplace/MuseumDatabaseRecommendation/src/data3.rdf"); String spr="prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;\n"+ "prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;\n"+ "prefix crm: &lt;urn:x-stackoverflow:example#&gt;\n"+ "\n"+ "SELECT * WHERE{\n"+ " [ crm:E21_Person/rdfs:label ?creator\n"+ " ; crm:P108i_was_produced_by [ crm:P126_employed [ rdfs:label ?material ]\n"+ " ; crm:P4_has_time-span [ crm:P82_at_some_time_within ?timespan ]\n"+ " ]\n"+ " ; crm:P3_has_note [ a crm:P102_has_title\n"+ " ; rdfs:label ?title\n"+ " ]\n"+ " ]\n"+ " FILTER( ?creator = \"Brett WHITELEY\" ).\n"+ "}"; Query query = QueryFactory.create(spr); //s2 = the query above QueryExecution qExe = QueryExecutionFactory.create( query,model ); //QueryExecution qExe = QueryExecutionFactory.sparqlService( "http://dbpedia.org/sparql", query ); ResultSet results = qExe.execSelect(); ResultSetFormatter.out(System.out, results, query); My current output is ----------------------------------------- | creator | material | timespan | title | ========================================= ----------------------------------------- Thanks for your time.
has comment: http://stackoverflow.com/comment/39715502
score: -1
tagged with: sparql
has comment: http://stackoverflow.com/comment/39800671
type: AnsweredQuestion
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25510785
accepted answer: http://stackoverflow.com/a/25510785
answer count: 1
tagged with: eclipse

http://stackoverflow.com/a/25259872
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25259785
type: AcceptedAnswer
has body: Add the current directory . to the classpath: java -cp aspose-cells.jar:aspose-words.jar:aspose-slides.jar:. ConvertToPdf
answers question: http://stackoverflow.com/q/25259785
score: 3
upvote count: 3

http://stackoverflow.com/comment/39431417
comment on: http://stackoverflow.com/q/25299620
type: Comment
type: QuestionComment
has text: @alfasin what do you mean by registered?
score: 0

http://stackoverflow.com/q/25301531
tagged with: java
has title: RESTful/JAX-RS with Swift?
has comment: http://stackoverflow.com/comment/39438024
tagged with: swift
type: Question
score: 0
has body: I have built an Android application, which exchanges data with a server. For this purpose, there is a RESTful web service running on the server, written in Java with JAX-RS. The tricky thing is: I do exchange the data between application and server via Streams (Object- or FileOutputStream for example). Now I want to build the same application for iOS, using Swift. Is there a way that I can read those Streams with Swift? And it is of course not only the reading of the Stream. As I do send Java Object, for example a String, can I receive this Object in Swift? I think it is not possible and I have to get rid of all that Streaming stuff and use Media.Types. But maybe I do have a chance to leave it like that? Any ideas?
tagged with: stream
answer count: 1
upvote count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25302121
type: AnsweredQuestion
tagged with: rest
has answer: http://stackoverflow.com/a/25302121
has comment: http://stackoverflow.com/comment/39435436

http://stackoverflow.com/comment/39457386
type: Comment
comment on: http://stackoverflow.com/q/25313638
type: QuestionComment
has text: Good point @owlstead, from the beginning I was using something along the lines of (for a one-liner): `(new BASE64Encoder()).encode(decryptedSessionKeyBytes)`
score: 0

http://stackoverflow.com/q/25246739
answer count: 0
type: UnansweredQuestion
tagged with: ant
downvote count: 0
upvote count: 1
has title: How to fail an build when the file can not be found in an JAVA target using ANT
favorite count: 0
has body: When I run my ant script, the output on the console is like this: run: [java] java.io.FileNotFoundException: Source '../ui/css/kknormalize.css' does not exist [java] at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1074) [java] at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038) [java] at xmlReader.ProcessHBS.copyFiles(ProcessHBS.java:177) [java] at xmlReader.ProcessHBS.scriptSelection(ProcessHBS.java:115) [java] at xmlReader.DemoIt.main(DemoIt.java:53) There is an exception in java IO(the file can not be found). However in the final step of the console, it printed: BUILD SUCCESSFUL Total time: 3 seconds I set the fork to 'true' and failonerror to 'true' when running the ANT script. Is there a way to let the build fail when there is such an exception? Thanks.
tagged with: java
score: 1
type: Question
has comment: http://stackoverflow.com/comment/39334153

http://stackoverflow.com/q/25347664
type: Question
has body: I made a MySQL pooler (So i can perform sql in Async threads) - but soon decided to add some other database options(Sqlite). Sadly plain Sqlite seems to not fully "support" multiple connections making the pooler completely useless. I continued to read up about Sqlite and noticed it actually has a few thread options, one being simple multithread. My question is, how would i compile SQLite under -DTHREADSAFE=1? Or is it just suppose to be ran with that in the java arguments? I'm using Maven btw- Also, i'm very open to different database options. For instance, does h2 support async? Thanks!
score: 0
tagged with: sql
type: UnansweredQuestion
tagged with: multithreading
tagged with: sqlite
answer count: 1
has title: Java/SQLite - How to compile for -DTHREADSAFE=1?
has answer: http://stackoverflow.com/a/25347768
has comment: http://stackoverflow.com/comment/39521046
tagged with: java

http://stackoverflow.com/comment/39429502
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25298002
type: Comment
has text: Sorry it was a piece of the whole class so it declared above. Either I have found a working solution. It is messy but it works.

http://stackoverflow.com/q/25265629
tagged with: java
has answer: http://stackoverflow.com/a/25693265
accepted answer: http://stackoverflow.com/a/25693265
has body: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:289) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Maven dependencies: org.glassfish.jersey.ext jersey-spring3 2.11 log4j log…
linked to: http://stackoverflow.com/q/23277429
answer count: 2
tagged with: jersey
tagged with: servlet-3.0
tagged with: tomcat
type: Question
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25690966
tagged with: rest
has title: Tomcat 7 + Jersey 2.0 error
has comment: http://stackoverflow.com/comment/40155199
has answer: http://stackoverflow.com/a/25690966

http://stackoverflow.com/comment/39316262
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25237280
has text: Don't post incomplete answers and then go back and edit them immediately. Being first is not nearly so important as being useful, and think about what happens if you're called away, your internet goes down, SO goes into maintenance mode, ...
type: AnswerComment

http://stackoverflow.com/q/25364766
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/39550498
tagged with: java
has answer: http://stackoverflow.com/a/25364844
has comment: http://stackoverflow.com/comment/39550273
linked to: http://stackoverflow.com/q/1816673
type: Question
has body: I'm using this code to get some HDD data from Linux: public void getHDDInfo() throws IOException { try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD Model StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/model")).flatMap(wrap(Files::lines)) } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD Vendor StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/vendor")).flatMap(wrap(Files::lines)) } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD State StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/state")).flatMap(wrap(Files::lines)) .forEach(System.out::println); } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD Revision StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/rev")).flatMap(wrap(Files::lines)) .forEach(System.out::println); } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD SCSI Level StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/scsi_level")).flatMap(wrap(Files::lines)) .forEach(System.out::println); } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD SCSI is removable StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/removable")).flatMap(wrap(Files::lines)) .forEach(System.out::println); } try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(Paths.get("/sys/block"), "sd*")) { // Get HDD SCSI Level StreamSupport.stream(ds.spliterator(), false) .map(p -&gt; p.resolve("device/size")).flatMap(wrap(Files::lines)) .forEach(System.out::println); } } But sometimes not all files are available or some of them are empty. Then I get this exception…
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39550303
has title: Return null when file is missing or empty

http://stackoverflow.com/q/25259305
has answer: http://stackoverflow.com/a/25259375
has answer: http://stackoverflow.com/a/25259504
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39356524
tagged with: java
has body: Is there any memory/performance benefit of using the first method over the second? First public List&lt;Integer&gt; getList1(List&lt;Integer&gt; data) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for (Integer element: data) { if (element % 2 == 0) { list.add(element); } } return list.isEmpty() ? Collections.&lt;Integer&gt;emptyList() : list; } Second public List&lt;Integer&gt; getList2(List&lt;Integer&gt; data) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for (Integer element: data) { if (element % 2 == 0) { list.add(element); } } return list; }
tagged with: collections
has comment: http://stackoverflow.com/comment/39356581
favorite count: 0
accepted answer: http://stackoverflow.com/a/25259359
type: Question
has title: Return empty collection from a method
tagged with: performance
tagged with: garbage-collection
score: 4
upvote count: 4
possible better answer: http://stackoverflow.com/a/25259375
has answer: http://stackoverflow.com/a/25259359
type: AnsweredQuestion

http://stackoverflow.com/a/48772340
answers question: http://stackoverflow.com/q/25232541
type: Answer
has body: You just have to: delete .m2 repository. execute mvn clean install. That solved my problem
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/39457796
has text: Hint: see what `file.getAbsolutePath()` returns.
comment on: http://stackoverflow.com/q/25314135
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39576179
type: AnswerComment
has text: Yep works for me now (forgot to rebuild). But it's also true that it's throwing one char away.
comment on: http://stackoverflow.com/a/25377886
type: Comment
score: 0

http://stackoverflow.com/q/25319596
has comment: http://stackoverflow.com/comment/39469205
type: Question
has answer: http://stackoverflow.com/a/25319819
has title: Internationalize a Java Application?
has comment: http://stackoverflow.com/comment/39480960
possible better answer: http://stackoverflow.com/a/25320074
linked to: http://stackoverflow.com/q/1320709
has answer: http://stackoverflow.com/a/25323551
tagged with: internationalization
type: AnsweredQuestion
has body: I have a Java Desktop App, the users of the application have the availability to set the aplications language. By now i manage it in the database, i call the value of a field called - userLanguage - which is an Integer, and when the user has logged in depending on this value i set the corresponding text to each element on the app by using a switch ( case 1: set labels text ENGLISH, case 2: set labels text SPANISH ... etc) But i've heard that control the language from the database is an insult, and i would like to know which's a nice way to do it, or what's the best way to do so, it doesn't matter how difficult it would be but the efficence of the method to internationallize an app is what metters for me.
score: 0
has comment: http://stackoverflow.com/comment/39469216
answer count: 3
has comment: http://stackoverflow.com/comment/39468459
tagged with: java
has answer: http://stackoverflow.com/a/25320074
has comment: http://stackoverflow.com/comment/39468908
accepted answer: http://stackoverflow.com/a/25319819

http://stackoverflow.com/comment/39567789
has text: In future, consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25372938

http://stackoverflow.com/comment/39421618
type: QuestionComment
score: 0
has text: I dont know much about desktop application deployment but what I do know is that most people have their "Open With" messed up for jar files (myself included on many occasions). If you want the jar file to open up right on your machine then change the program it opens with. If you want to give it to a friend then use a tool or batch file suggested by @A4L that will smooth over that process so you dont have that headache.
comment on: http://stackoverflow.com/q/25294533
type: Comment

http://stackoverflow.com/a/43342245
answers question: http://stackoverflow.com/q/25257012
type: Answer
score: 2
has body: I wanted to get the same result, but I did not find the previous instructions given to be of any help. Neither I was able to find any other clear solution for this issue, so here's what I managed to get working after I read a bit of api-docs and did some testing of my own. Texture splashTexture = new Texture("texture1.png"); // Remember to dispose splashTexture.getTextureData().prepare(); // The api-doc says this is needed Pixmap splashpixmap = splashTexture.getTextureData().consumePixmap(); // Strange name, but gives the pixmap of the texture. Remember to dispose this also Pixmap pixmap = new Pixmap(splashTexture.getWidth(), splashTexture.getHeight(), Format.RGBA8888); // Remember to dispose // We want the center point coordinates of the image region as the circle origo is at the center and drawn by the radius int x = (int) (splashTexture.getWidth() / 2f); int y = (int) (splashTexture.getHeight() / 2f); int radius = (int) (splashTexture.getWidth() / 2f - 5); // -5 just to leave a small margin in my picture pixmap.setColor(Color.ORANGE); pixmap.fillCircle(x, y, radius); // Draws the texture on the background shape (orange circle) pixmap.drawPixmap(splashpixmap, 0, 0); // TADA! New combined texture this.splashImage = new Texture(pixmap); // Not sure if needed, but may be needed to get disposed as well when it's no longer needed // These are not needed anymore pixmap.dispose(); splashpixmap.dispose(); splashTexture.dispose(); Then use the splashImage (which is a class variable of type Texture in my case) to render the combined image where you want it. The resulting image has the given background and the foreground is a png image which has transparent parts to be filled by the background color.
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39451263
has text: What is `testResult`? Do you have access to that? Don't post code in comments, edit your question.
comment on: http://stackoverflow.com/q/25310551
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25363818
type: Question
tagged with: vote
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25364680
has comment: http://stackoverflow.com/comment/39548552
score: 2
upvote count: 2
tagged with: api
tagged with: reddit
tagged with: java
has body: I'm trying to get the percentage of upvotes for a given reddit post, or even the number of downvotes. I'm getting the JSON and parsing through it. I notice that the upvotes are readily available but not sure how accurate it is since it matches the score. I think getting the percentage is possible since reddit apps are able to display this information. Thanks in advance for any help.
answer count: 1
downvote count: 0
tagged with: percentage
has title: How do I get the percentage of upvotes using the Reddit API in java
favorite count: 0

http://stackoverflow.com/comment/39585968
type: Comment
type: AnswerComment
has text: thanks + 1 most easiest way :) i will accept your solution in 4 mins and ticked as useful already
score: 0
comment on: http://stackoverflow.com/a/25383497

http://stackoverflow.com/q/25283975
tagged with: amazon-web-services
has title: Does Amazon AWS provide open authentication same as facebook/twitter and google
has body: I want to know that as facebook , twitter and gmail etc. provide open authentication for login in to other application.Means as we can login into other websites using facebook ,twitter and gmail etc. authentication .Does Amazon web services (AWS) provide the API for authenticating user. If any one have used this .please assist how to allow user signup using aws account.
score: 0
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25287996
type: UnansweredQuestion
tagged with: amazon-ec2
tagged with: ruby-on-rails
tagged with: php

http://stackoverflow.com/comment/39574668
comment on: http://stackoverflow.com/a/25377320
score: 0
type: Comment
type: AnswerComment
has text: or is it the non-terminating recursion of `connect2Server()`

http://stackoverflow.com/comment/39304254
has text: Try `new ArrayList<>(10000)` in order to avoid excessive number of reallocations inside `ArrayList`.
comment on: http://stackoverflow.com/q/25231769
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39330050
type: QuestionComment
score: 0
has text: If any use already has record then he mot able to create records am I right?
type: Comment
comment on: http://stackoverflow.com/q/25245310

http://stackoverflow.com/comment/39305355
has text: @prashantthakre same error sir
comment on: http://stackoverflow.com/q/25232035
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25255633
has body: I am trying to use the XYGraph in the Nebula visualization tool from eclipse (http://www.eclipse.org/nebula/widgets/visualization/visualization.php) to create charts and graphs in my Java application, I am using Maven to manage my dependencies as I will be building the project on a remote machine which can then pull the dependencies as described in the Maven POM. My problem is, I can't find the dependency for Nebula ANYWHERE! I tried looking for the repo in repo.eclipse.org, the Maven central repo, even mvnrepository.com.The Nebula website contains a link to the download the P2 repo but no information about an m2 repo. I can't find the dependency anywhere and hence can't use it unless I manually import all the jars. Is there anyone who knows where I can find the XYGraph library dependency. I tried using all the repositories mentioned in http://wiki.eclipse.org/Services/Nexus but still no luck. Is there any other way I can get that dependency into my project using Maven. The way I'm trying out different repositories is by changing the content in the following xml tags: repo.eclipse.org Eclipse Nebula Plugin https://repo.eclipse.org true and org.eclipse.nebula org.eclipse.nebula.visualization.xygraph 1.0.0-SNAPSHOT Any help is greatly appreciated. Thank you.
type: AnsweredQuestion
tagged with: nebula
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/4955635
downvote count: 0
answer count: 1
tagged with: pom.xml
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39368433
has comment: http://stackoverflow.com/comment/39368891
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39349984
has answer: http://stackoverflow.com/a/25255757
accepted answer: http://stackoverflow.com/a/25255757
has comment: http://stackoverflow.com/comment/39484364
has title: Need help finding xygraph dependency in Maven
tagged with: maven

gmail
type: Tag
tags question: http://stackoverflow.com/q/25290162
tags question: http://stackoverflow.com/q/25346666
tag name: gmail

http://stackoverflow.com/a/25320664
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25320633
has body: Correct your query as follows: "update takenOutTbl set [Random Calculations] = [Random Calculations] + " + fine Because of the space in your column name, you have to help out MS Access a little bit and indicate that Random Calculations is one column. You do this by enclosing the column name in brackets. Also, your query lacked a + at the end, so I've added that in my example above as well.
answers question: http://stackoverflow.com/q/25320633
score: 1
has comment: http://stackoverflow.com/comment/39470165
type: Answer
has comment: http://stackoverflow.com/comment/39470081
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25343631
score: 1
accepted answer of: http://stackoverflow.com/q/25343566
has comment: http://stackoverflow.com/comment/39545929
answers question: http://stackoverflow.com/q/25343566
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39526390
has body: A better way than recursion would be an iterative process. You can use charAt and a loop that processes half the string and the other half at the same time. I won't code it up, but I'll ive pseudocode that you could try to use. I recommend coding it up in Java as a challenge to yourself: Determine length of the string Initialize counter (i) to 0. While i is less than length minus i, repeat the following: If the i'th character is not equal to (length-i)th character, return false immediately. Once loop ends, return true (since no failures were found).
type: Answer
has comment: http://stackoverflow.com/comment/39538607

http://stackoverflow.com/a/25312408
accepted answer of: http://stackoverflow.com/q/25307876
answers question: http://stackoverflow.com/q/25307876
type: Answer
has body: This particular behavior works with any version after Spring 3.1.0 (included) in the 3.x branch. If you test this with the latest 3.0.x (which is 3.0.7) you'll get an exception. If you test with Spring 4, you'll get an exception, but a different one. If you take a look carefully at the exception in Spring 3.0.7, this refers to XML parsing: at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) which means the restriction is at xml schema level (and I believe it's at Java code level, as well). This behavior has changed in Spring 3.1.0 (and after) because of this JIRA issue. From all those JIRA issue it is linked to, this one seems to explain what happened: the restriction has been eliminated from 3.1 schema and the ref local entered in a kind of "deprecated" state (because in 3.1.x and 3.2.x one can use it) and in Spring 4 ref local has been entirely eliminated. In Spring 4 the documentation says ref local is not supported anymore and, also, the xsd schema has been updated (in the sense that ref doesn't accept local anymore).
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

maven-3
tags question: http://stackoverflow.com/q/25363981
tags question: http://stackoverflow.com/q/25308245
tags question: http://stackoverflow.com/q/25323258
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/25368728
tags question: http://stackoverflow.com/q/25324565

http://stackoverflow.com/q/25313638
accepted answer: http://stackoverflow.com/a/25314072
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39457256
tagged with: encryption
has body: I'm trying my darnedest to create a program that will generate a private/public RSA key set and use it to send messages that are secure from end to end. I am using the RSA private/public key pair to securely transmit an AES key, that will be used to send the messages. When I use a 1024-bit key pair, the encrypted session key is 128 bytes. But attempting to decrypt it with the RSA private key, it complains that it can only decrypt 117 bytes or less. When I use a 2048-bit key pair, the encrypted session key is 256 bytes (but it must be 245 or less), etc. The result is always the same: I cannot pass a valid passphrase back and forth. :( KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(1024); KeyPair keyPair = keyPairGenerator.generateKeyPair(); KeyGenerator keyGen = KeyGenerator.getInstance("AES"); SecretKey sessionKey = keyGen.generateKey(); // Encrypt the session key with the RSA public key Cipher rsaCipher = Cipher.getInstance("RSA"); rsaCipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic()); byte[] encryptedSessionKey = rsaCipher.doFinal(sessionKey.getEncoded()); // Simulating other end user: Receive encrypted session key, // decrypt it using your private key. Cipher rsaDecryptCipher = Cipher.getInstance("RSA"); rsaDecryptCipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate()); byte[] decryptedSessionKeyBytes = rsaCipher.doFinal(encryptedSessionKey); System.out.println("Decrypted session key bytes"); System.out.println(decryptedSessionKeyBytes); Edit: It looks like the key that is generated is being padded at some time or another, but I don't know how to stop or subvert it. I has teh dumb when it comes to encryption... up until now I was relying on openssl_seal.
score: 1
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Java RSA encryption keeps generating output that cannot be decrypted?
tagged with: java
has answer: http://stackoverflow.com/a/25314072
tagged with: cryptography
has comment: http://stackoverflow.com/comment/39457386
has comment: http://stackoverflow.com/comment/39460495

http://stackoverflow.com/a/25346471
has body: you have to give view.findViewById, because you are adding that in the view. TableLayout ll = (TableLayout) view.findViewById(R.id.tableLayout1); Check this post. it will surely help you.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25346231
type: Answer
accepted answer of: http://stackoverflow.com/q/25346231
score: 0

http://stackoverflow.com/a/25256442
accepted answer of: http://stackoverflow.com/q/25256377
has body: BufferedWriter#write(int) takes the int but writes a char. What happens in writer.write(j + "\t"); is that j + "\t" automatically is converted into a String, specifically, taking the current value of j and appending a "\t"' in the end. Similar for writer.write(j + "\n"). But writer.write(j) will take j as int and will use int value of j as a char. You can check a specific behavior if doing this: int x = 90; System.out.println((char)x); Output: Z
answers question: http://stackoverflow.com/q/25256377
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39351601
has comment: http://stackoverflow.com/comment/39354905
type: Answer

http://stackoverflow.com/q/25351323
tagged with: bufferedimage
has title: How to convert a BufferedImage to Texture?
tagged with: graphics
score: 0
has answer: http://stackoverflow.com/a/25358995
tagged with: java
tagged with: slick2d
tagged with: textures
has body: I am trying to convert a BufferedImage to a Texture from Slick2D. I have tried BufferedImageUtil.getTexture(), but either I am using it wrong, or it's not working (returns only one brown pixel out of a 32x32 image) How can I convert a BufferedImage to a Texture?
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25352315

http://stackoverflow.com/comment/39399562
score: 0
type: Comment
has text: That's exactly what I have.
type: AnswerComment
comment on: http://stackoverflow.com/a/25282631

http://stackoverflow.com/a/25301069
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25300937
downvote count: 0
has comment: http://stackoverflow.com/comment/39433837
has comment: http://stackoverflow.com/comment/39433597
type: AcceptedAnswer
type: Answer
has body: try this one: &lt;c:forEach items="${test.dataList}" var="m3"&gt; &lt;tr&gt; &lt;th&gt;${m3.hostName}&lt;/th&gt; &lt;td&gt;${m3.totalCall}&lt;/td&gt; &lt;td&gt;${m3.timeoutCount} &lt;c:if test="${m3.totalCall &gt; 0}"&gt; &lt;c:out value="%"/&gt; &lt;/c:if&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; I haven't tested it but that should do.
accepted answer of: http://stackoverflow.com/q/25300937

http://stackoverflow.com/q/25285462
tagged with: dropbox
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39404893
has body: I am making an android app for a survey. The answers are saved in a file, and that file should be sent to the web, so we can analyse the data. I am searching for a way to put the data on the web, in such a way that only I can access it. I've tried google doc's, but it seems to me that if too many people upload their data at the same time, some data might get overwritten. I've also tried dropbox, but the problem is the authentication step. Since every person would have emailadres and password, everyone would have access to all data, which should not be possible (unless there is a way to authenticate in the code, but I haven't found anything on that). Does anyone have an idea what I can do? Thank you!
type: Question
score: 0
type: UnansweredQuestion
has title: sending data from android to web without being able to look it up
answer count: 1
tagged with: google-docs
has answer: http://stackoverflow.com/a/25285874

bouncycastle
tags question: http://stackoverflow.com/q/25261714
tags question: http://stackoverflow.com/q/25261823
tags question: http://stackoverflow.com/q/25388347
type: Tag
tags question: http://stackoverflow.com/q/25255950
tag name: bouncycastle
tags question: http://stackoverflow.com/q/25265799

http://stackoverflow.com/q/25388889
has comment: http://stackoverflow.com/comment/39596562
has comment: http://stackoverflow.com/comment/39597905
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39596699
has answer: http://stackoverflow.com/a/25390114
has comment: http://stackoverflow.com/comment/39597091
has comment: http://stackoverflow.com/comment/39597221
has comment: http://stackoverflow.com/comment/39597508
has body: I have a dedicated root server with CentOS and Apache Tomcat 7. The Servlet in Tomcat7 works well, but dont get a connection/data from the database. On my local system with eclipse it worked well. I exported the database from my local system and imported it with phpmyadmin on the server. Same username, same passwort. As host ive tried final String host = "jdbc:mysql://localhost/table"; and final String host = "jdbc:mysql://localhost:3306/table"; What could be the Problem? I dont know what to do.
score: 0
has comment: http://stackoverflow.com/comment/39597030
has title: No connection to mysql from servlet
tagged with: java
answer count: 1
tagged with: mysql

http://stackoverflow.com/comment/39435266
has text: I even created the inbound rule for PING i.e., ICMPv4. Then Ping is OK from cmd propmpt. But still isReachable() behavior is same i.e., it is returning false.
comment on: http://stackoverflow.com/a/25301931
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39725761
type: Comment
has text: @MattRyan Since you deleted your last question I'll answer here: even if you're building a rocket to the moon and back - it's still a lame excuse for using 5 nested loops. Refactor your code!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25337621

http://stackoverflow.com/comment/39400034
comment on: http://stackoverflow.com/q/25264827
type: QuestionComment
score: 0
has text: This could be relevant too: https://jira.spring.io/browse/DATAMONGO-887
type: Comment

http://stackoverflow.com/q/25247228
downvote count: 0
upvote count: 1
tagged with: spring
favorite count: 0
has comment: http://stackoverflow.com/comment/39334122
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/25250953
accepted answer: http://stackoverflow.com/a/25258414
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39334025
has comment: http://stackoverflow.com/comment/39334215
tagged with: rest
has comment: http://stackoverflow.com/comment/39333722
has answer: http://stackoverflow.com/a/25250953
has comment: http://stackoverflow.com/comment/39354517
score: 1
has title: Spring MVC : How to populate my Object with JSON
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39334466
has comment: http://stackoverflow.com/comment/39338381
has body: I have an update method (AJAX service) that expect an object. This object is populate by JSon and I want to test it but I can't.. I use spring mvc to set up my service. My Service : @RequestMapping(value="texte/updateMyObject", method= RequestMethod.POST, consumes = "application/json;charset=UTF-8") public void updateMyObject(MyObject myObject) throws IOException { logger.info("UPDATE !!!"); } My Object : public class MyObject { private Integer id; private String name; public MyObject(){} // getter & setter } I use Postman (chrome tool) to test my service : https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm I think I have to send the good JSON but I don't know which one. For the moment I have test this pattern : "MyObject" : {"id" : "1", "name" : "test"} or {"id" : "1", "name" : "test"} Edit 1 : When my service is call, the fields of myObject are all null. Edit 2 : I play this kind of HTTP request : POST /myapp/texte/updateMyObject.sp HTTP/1.1 Host: localhost:8080 Content-Type: application/json; charset=UTF-8 Cache-Control: no-cache {"id" : "1", "name" : "test"} Edit 3 : My config spring in my web.xml. If you need my context ask me. springMvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:spring/applicationContext-springmvc.xml 1 springMvc *.sp Edit 4 : I made the following test to show you that my Object is not populated.
has comment: http://stackoverflow.com/comment/39334300
has comment: http://stackoverflow.com/comment/39333850
has comment: http://stackoverflow.com/comment/39333731
type: Question
has comment: http://stackoverflow.com/comment/39333820
answer count: 2
has answer: http://stackoverflow.com/a/25258414
has comment: http://stackoverflow.com/comment/39333878

http://stackoverflow.com/q/25336777
type: Question
has comment: http://stackoverflow.com/comment/39500848
has comment: http://stackoverflow.com/comment/39500816
answer count: 0
has comment: http://stackoverflow.com/comment/39500875
has comment: http://stackoverflow.com/comment/39500829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39500828
downvote count: 0
duplicate of: http://stackoverflow.com/q/25336770
has comment: http://stackoverflow.com/comment/39500856
upvote count: 1
has comment: http://stackoverflow.com/comment/39500933
linked to: http://stackoverflow.com/q/25336770
has title: java.util.Date before() function gives false for dates before 1 month
has body: Here is a code snippet: public static void main(String[] args) { // TODO code application logic here long oneMonthAgo=30*24*60*60*1000; Date now = new Date(); Date twf=new Date(now.getTime()-oneMonthAgo); System.out.println(twf.before(now)); } This outputs false While this code snippet: public static void main(String[] args) { // TODO code application logic here long twentyDaysAgo=20*24*60*60*1000; Date now = new Date(); Date twf=new Date(now.getTime()-twentyDaysAgo); System.out.println(twf.before(now)); } Output: True Isnt it strange enough ?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39500885
tagged with: date
has comment: http://stackoverflow.com/comment/79993524
favorite count: 0

http://stackoverflow.com/comment/39460362
has text: Duplicate Question. --> http://stackoverflow.com/questions/8868732/method-called-after-release-exception-unable-to-resume-with-android-camera
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25315359
type: Comment

http://stackoverflow.com/a/25314428
answers question: http://stackoverflow.com/q/25314239
has comment: http://stackoverflow.com/comment/39459238
score: 2
has comment: http://stackoverflow.com/comment/39459072
has comment: http://stackoverflow.com/comment/39458649
upvote count: 2
has body: For a restricted range of values, a regular double has the required 6 digits precision after the period. Are you looking to have exactly 6 digits of precision? (and not more) You may want to look at fixed-point arithmetics (there is libraries for it). Are you looking to have at least 6 digits after the dot, for arbitrarily large values? BigDecimal can do this. Are you looking to represent 1.0 as 1.000000? This is a display, not a maths issue. Use a string or rather, keep the number in one of the aforementioned representations and format accordingly..
downvote count: 0
type: Answer

http://stackoverflow.com/q/25354468
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28953252
score: 1
tagged with: java
tagged with: bit-manipulation
has comment: http://stackoverflow.com/comment/39531563
answer count: 1
has comment: http://stackoverflow.com/comment/39546533
downvote count: 0
tagged with: swap
upvote count: 1
tagged with: string
favorite count: 0
type: Question
has title: Is an XOR swap equivalent to a traditional swap in all cases?
has comment: http://stackoverflow.com/comment/39531384
has body: Below is a method which performs an ‘in place ' string reverse i.e. Black Cat becomes Cat Black. In the second swap section if a traditional swap (commented out) is used all tests pass however if an XOR swap is used only one test passes. Is it not possible to simply 'swap' for (int i = count; i &lt;= (end + count) / 2; i++) { char temp = arr[i]; arr[i] = arr[end - (i - count)]; arr[end - (i - count)] = temp; } to for (int i = count; i &lt;= (end + count) / 2; i++) { arr[i] ^= arr[end - (i - count)]; arr[end - (i - count)] ^= arr[i]; arr[i] ^= arr[end - (i - count)]; } Method public class ReverseString { public static char[] revString(String input) { char[] arr = input.toCharArray(); int length = arr.length; for (int i = 0; i &lt; (length / 2); i++) { arr[i] ^= arr[length - i - 1]; arr[length - i - 1] ^= arr[i]; arr[i] ^= arr[length - i - 1]; } int end; int charCount; int count = 0; while (count &lt; length) { if (arr[count] != ' ') { charCount = 0; while (count + charCount &lt; length &amp;&amp; arr[count + charCount] != ' ') { charCount++; } end = count + charCount - 1; // for (int i = count; i &lt;= (end + count) / 2; i++) { // char temp = arr[i]; // arr[i] = arr[end - (i - count)]; // arr[end - (i - count)] = temp; // } for (int i = count; i &lt;= (end + count) / 2; i++) { arr[i] ^= arr[end - (i - count)]; arr[end - (i - count)] ^= arr[i]; arr[i] ^= arr[end - (i - count)]; } count += charCount; } else { count++; } } return arr; } } Test @RunWith(JUnitParamsRunner.class) public class ReverseStringTest { @Test @Parameters(method = "getStrings") public void testRevString(String testValue, char[] expectedValue) { assertThat(ReverseString.revString(testValue), equalTo(expectedValue)); } private static final Object[] getStrings() { return new Object[] { new Object[] {"Black Cat", "Cat Black".toCharArray()}, new Object[] {"left to", "to left".toCharArray()} }; } } Output for fail java.lang.AssertionError: Expected: ["C", "a", "t", " ", "B", "l", "a", "c", "k"] but: was …
accepted answer: http://stackoverflow.com/a/28953252
tagged with: bitwise-xor

http://stackoverflow.com/comment/39558630
score: 0
has text: @user2942227 Do you understand what `println` does?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25368815

http://stackoverflow.com/q/25369604
answer count: 3
has answer: http://stackoverflow.com/a/25369700
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25369803
favorite count: 0
type: Question
has body: i've got the class P4 in the default package (i know using the default package is bad practice, but merely "for example" for now): import temp.P2; public class P4 extends P2 { public void someMethod() { P2 p2 = new P2(); // p2.p2default(); // ERROR as expected p2.p2public(); p2.p2protected(); // ERROR as not expected } } and class P2 in package temp package temp; public class P2 { protected void p2protected() { ... } public void p2public() { ... } void p2default() { ... } } From the access control mechanism, i'd expect P4-- having extended P2, should be able to see the protected member of its super class even from outside the package once it imported the namespace of that package. What am i missing? TIA.
accepted answer: http://stackoverflow.com/a/25369691
has answer: http://stackoverflow.com/a/25369691
has title: Access control -- protected members from outside the package
score: 6
upvote count: 6
tagged with: access-control
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25369700

http://stackoverflow.com/comment/39380914
type: QuestionComment
has text: This is simple Java: if you do not have any constructors, then a default no-argument constructor will be created for you. Once you created your own constructor, it's your responsibility to create a default one (if needed). Since Java Bean requires a default constructor you get your error.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25272543

http://stackoverflow.com/q/25292103
tagged with: android-widget
type: Question
score: 0
has answer: http://stackoverflow.com/a/25293967
has title: removing whitespace in android Switch which is devoted to text
tagged with: android
tagged with: java
has body: (we all know) There are three parts in android Switch Widget ... Text - Thumb - Track. My question is how can we completely remove this text part if we don't want to use any text because it's ruining the balance of the layout
answer count: 2
has answer: http://stackoverflow.com/a/25293778
type: UnansweredQuestion

http://stackoverflow.com/a/25353337
downvote count: 0
upvote count: 1
has body: You face the “java.lang.OutOfMemoryError: Unable to create new native thread” whenever JVM is asking a new thread from the OS. Whenever the underlying OS cannot allocate a new native thread, this OutOfMemoryError will be thrown. The exact limit for native threads is very platform-dependent thus we recommend to find your limits by running a small test to find out your platform-specific limit to threads. But, in general, the situation causing java.lang.OutOfMemoryError: Unable to create new native thread goes through the following phases: A new Java thread is requested by an application running inside the JVM JVM native code proxies the request to create a new native thread to the OS OS tries to create a new native thread which requires memory to be allocated to the thread The OS will refuse native memory allocation either because the 32-bit Java process size has depleted its memory address space – e.g. (2-4) GB process size limit has been hit – or the virtual memory of the OS has been fully depleted The java.lang.OutOfMemoryError: Unable to create new native thread error is thrown In your case, the best way to overcome the issue is definitely follow the suggested path of limiting the thread creation.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25346220

http://stackoverflow.com/q/25385951
downvote count: 0
upvote count: 7
has answer: http://stackoverflow.com/a/25386189
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39592496
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25387064
has comment: http://stackoverflow.com/comment/39592204
possible better answer: http://stackoverflow.com/a/25386189
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39592474
score: 7
has title: How to set timeout for BigQuery API request in Java
has answer: http://stackoverflow.com/a/77656874
tagged with: google-bigquery
accepted answer: http://stackoverflow.com/a/25387064
answer count: 3
has body: Sometimes when we poll for a BigQuery job, our request ends up with SocketTimeoutException. You can see the code raising the exception below. this.bigquery.jobs().get(projectNumber, jobId).execute(); And here is the error message we get. ... Caused by: java.net.SocketTimeoutException: Timeout while fetching URL: https://www.googleapis.com/bigquery/v2/projects/######/jobs/###### ... My question is if there is a way to extend the timeout. And does anyone know what the default timeout is?
tagged with: java

http://stackoverflow.com/comment/39351302
type: Comment
has text: There are so many things that be causing an issue. A change in security permissions, running environments, security manager updates, class loading issues, JNI issues...the best people to ask are the authors...
type: AnswerComment
comment on: http://stackoverflow.com/a/25252984
score: 0

http://stackoverflow.com/a/25251443
has comment: http://stackoverflow.com/comment/39342143
answers question: http://stackoverflow.com/q/25251261
score: 1
type: Answer
has body: Do not use getBounds() as it gives the component location relative to its parent. Use panel's coordinates and its width and height instead. In your example you are painting outside the boundaries of the panels. For example use this to draw an oval: g.drawOval(0, 0, getWidth(), getHeight()); Some side notes: Do not call setSize(), override panel's getPreferredSize() and pack() the frame. For example: public Dimension getPreferredSize(){return new Dimension(400, 400);} Then, add frame.pack(); before making the frame visible. See Java Naming Conventions. See Performing Custom Painting and Painting in AWT and Swing for more information.
downvote count: 0
has comment: http://stackoverflow.com/comment/39341967
upvote count: 1

http://stackoverflow.com/comment/39551230
type: Comment
comment on: http://stackoverflow.com/q/25365089
score: 0
type: QuestionComment
has text: Another strange thing is that a single resource generated via ResourceAssemblerSupport is serialized as atom and not as plain XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <atom:link rel="self" href="http://localhost:8080/admin/roles/ADMIN"/> system administrator ADMIN

http://stackoverflow.com/q/25309368
tagged with: java
has comment: http://stackoverflow.com/comment/39462223
accepted answer: http://stackoverflow.com/a/25327425
has answer: http://stackoverflow.com/a/25327935
tagged with: doc
has answer: http://stackoverflow.com/a/31426542
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39462110
has comment: http://stackoverflow.com/comment/39462689
possible better answer: http://stackoverflow.com/a/25327935
has answer: http://stackoverflow.com/a/25327425
has comment: http://stackoverflow.com/comment/39537869
score: 4
has title: Convert a Docx file into Images
upvote count: 4
tagged with: aspose.words
has comment: http://stackoverflow.com/comment/39449496
tagged with: aspose
has comment: http://stackoverflow.com/comment/39538117
type: AnsweredQuestion
has body: I am going to convert a Word Document (.docx) into images so I am using aspose.word.jar! The problem is that I am new to this work and using my code getting an error. My code part is: public class NewClass { public static void main(String[] args){ new NewClass().generateImages("D:\\Net Beans Work Space\\Text to Image\\Doc1.docx"); } public void generateImages(final String sourcePath) { try { Document doc = new Document(sourcePath); ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG); options.setJpegQuality(100); options.setResolution(100); for (int i = 0; i &lt; doc.getPageCount(); i++) { String imageFilePath = sourcePath + "_output_" + i + ".jpeg"; options.setPageIndex(i); doc.save(imageFilePath, options); } } catch (Exception e) { e.printStackTrace(); } } } well I am new to aspose so i got this code part online and edit it to my requirements! the problem is in the print stack trace! I have google it for hours and didn't get any solution can somebody done this work before! is it me doing something wrong can somebody please help me! java.lang.NullPointerException at asposewobfuscated.hh.a(GdiRenderer.java:176) at asposewobfuscated.hh.a(GdiRenderer.java:176) at asposewobfuscated.s.a(ApsGlyphs.java:48) at asposewobfuscated.p.a(ApsCompositeNode.java:22) at asposewobfuscated.m.a(ApsCanvas.java:18) at asposewobfuscated.p.a(ApsCompositeNode.java:22) at asposewobfuscated.m.a(ApsCanvas.java:18) at asposewobfuscated.p.a(ApsCompositeNode.java:22) at asposewobfuscated.m.a(ApsCanvas.java:18) at asposewobfuscated.p.a(ApsCompositeNode.java:22) at asposewobfuscated.z.a(ApsPage.java:75) at asposewobfuscated.p.a(ApsCompositeNode.java:22) at asposewobfuscated.m.a(ApsCanvas.java:18) at asposewobfuscated.hh.a(GdiRenderer.java:49) at com.aspose.words.apd.a(SaveToImageHelper.java:129) at com.aspose.words.apd.a(SaveToImageHelper.java:94) at com.aspose.words.apd.a(SaveToImageHelper.java:71) at com.aspose.words.uz.F(ImagingWriter.java:79) at com.aspose.words.uz.a(ImagingWriter.…
downvote count: 0
answer count: 3

http://stackoverflow.com/q/25306224
answer count: 1
type: Question
tagged with: ant
tagged with: android
tagged with: java
has title: How to use Phonegap properly
has answer: http://stackoverflow.com/a/25306881
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25306881
has body: I have worked a lot to install Phonegap in my computer with Android. Now I have the Android SDK and everything is fine. But I have looked for a way to check my app in Android and apparently I don't need the Android SDK. I have seen, that you just have to use the webpage of phonegap build. So now I ask me, "why did I install Android SDK, Eclipse, JDK, Ant, and all that stuff? I would like to know what's better, use the phonegap build webpage or use the Android SDK with Eclipse, which emulator by the way, is very very slow. I cannot work with it. And in addition, I would like to know how to check my updates in the Android App with the SDK. I mean, if I use the Phonegap phone app it updates in real time, but I would like to know how to check it manually with Eclipse, because I suppose that I got to build it or something like that. Greetings and thanks.
type: AnsweredQuestion
tagged with: cordova
score: 0

http://stackoverflow.com/q/25380077
downvote count: 1
has answer: http://stackoverflow.com/a/25380371
possible better answer: http://stackoverflow.com/a/25380371
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25380472
tagged with: nosuchfileexception
has body: I've created an app and i'm just adding in the feature to export data as a .txt or .csv file but I'm getting an error on file creation. The error in logcat appears as File write failed: java.io.IOExcepion: open failed: ENOENT (NO such file or directory). Can anyone see where i'm making a mistake? I call the writeToFile() method passing either String txt; or String csv; into it depending on which file type is needed. code: String txt = ".txt"; String csv = ".csv"; private void writeToFile(String fileType) { // if file name has not been entered... if (filename.equals("")||filename.equals(null)) { //display toast toastMsg = "Please enter a file name"; toast(); } // else if file name has been entered... else if (!filename.equals("")) { // create FileCheck File fileCheck = new File("/sdcard/" + filename + fileType); // if file exists... if (fileCheck.exists()) { // display toast toastMsg = "Export Error: File already exists"; toast(); } // if file does not exist... else if (!fileCheck.exists()) { try { // create file File myFile = new File("/sdcard/" + filename + fileType); myFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(myFile); OutputStreamWriter myOSW = new OutputStreamWriter(fOut); myOSW.append("file data here"); myOSW.close(); fOut.close(); // display toast toastMsg = "file created: " + myFile.toString(); toast(); } catch (IOException e) { Log.e(TAG, "File write failed: " + e.toString()); toastMsg = "file write failed: " +e.toString(); toast(); } } } }
tagged with: android
has title: android creating .txt and .csv files throwing ENOENT No such file or directory exception
type: AnsweredQuestion
score: 0
tagged with: ioexception
answer count: 2
has answer: http://stackoverflow.com/a/25380472
tagged with: java
tagged with: fileoutputstream
upvote count: 1

http://stackoverflow.com/comment/39381471
type: Comment
type: QuestionComment
has text: @user3218114 no I converted the file to UTF-8 without BOM with Notepad++
score: 0
comment on: http://stackoverflow.com/q/25272863

http://stackoverflow.com/comment/39570380
comment on: http://stackoverflow.com/q/25375017
type: Comment
score: 0
type: QuestionComment
has text: many comments in your linked question suggest changing the value in the catalina.bat file - did you do this?

http://stackoverflow.com/a/25380086
has body: truststoreFile="C:/Users/dpivovar/ssl_server.jks" truststorePass="start123" These attributes do not exist. You have to set them via the system properties.
upvote count: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25305655
score: 2

http://stackoverflow.com/comment/39418147
type: QuestionComment
has text: Did you delete the initial space in your new `logEmailAddress` field? I notice you are defaulting it to " ".
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25292927

http://stackoverflow.com/a/25263703
type: AcceptedAnswer
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25263111
score: 4
upvote count: 6
has comment: http://stackoverflow.com/comment/61318142
has body: I solved it by: public enum Option implements Parcelable { DATA_BASE("Database"), TRIPS("Trips"), BIG_PHOTOS("BigPhotos"), OLD_PHOTOS("OldPhotos"), FILTERS_IMAGES("FiltersImages"), CATEGORIES_IMAGES("CategoriesImages"), PAGES("Pages"), SOUNDS("Sounds"), PUBLIC_TRANSPORT("PublicTransport"), MAPS("Maps"); private String option; Option(String option){ this.option = option; } public String getName(){ return option; } private void setOption(String option){ this.option = option; } public static final Parcelable.Creator&lt;Option&gt; CREATOR = new Parcelable.Creator&lt;Option&gt;() { public Option createFromParcel(Parcel in) { Option option = Option.values()[in.readInt()]; option.setOption(in.readString()); return option; } public Option[] newArray(int size) { return new Option[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(ordinal()); out.writeString(option); } }
accepted answer of: http://stackoverflow.com/q/25263111

http://stackoverflow.com/q/25256027
has comment: http://stackoverflow.com/comment/39402030
has answer: http://stackoverflow.com/a/25256223
has body: This is a part of my java code, in this I am trying to terminate the thread before its completion using SwingWorker.cancel(true); method but this is not working, so please help. import javax.swing.JFrame; import javax.swing.JProgressBar; import javax.swing.SwingWorker; public class A extends SwingWorker&lt;Void,Void&gt; { JProgressBar p = new JProgressBar(0,100); JFrame f = new JFrame(); static A a; public static void main(String arg[]) { a = new A(); a.execute(); } public Void doInBackground() { f.add(p); f.setSize(500,100); f.setVisible(true); for(int i=0; i&lt;101; i++) { p.setValue(i); try{Thread.sleep(30);}catch(Exception e){} if(i==50) a.cancel(true); } return null; } }
answer count: 2
score: 1
tagged with: java
downvote count: 0
upvote count: 1
tagged with: swing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25256386
has title: SwingWorker.cancel(true); is not working in java
tagged with: swingworker
type: UnansweredQuestion
tagged with: concurrency

http://stackoverflow.com/q/25337478
type: AnsweredQuestion
has title: how to select some rows of specific date
tagged with: sql
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25337831
upvote count: 1
downvote count: 1
has body: i using sqlite datebase i want to select some rows of specific date. where i am using e_date as text CREATE TABLE expenses ( id integer PRIMARY KEY AUTOINCREMENT, e_type text NOT NULL, e_date text NOT NULL, e_amt text NOT NULL, e_method text NOT NULL, desc text ); where i am trying to select using query select * from expenses where e_date between 31/7/2014 and 15/8/2014; but its not working help me out..
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25337831
tagged with: mysqli
tagged with: android
tagged with: android-sqlite
linked to: http://stackoverflow.com/q/19758467

http://stackoverflow.com/q/25297262
tagged with: thread-safety
downvote count: 0
answer count: 1
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
tagged with: swt
score: 2
has answer: http://stackoverflow.com/a/25297453
has body: say i have this code inside a SWT button : Button btn = new Button(shell, SWT.NONE); btn.addSelectionListener(new SelectionAdapter() { //... some code... Thread t = new Thread(){ public void run() { //some function that includes **INFINITE LOOP** in that //sends a lot of UDP packets. } }; Display.getDefault().asyncExec(t); try{ Thread.sleep(5*1000);} catch(Exception e1) { e1.printStackTrace(); } t.stop(); System.out.println("message"); //and some more code... when i run this program , approximately after 5 sec it does display in the console message but then the GUI stops responding, and when i look in the task manager, i see that my cpu (i7-4700mq) isn't fully loaded - all other apps are running just fine. Not only that, i can see that the thread is still running - via Wireshark (or task manager) i can see that the udp packets are still being sent. i need to use t.stop() because i don't have any other threads in my program, and i dont what to make the thread itself to know when to stop (by changing some parameter value) because that will reduce performance, which is extremely important in this case. so here are my questions: 1. why isn't my GUI responding like all other apps? isn't Display.getDefault().asyncExec(t); make the t thread run in parallel to the main(GUI) thread? 2. If i shouldn't use t.stop(), but can't stop the thread internally, because of performance, how should i stop it?
has title: SWT Threading: GUI not responding even after calling thread.stop()
tagged with: java
tagged with: user-interface

http://stackoverflow.com/q/25291773
type: Question
tagged with: apache-commons-net
has comment: http://stackoverflow.com/comment/39416459
has comment: http://stackoverflow.com/comment/39416997
has comment: http://stackoverflow.com/comment/39416617
has comment: http://stackoverflow.com/comment/39417064
has body: I'm writing a very simple FTPClient application using Apache's library. All I do is download a jar file from a server. There is no exception, the application works fine when I run in on MacOS and as soon as I run the same code in Windows the downloaded file is smaller than the file on server. However, there is no exception and everything seems to be fine. I'm going crazy, I'm using binary mode and the code is so simple I can't believe I've been stuck on it since yesterday!!! Please help! public boolean loadLatest(){ FTPClient ftp = new FTPClient(); try { ftp.connect("server address"); ftp.setControlKeepAliveTimeout(300); ftp.enterLocalPassiveMode(); String fu = "username"; ftp.login(fu, "password"); int reply = ftp.getReplyCode(); if (FTPReply.isPositiveCompletion(reply)) { ftp.setFileTransferMode(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); FTPFilter filter = new FTPFilter(); FTPFile[] finfo = ftp.listFiles(".",filter); if (finfo.length==0){ return false; } File currentJar = new File("sm.jar"); FileOutputStream output; output = new FileOutputStream("sm.jar"); if (ftp.retrieveFile(finfo[0].getName(), output)==false){ System.out.println("Bad file!"); } output.close(); ftp.logout(); } } catch (Exception e) { e.printStackTrace(); return false; } return true; } Here is my code: Thanks
has title: Apache FTPClient
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25292696
tagged with: java
has answer: http://stackoverflow.com/a/25292696
answer count: 1
tagged with: ftp-client

http://stackoverflow.com/comment/39341634
comment on: http://stackoverflow.com/a/25251117
score: 1
type: Comment
type: AnswerComment
has text: No, it doesn't. Try it yourself.

http://stackoverflow.com/comment/39645183
has text: I think I didn't express myself properly. The error is the same as before. I have added above the code where I call both save functions, as you can see nothing special. About the hibernate HQL just one appears, the insert of the user, I thinks that the next HQL triggers the error. Any idea? I think I'm trying to do a very common operation, so it cannot be so difficult.. Thanks!!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25342684
type: Comment

http://stackoverflow.com/comment/39517804
type: QuestionComment
comment on: http://stackoverflow.com/q/25343629
score: 0
type: Comment
has text: thank you for the hint that that a button tries to assign to the MainApp, the table view was mistakely linked to it. So now it works. Many Thanks to your comments!

http://stackoverflow.com/q/25349803
tagged with: parsing
type: Question
tagged with: jsoup
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has body: I'm trying to parse data from IMDB and Rotten Tomatoes using Jsoup. I've gotten most of the info I need but there is some data I don't know how to get. For example in the movie The Expendables 2 I need to get the number for User Reviews: 313,393 (just the number) but using something like Elements links19 = doc5.select("p[class=critic_stats]"); gets the whole p class="critic_stats" Average Rating: 5.8/10 Reviews Counted: 123 Fresh: 80 | Rotten: 43 Average Rating: 5.3/10 Critic Reviews: 23 Fresh: 13 | Rotten: 10 liked it Average Rating: 3.7/5 User Ratings: 313,393 For the same movie in IMDB I'm trying to get: Country: USA | Bulgaria Language: English Release Date: 17 August 2012 (USA) Sound Mix: Dolby Digital | Datasat Color: Color Aspect Ratio: 2.35 : 1 Again I only need the values but everything is in and I don't know if there's any way to get specific data based on for example Sound Mix: <itemprop='url'>Dolby Digital <itemprop='url'>Datasat Any ideas on how to get those .. I'm not sure what they are, child attributes? UPDATE: OK so the first worked with Pattern pattern = Pattern.compile("[0-9]*\\.?,?[0-9]+"); I have a few more questions I need to get "/title/tt1764651/?ref_=fn_tt_tt_1" or even better the whole http from The Expendables 2 (2012) I tried Elements links = doc.select("table[class=findList"); String a= links.attr("abs:href"); but it doesn't work, any ideas? Also I used Document doc6= Jsoup.parse(new URL(url6).openStream(), "ISO-8859-1", url6); to get the Also Known As but on the Bulgarian title for example I get Bulgaria (Bulgarian title) ???µ?????±?µ???????????µ @Spectre
score: 0
has title: Jsoup parsing - Java
tagged with: java
has comment: http://stackoverflow.com/comment/39533937
answer count: 1
has answer: http://stackoverflow.com/a/25355633

http://stackoverflow.com/a/25297104
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25297022
has body: Try checking out this page for further reading, however Jigar Joshi's answer of the diference being between permgen space and heapspace is correct. A quotation from this page is: Suppose one set JVM parameters as -Xms3072M -Xmx3072M -XX:+AggressiveHeap -XX:MaxPermSize=1024M Doubt Is:When we say MaxPermSize = 1024M does it mean that it is taken from 3072M that I set for Xms/Xmx ? Answer is No, PermSize is additional to the -Xmx value set by the user on the JVM options. But MaxPermSize allows for the JVM to be able to grow the PermSize to the amount specified. Initially when the VM is loaded, the MaxPermSize will still be the default value (32mb for -client and 64mb for -server) but will not actually take up that amount until it is needed. On the other hand, if you were to set BOTH PermSize and MaxPermSize to 256mb, you would notice that the overall heap has increased by 256mb additional to the -Xmx setting.*

http://stackoverflow.com/comment/39528935
type: Comment
type: AnswerComment
has text: @ClémentMATHIEU: Sounds like you didn't read my entire comment.
comment on: http://stackoverflow.com/a/25351833
score: 0

http://stackoverflow.com/q/25377463
has comment: http://stackoverflow.com/comment/39575473
type: Question
has comment: http://stackoverflow.com/comment/39575075
tagged with: debugging
has body: I made two Break points in a java file in Eclipse, when I run the application the Debugger says that it is suspended at the exact line of the break point, but the line doesn't get selected and I can't step to the next line or continue the debugging process, I only got the resume option and when I click it the same happens with the next break point. UPDATE: When I put breakpoints somewhere else other than that file it works fine.
tagged with: breakpoints
has title: Eclipse Debug Suspended at My Breakpoint and the line is not highlighted
tagged with: eclipse
downvote count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39578425
has answer: http://stackoverflow.com/a/25377550
tagged with: java
answer count: 1
favorite count: 0

http://stackoverflow.com/a/25344341
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: You're using a literal table which means wiki markup is not interpreted inside the table. Use a plain table and escape the cells that you don't want interpreted as wiki markup | Table:my.domain.MyFixture | | let | myinnervar | const | ${myvar} | | uri | !-http://someuri.com:12345-! | | etc | etc.etc.etc. |
accepted answer of: http://stackoverflow.com/q/25329106
type: Answer
answers question: http://stackoverflow.com/q/25329106

http://stackoverflow.com/q/25347157
tagged with: design-patterns
has title: how does prototype pattern create a deep copy throw clone() method
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25348395
type: Question
has body: I know that clone() method create a shallow copy and prototype pattern create a deep copy but i don't know how prototype work to do it by still using clone() method. What is the core element to create a new object clone. public interface Prototype { public abstract Object clone ( ); } public class ConcretePrototype implements Prototype { public Object clone() { return super.clone(); } } public class Client { public static void main( String arg[] ) { ConcretePrototype obj1= new ConcretePrototype (); ConcretePrototype obj2 = ConcretePrototype)obj1.clone(); } }
tagged with: prototype-pattern
accepted answer: http://stackoverflow.com/a/25348395

http://stackoverflow.com/comment/39456881
has text: Sorry, I edited my code. It must be today.plusDays(1). Yes, when user click twice on button, he can't to move two days ahead and if I add button "yesterday" I have same problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25312637
score: 0

http://stackoverflow.com/comment/39581676
type: Comment
type: AnswerComment
has text: what if the string is a combination of both language? for example most of it is written in persian, but it has few english words which happens alot.
comment on: http://stackoverflow.com/a/25381325
score: 0

http://stackoverflow.com/q/25333803
downvote count: 0
favorite count: 0
type: Question
tagged with: postgresql
has body: I'm working with JDK 1.7 (Eclipse) and downloaded version '9.3-1102 JDBC 41' and added the 'postgresql-9.3-1102.jdbc41.jar' file to the 'Referenced Libaries'. Here's my 'build.sbt' file dependencies: libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, "org.postgresql" % "postgresql" % "9.3-1102.jdbc41" ) and added the following to 'application.conf': db.default.driver=org.postgresql.Driver db.default.url="jdbc:postgresql://localhost:5432/test" db.default.user="postgres" db.default.password="postgre" Still, I get 'Driver not found: [org.postgresql.Driver]' due a class not found.
has answer: http://stackoverflow.com/a/25333893
accepted answer: http://stackoverflow.com/a/25333893
type: AnsweredQuestion
tagged with: playframework
score: 1
upvote count: 1
has title: Why is "Driver not found: [org.postgresql.Driver]" with postgresql 9.3-1102.jdbc41 dependency declared?
tagged with: java
answer count: 1

http://stackoverflow.com/a/25327604
upvote count: 1
answers question: http://stackoverflow.com/q/25327299
score: 1
accepted answer of: http://stackoverflow.com/q/25327299
has comment: http://stackoverflow.com/comment/39484348
type: AcceptedAnswer
downvote count: 0
has body: The paint for a Bitmap is pretty much useless, I think the only parameter of the paint object that applies for a Bitmap is the AntiAliasing mode wich is turned on by default. I think you can also use the paint for a color filter such as black and white, but for most cases you can just use null as well.
has comment: http://stackoverflow.com/comment/39483421
has comment: http://stackoverflow.com/comment/39484136
has comment: http://stackoverflow.com/comment/39483680
type: Answer

http://stackoverflow.com/comment/39579286
comment on: http://stackoverflow.com/a/25379748
has text: I'm not sure that I understand. You've said that "indicate this Mockito.verify() within the testMaximizeWindow() method" and you have commented line //Mockito.verify(mockWindow); in this method. So, Mockito shows error in correct test.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25238889
downvote count: 0
upvote count: 1
has body: The error message No qualifying bean of type [com.biomorf.cip.datacapture.repository.payload.StagingDocumentRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. tells you that spring found no StagingDocumentRepository bean that can be injected in your StagingDocumentServiceImpl. You should make sure you define a StagingDocumentRepository bean. To do so you can use various ways. use xml configuration like Arno_Geismar showed in his answer use component scan feature and annotate StagingDocumentRepository with a scanned annotation (e.g. @Repository). use Java config to define the bean (like shown below) Java config: @Bean public StagingDocumentRepository stagingDocumentRepository() { return new StagingDocumentRepository(..); }
type: Answer
answers question: http://stackoverflow.com/q/25238573
score: 1

stringbuilder
tags question: http://stackoverflow.com/q/25232220
tags question: http://stackoverflow.com/q/25305933
tag name: stringbuilder
tags question: http://stackoverflow.com/q/25278920
type: Tag
tags question: http://stackoverflow.com/q/25253651

resolution
tag name: resolution
tags question: http://stackoverflow.com/q/25267328
type: Tag

http://stackoverflow.com/a/25267557
answers question: http://stackoverflow.com/q/25264684
accepted answer of: http://stackoverflow.com/q/25264684
has body: You may want to use Google Maps "Reverse Geocoding" to help see if a random location is within a city. Consider the following partial code demo: TestRandomCityLocations Main package com.example.mapping; import java.util.Random; public class TestRandomCityLocation { // Class fields private static TestRandomCityLocation me; private static final String[] defaultArguments = { "" }; // Object fields public static void main(String[] args) { String[] arguments; me = new TestRandomCityLocation(); if (args == null || args.length == 0) { arguments = defaultArguments; } else { arguments = args; } me.doWork(arguments); } private void doWork(String[] arguments) { int maximumPoints = 100; GeographicPoint newLocation; GeographicSquare mockCityGeo = new GeographicSquare( new GeographicPoint(38.7, -77.0), new GeographicPoint(38.9, -76.9)); String cityName = "Google Maps city name"; Random randomGenerator = new Random(); double deltaLong = mockCityGeo.getDeltaLongitude(); double deltaLat = mockCityGeo.getDeltaLatitude(); for (int i = 0; i &lt; maximumPoints; i++) { newLocation = new GeographicPoint( mockCityGeo.getLowerLeftLatitude() + deltaLat * randomGenerator.nextDouble(), mockCityGeo.getLowerLeftLongitude() + deltaLong * randomGenerator.nextDouble()); // TODO test to see of newLocation is in the city if (GoogleMapInfo.isWithinCity(cityName, newLocation)) { // TODO Do something } } } } GeographicSquare Class package com.example.mapping; public class GeographicSquare { // Object fields private GeographicPoint lowerLeft; private GeographicPoint upperRight; public GeographicSquare (GeographicPoint lowerLeft, GeographicPoint upperRight) { this.lowerLeft = lowerLeft; this.upperRight = upperRight; } public double getDeltaLongitude() { return lowerLeft.getLongitudeDifference(upperRight); } public double getDeltaLatitude() { return lowerLeft.getLatitudeDifference(upperRight); } public double getLowerLeftLongitude() { return lowerLeft.getLongitude(); } public double getLowerLeftLatitude() …
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39373262

http://stackoverflow.com/comment/39594032
score: 0
has text: No you did not - see my edit above - do you see the line in the if-statement that says "//object will be your game score"? the variable object is what's holding your object from your query, not the variable gameScore. Please read the docs carefully and try to understand what you're doing, don't just copy and paste then ask stackoverflow when it doesn't work
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25387424

http://stackoverflow.com/q/25261724
tagged with: excel
accepted answer: http://stackoverflow.com/a/25403253
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: grouping
has title: Can column groupings be changed in an existing Excel with POI?
type: Question
tagged with: apache-poi
upvote count: 1
answer count: 1
has body: I've been working with Apache POI for the past couple of month to create an 'Export to/ Import from Excel' functionality for our application. Note: I used 3.9 but have no switched to 3.10-FINAL. The typical use case is, that a user either downloads the empty template or exports existing data to an Excel file. He then makes changes to the data and uploads his file again. To provided a detailed feedback for the user we use his uploaded Excel file and create a report file from it. This report file is a copy of the uploaded file with two additional columns that contain information about the data he imported. An error message that tells him why his data was not accepted, for example. This requires to shift all columns to the right and add two new columns to the left. I implemented this and I even managed to move the cell comments with the columns. Now I'm stuck however, because I can't move the column groupings. The template has a few columns grouped together and collapsed per default. Because we have 100+ columns this is supposed to make it easier for the user by hiding some seldom used columns. During template creation I use the following code to create the groupings. SimpleEntry&lt;Integer, Integer&gt; group; sheet.setRowSumsRight(false); for (String groupId : groupMap.keySet()) { group = groupMap.get(groupId); sheet.groupColumn((group.getKey() + 1) + offset, group.getValue() + offset); sheet.setColumnGroupCollapsed(group.getValue() + offset, true); } group.getKey() returns the leftmost column and group.getValue() the rightmost column of the group. The offset is always 0. My idea was to use the same code with an offset of 2 to shift the groupings in the report file. Thinking that simply overwriting wouldn't work I tried to ungroup the columns first with this: sheet.ungroupColumn(0, 130); This is just an example. I tried several different approaches, like ungrouping all groups at once using the maximum range or ungrouping every group on my map. Nothing worked as expect…
has answer: http://stackoverflow.com/a/25403253

http://stackoverflow.com/a/25307705
upvote count: 1
score: 1
has body: Given that your last two tests are identical, you really only have four tests here. For the sake of convenience I have refactored them into separate methods and removed the benchmarking code as it's not necessary to understand what's going on here. public static void stringBuilderTest(int iterations) { final StringBuilder sb = new StringBuilder(); for (int i = iterations; i-- &gt; 0;) { sb.append("a"); } } public static void stringBufferTest(int iterations) { final StringBuffer sb = new StringBuffer(); for (int i = iterations; i-- &gt; 0;) { sb.append("a"); } } public static void emptyStringConcatTest(int iterations) { String s = new String(); for (int i = iterations; i-- &gt; 0;) { s += ""; } } public static void nonEmptyStringConcatTest(int iterations) { String s = new String(); for (int i = iterations; i-- &gt; 0;) { s += "a"; } } We already know that the StringBuilder version of the code is the fastest of the four. The StringBuffer version is slower because all of its operations are synchronized, which carries an unavoidable overhead that StringBuilder doesn't have because it isn't synchronized. So the two methods that we're interested in are emptyStringConcatTest and nonEmptyStringConcatTest. If we inspect the bytecode for the compiled version of emptyStringConcatTest, we see the following: public static void emptyStringConcatTest(int); flags: ACC_PUBLIC, ACC_STATIC LineNumberTable: line 27: 0 line 28: 8 line 29: 17 line 31: 40 Code: stack=2, locals=3, args_size=1 0: new #14 // class java/lang/String 3: dup 4: invokespecial #15 // Method java/lang/String."&lt;init&gt;":()V 7: astore_1 8: iload_0 9: istore_2 10: iload_2 11: iinc 2, -1 14: ifle 40 17: new #7 // class java/lang/StringBuilder 20: dup 21: invokespecial #8 // Method java/lang/StringBuilder."&lt;init&gt;":()V 24: aload_1 25: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 28: ldc #16 // String 30: invokevirtual #10 // Method java/lang/StringBuil…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25305933
type: Answer
accepted answer of: http://stackoverflow.com/q/25305933
downvote count: 0

http://stackoverflow.com/comment/39469565
has text: Added null as the second argument instead of third. The tesing terminated after calling test() once. I guess,in this scenario, Junit terminates whenever it encounters null
comment on: http://stackoverflow.com/q/25320105
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39533831
comment on: http://stackoverflow.com/q/25355187
type: Comment
type: QuestionComment
score: 0
has text: @ErwinBolwidt Then this code shouldn't work, but it does. If this would be for sure, it would be nice for me (no need to create new connections). And I'm not skilled enough to check how does this really work :-(

http://stackoverflow.com/comment/39413311
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25289756
has text: This is a good answer, but unfortunately doesn't work for me because of a simplification I made for the sake of this question. In your example if there is more than one duplicate you are calling setDuplicate(true) on the original object more than once. That is fine here with booleans, but in my actual implementation I am not setting a boolean but rather adding a string to a list of Strings in the case of a duplicate. This didn't work for me because the original would get the multiple copies of the string in its String list.

http://stackoverflow.com/a/25324080
has body: That's not the right way to use an enum. You should not have a boolean isCurrent on each enum constant. Instead, have a Planet currentPlanet variable in one place (not on the enum): Planet currentPlanet = Planet.MERCURY; When you want to get the next one do: currentPlanet = currentPlanet.getNext();
has comment: http://stackoverflow.com/comment/39477967
has comment: http://stackoverflow.com/comment/39477678
score: 2
has comment: http://stackoverflow.com/comment/39477929
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39477813
type: Answer
answers question: http://stackoverflow.com/q/25323916

http://stackoverflow.com/a/25332038
has body: I'd suggest altering the signature of the JAX-RS-annotated method to return a javax.ws.rs.core.Response object. Depending on whether you intend the redirection to be permanent or temporary (i.e. whether the client should update its internal references to reflect the new address or not), the method should build and return a Response corresponding to an HTTP-301 (permanent redirect) or HTTP-302 (temporary redirect) status code. Here's a description in the Jersey documentation regarding how to return custom HTTP responses: https://jersey.java.net/documentation/latest/representations.html#d0e5151. I haven't tested the following snippet, but I'd imagine that the code would look something like this, for HTTP-301: @POST public Response yourAPIMethod() { URI targetURIForRedirection = ...; return Response.seeOther(targetURIForRedirection).build(); } ...or this, for HTTP-302: @POST public Response yourAPIMethod() { URI targetURIForRedirection = ...; return Response.temporaryRedirect(targetURIForRedirection).build(); }
type: AcceptedAnswer
downvote count: 0
score: 40
upvote count: 40
accepted answer of: http://stackoverflow.com/q/25330700
type: Answer
has comment: http://stackoverflow.com/comment/66167328
answers question: http://stackoverflow.com/q/25330700

http://stackoverflow.com/q/25284726
has title: Static final field initialization from static initializer
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25285085
has comment: http://stackoverflow.com/comment/39403514
tagged with: static-initializer
has answer: http://stackoverflow.com/a/25285085
linked to: http://stackoverflow.com/q/13778650
upvote count: 6
has comment: http://stackoverflow.com/comment/39403822
has body: Why isn't it possible to access static final fields from a corresponding static initializer using the declaring class as qualifier (in a static way)? At first, I thought this was an Eclipse bug: I also consisted some lack of knowledge, because static initializers are not my everyday business. But lo and behold, this works without the class qualifier as expected: To complete my test series, I gave it a try in the bash: causing the same result. This leads me to the final question: Is there any reason to prohibit the class qualifier when accessing static final fields from static initializer blocks? Because the declaring class wasn't initialized before?
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25285648
has answer: http://stackoverflow.com/a/25285648
tagged with: java
downvote count: 0
score: 6

http://stackoverflow.com/comment/39599044
comment on: http://stackoverflow.com/a/25390114
type: AnswerComment
has text: if you are using IDE in the ide's classpath or else Tomcat's lib folder
score: 0
type: Comment

http://stackoverflow.com/comment/39467338
type: Comment
has text: That was not there when I send that comment. So that was my bad.
type: AnswerComment
comment on: http://stackoverflow.com/a/25318983
score: 0

http://stackoverflow.com/q/25239200
upvote count: 6
has comment: http://stackoverflow.com/comment/39415136
favorite count: 0
has answer: http://stackoverflow.com/a/25315379
type: Question
tagged with: netbeans
answer count: 2
has comment: http://stackoverflow.com/comment/39338051
possible better answer: http://stackoverflow.com/a/30185258
has comment: http://stackoverflow.com/comment/39448122
has comment: http://stackoverflow.com/comment/39358810
downvote count: 0
has comment: http://stackoverflow.com/comment/39435413
has comment: http://stackoverflow.com/comment/39358884
tagged with: maven
has comment: http://stackoverflow.com/comment/39443043
has body: I'm newborn in writing anotations in Java. I was trying to write my own following this tutorial: Playing with Java annotation processing I wrote everything like it is there, but during compilation I'm getting an error: Bad service configuration file javax.annotation.processing.Processor Provider <my class> not found. I'm using netbeans and maven with plugin maven-compiler-plugin v. 2.5.1. and java sources v.1.8. In my pom.xml file I have (like suggested in page) following code: maven-compiler-plugin 2.5.1 1.8 1.8 -proc:none My OS is Linux (leatest ubuntu) and maven is that one integrated in Netbeans. I was trying to google it, but nothing helped me. All tutorials were for older release of plugin and Java. I tried older release of maven-compiler-plugin but with no effect. I cannot switch to older version of java because of new features introduced in Java 8. Thanks a lot for any pointing me how to fix it. Edit: Here is full list of my sources: Config.java @Retention(RetentionPolicy.SOURCE) @Target(value = {ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER}) public @interface Config { String name(); String type(); String defaultValue(); } ConfigAnnotationProcessor.java @SupportedAnnotationTypes( {"sk.lieskove301.jianghongtiao.motionanalyser.config.ConfigAnnotations"} ) public class ConfigAnnotationProcessor extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) { Messager messager = processingEnv.getMessager(); annotations.stream().forEach((te) -> { env.getElementsAnnotatedWith(te).stream().forEach((e) -> { messager.printMessage(Diagnostic.Kind.NOTE, "Printing: " + e.toString()); }); }); return true; } @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latestSupported(); } } META-INF/services/javax.annotation.processing.Processor sk.lieskove301.jianghongtiao.motionanalyser.config.ConfigAnnotationProcessor pom.xml <?xml version="1.0" encoding="UTF-8"?> 4…
score: 6
has comment: http://stackoverflow.com/comment/39440232
has comment: http://stackoverflow.com/comment/39393651
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39368465
tagged with: java
has answer: http://stackoverflow.com/a/30185258
has comment: http://stackoverflow.com/comment/39354000
has title: Compilation error for annotations in Java using maven-compiler-plugin 2.5.1 with java 1.8 and netbeans
accepted answer: http://stackoverflow.com/a/25315379
has comment: http://stackoverflow.com/comment/39318593

http://stackoverflow.com/a/25461157
type: Answer
answers question: http://stackoverflow.com/q/25287626
accepted answer of: http://stackoverflow.com/q/25287626
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: openejb-jar.xml is the way to do it I blogged about it here http://rmannibucau.wordpress.com/2012/10/04/jax-rsjax-ws-configuration-for-tomee-1-5-0/ only change on recent tomee version is the fact you need to set as class-name the jaxrs application you use (if noone use "jaxrs-application" which means default behavior) so something like: cxf.jaxws.in-interceptors = org.superbiz.MyInInterceptor
score: 2

http://stackoverflow.com/q/25236333
type: Question
has comment: http://stackoverflow.com/comment/39313453
has answer: http://stackoverflow.com/a/25236363
downvote count: 5
has answer: http://stackoverflow.com/a/25236366
has body: I have read the documentation, but some says it creates two objects, some says it creates one object only. In interviews these things are asked frequently, I don't know what to say and explain how I got the answer. How many String objects will be created when we write only this statement? public class Test123 { String st = new String(); }
has comment: http://stackoverflow.com/comment/39313427
possible better answer: http://stackoverflow.com/a/25236723
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25236723
has answer: http://stackoverflow.com/a/25236401
tagged with: new-operator
score: -1
has title: How many objects will be created when using only "new" operator in JAVA?
favorite count: 0
upvote count: 4
accepted answer: http://stackoverflow.com/a/25236363
answer count: 4

http://stackoverflow.com/a/25249092
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: You can call toArray() which, intuitively, returns a List&lt;DBObject&gt;. You're getting one document back because you passed limit(1) to the cursor.
answers question: http://stackoverflow.com/q/25247822

http://stackoverflow.com/a/29221077
downvote count: 0
has body: The -l option is not an option that is parsed by a classifier, but by Weka's Evaluation class. If you want to load a serialized model, you have to deserialize it manually. You can do this as follows: import weka.core.serialization as serialization from weka.classifiers import Classifier objects = serialization.read_all("naivebayes.model") classifier = Classifier(jobject=objects[0]) print(classifier) The above code assumes that the model was serialized with Weka, as it stores two objects in the file, the model and the dataset header. The above code was taken from the python-weka-wrapper documentation.
has comment: http://stackoverflow.com/comment/99458733
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25377194

http://stackoverflow.com/comment/39547161
has text: Yup. Don't forget to click the `service()` link in my answer for the definitive answer.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25363007

http://stackoverflow.com/comment/39313452
has text: post your logcat please
comment on: http://stackoverflow.com/q/25236272
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/39550619
has text: Documentation saves, [java.util.LinkedList](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html).
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25364925

http://stackoverflow.com/comment/39522319
type: QuestionComment
has text: It's because you test only one character in a global research, not the whole string from begining to end.
score: 3
comment on: http://stackoverflow.com/q/25349418
type: Comment

http://stackoverflow.com/q/25238699
has comment: http://stackoverflow.com/comment/39318863
has body: I use Maven 3 filters to fulfil place holders in xml files. But this requires that the inserted value is (already) xml escaped. What I want is: that Maven take care of escaping the value while putting it in the xml file. What I have so fare: Excerpt from the filtered xml file: &lt;Resource name="jdbc/dbConnection" url="${it.testDb.jdbc}" ... /&gt; The Propery from the Maven pom: &lt;it.testDb.jdbc&gt; jdbc:mysql://localhost:3306/testdb?useUnicode=true&amp;amp;amp;characterEncoding=utf8 &lt;/it.testDb.jdbc&gt; You noticed that I have to use &amp;amp;amp;. and this is what I want to get rid of, instead I want to write only &amp;amp; (the first &amp;amp; is because Maven load the parameter from an XML file (pom.xml), thats ok, but the second amp; only needed because Maven does not escape the string while writing, and this is what I want to get rid of.) So is there a way that Maven escape the the value to xml-style when it puts the parameter in the file while filtering? To be clear: I know that the (first) &amp;amp; is needed because the pom is an xml file (like guido suggested in his comment, one can get rid of this by using &lt;![CDATA[jdbc:mysql://localhost:3306/testdb?useUnicode=true&amp;amp;characterEncoding=utf8]]&gt;). But I am interested in get rid of the second &amp;amp; that is needed because the destination file is an xml. -- Reason: assume I have to write the same value/placeholder in an xml and an txt file, then I would need two different values (one xml escaped and a not escaped one)
downvote count: 0
has comment: http://stackoverflow.com/comment/39318124
has comment: http://stackoverflow.com/comment/39317959
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39346256
type: Question
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/39318972
has comment: http://stackoverflow.com/comment/39352191
tagged with: escaping
score: 2
has title: How to get rid of double escaping (`&amp;amp;`) when use Maven filters for xml files?
answer count: 0
upvote count: 2
tagged with: java

http://stackoverflow.com/q/25260254
tagged with: java
answer count: 1
has title: Using google places api in android
type: Question
type: UnansweredQuestion
tagged with: android
has body: I want to use Google places API in android project.But only 1000 requests are allowed in a day.I read somewhere that if i verify with credit card i will be getting 100,000 requests per day.My question is that will i be charged for the 100,000 requests? I have yet to start the project.Below is some irrelevant code. public void initialiseMap() { // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } else { //MapsInitializer.initialize(MainActivity.this); googleMap.setMyLocationEnabled(true); googleMap.getUiSettings().setMyLocationButtonEnabled(true); //googleMap.getUiSettings().setCompassEnabled(true); // UiSettings uiSettings = googleMap.getUiSettings(); // uiSettings.setMyLocationButtonEnabled(true); } //locationManager.requestLocationUpdates(provider, 20000, 0, this); LatLng latLng = new LatLng(current_latitude, current_longitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Zoom in the Google Map //googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12f)); new RetrieveStoreDetails().execute(); }
has answer: http://stackoverflow.com/a/25260419
score: 0
tagged with: google-places-api

http://stackoverflow.com/q/25253292
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39345584
answer count: 0
has body: I am trying to emulate a usb hid device by writing a usbip server. I don't think it's too relevant, but the client is installed on windows 7 and my server is written in java for Android. I get requests for device and configuration descriptors and return valid responses. Then I receive a SET_IDLE command and the client waits for ever for a reply. I've been reading and coding for days but am unable to produce the response expected by the client. I believe it is waiting for a NAK packet, but I have no idea how that packet is formed for usbip. Please help!
upvote count: 1
score: 1
tagged with: tcp
has comment: http://stackoverflow.com/comment/50086623
tagged with: java
tagged with: usb
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39345768
has title: USBIP NAK packet

http://stackoverflow.com/q/25336153
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39499704
has comment: http://stackoverflow.com/comment/39499875
type: Question
type: UnansweredQuestion
has body: I have written this java code for sending email but this code is throwing an exception (com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1; nested exception is:) please help. import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class SendEmail { public static void main(String [] args) { String to = "to@gmail.com"; String from = "from@seecs.edu.pk"; String host = "localhost"; Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host); Session session = Session.getDefaultInstance(properties); try{ MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("This is the Subject Line!"); message.setText("This is actual message"); Transport.send(message); System.out.println("Sent message successfully...."); } catch (MessagingException mex) { mex.printStackTrace(); } } }
score: 0
has title: com.sun.mail.util.MailConnectException is thrown while sending email

http://stackoverflow.com/q/25241894
duplicate of: http://stackoverflow.com/q/218384
score: -3
has title: java.lang.NullPointerException in chatclient
has body: I am a newbie to Java and I'm creating a chat client which can send and receive text. But I'm stuck here: exception-at Netr$IncomingReader.run(Netr.java:88) at java.lang.Thread.run(Thread.java:745) java.lang.NullPointerException The application terminates with a java.lang.NullPointerException when it's getting executed. Please help. Thanks in advance. import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class Netr { JTextArea incoming; JTextField outgoing; BufferedReader reader; PrintWriter writer; Socket sock; JScrollPane qscroller; public static void main(String[]args) { Netr ab=new Netr(); ab.go(); } public void go() { JFrame frame=new JFrame("my first client baby"); JPanel panel=new JPanel(); incoming=new JTextArea(); incoming.setLineWrap(true); incoming.setWrapStyleWord(true); incoming.setEditable(false); qscroller=new JScrollPane(incoming); qscroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); qscroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); outgoing=new JTextField(20); JButton sendbutton=new JButton("Send"); sendbutton.addActionListener(new SendButtonListener()); panel.add(qscroller); panel.add(sendbutton); panel.add(outgoing); setupnetworking(); IncomingReader thef=new IncomingReader(); Thread abc=new Thread(thef); abc.start(); frame.getContentPane().add(BorderLayout.CENTER,panel); frame.setSize(400,500); frame.setVisible(true);} private void setupnetworking() { try { ServerSocket serversock=new ServerSocket(3311); sock =new Socket("100.68.56.116",3311); Socket sock1=serversock.accept(); InputStreamReader reader=new InputStreamReader(sock.getInputStream()); BufferedReader streamreader=new BufferedReader(reader); writer=new PrintWriter(sock.getOutputStream()); System.out.println("newtorking established"); } catch(IOException ex) { ex.printStackTrace(); } } public class SendButtonListener implements ActionListener {…
has answer: http://stackoverflow.com/a/25242035
upvote count: 0
has comment: http://stackoverflow.com/comment/39323506
downvote count: 3
tagged with: java
answer count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/218384
type: UnansweredQuestion

http://stackoverflow.com/comment/39559151
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25369154
has text: If you're not tied to Java, you could use `sed` or `awk`. They can delete the comment while preserving the line count

http://stackoverflow.com/q/25295943
tagged with: selenium-webdriver
type: AnsweredQuestion
answer count: 3
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/25302878
tagged with: selenium
has body: i am trying to navigate through pages using selenium web driver and i am stuck at one point please refer to the image where i have shown the output of inspect element for that page that i am working on. but in the page source (which i saw on the browser and also using Jsoup) looks like this, &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;frameset rows=&quot;75,60,*&quot; resize=&quot;no&quot; SCROLLING=&quot;NO&quot; name=main border=&quot;0&quot;&gt; &lt;frame src=&quot;/frame/topnewprof.shtml&quot; name=&quot;top&quot; SCROLLING=NO&gt; &lt;frame src=&quot;/frame/blank.html&quot; name=&quot;menu&quot; SCROLLING=NO &gt; &lt;frame src=&quot;/itrade/user/welcome.exe?action=chk_seckey_stat&quot; name=&quot;body&quot; SCROLLING=AUTO&gt; &lt;/frameset&gt; &lt;body&gt;&amp;nbsp; &lt;/BODY&gt;&lt;/html&gt; why is this mismatch? and the yellow stuff that i have highlight in the image above has the element that i need!! how will i get there using selenium?? i know that we can navigate into the iframe using selenium's switchTo().frame() but even if i get into any of the three frames as shown above in the page source information, i'm not able to find the information i need, can this be achieved ? is it even possible?
has title: Selenium Java - inspect element and page source shows different infiormation
favorite count: 0
type: Question
tagged with: jsoup
score: 5
has answer: http://stackoverflow.com/a/39127877
accepted answer: http://stackoverflow.com/a/40275973
downvote count: 0
has answer: http://stackoverflow.com/a/40275973
has answer: http://stackoverflow.com/a/25302878

http://stackoverflow.com/comment/64195036
comment on: http://stackoverflow.com/a/30626050
type: Comment
has text: Thanks, @Marrow父, this solution did help in my case.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39523420
score: 0
type: AnswerComment
has text: They can be on the same base class. But the problem is that BillingAddress is defined as a subclass of ShippingAddress. So every BillingAddress **is a** ShippingAddress. So when you query for shipping addresses, Hibernate returns all the shipping addresses matching the criteria, including billing addresses, since they **are** shipping addresses.
type: Comment
comment on: http://stackoverflow.com/a/25349361

http://stackoverflow.com/comment/39852956
comment on: http://stackoverflow.com/a/25526519
has text: i just want to know where will put sqlite3_create_function() and how it will be call to setup communication with custom function.Is there any demo please provide.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39531455
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25349655
has text: Really, is it as simple as overriding `attach` and `detach`? Also, if I am not subclassing a Layout, is there a way to subscribe as a listener to the attachment/detachment events? I did see some such methods in the doc, but they confused me.

http://stackoverflow.com/q/25327340
downvote count: 0
tagged with: selenium
tagged with: google-chrome
favorite count: 0
has body: When I run my automated tests on jenkins, sometimes some tests are being skipped. I'm getting the following error: org.openqa.selenium.WebDriverException: chrome not reachable. For what if've read on google this happens when there is and error initializing the webdriver instance. And this makes the tests skip and leaves the chromedriver.exe process still running. Is there a way to handle the exception so when this happens I can kill the process?. Or a way on how to fix the issue so that test aren't skipped. Below is the code on how I initialize chromedriver. private void chromeDriverSetUp(){ System.setProperty(DRIVER_PATH_PROPERTY_NAME, DRIVER_PATH); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("nativeEvents", true); ChromeOptions options = new ChromeOptions(); options.addArguments("--lang=es"); options.addArguments("--disable-extensions"); options.addArguments("start-maximized"); capabilities.setCapability(ChromeOptions.CAPABILITY, options); driver = new ChromeDriver(capabilities); } And this is the method that fails when the exception is thrown: @Parameters({"subModel", "moduleName", "testName", "testLinkName"}) @BeforeMethod public void handleTestMethodName(Method method, String subModel, String moduleName, String testName, String testLinkName) throws Exception { this.subModel=subModel; this.moduleName = moduleName; this.testName = testName; this.testLinkName = testLinkName; this.testMethod = method.getName(); this.testClass = method.getDeclaringClass().getSimpleName(); initializeSelenium(); String modulo = ""; if(subModel.equalsIgnoreCase("ISSUER")){ modulo = PropertiesManager.getInstance().getProperty(EPropertiesNames.MOD_ISSUER); }else{ modulo = PropertiesManager.getInstance().getProperty(EPropertiesNames.MOD_ACQUIRER); } setCMSModulo(modulo); startAccess(); }
score: 1
tagged with: java
type: Question
has title: Handling Webdriver chrome not reachable exception
answer count: 0
tagged with: jenkins
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/39515834
has text: @RetoKoradi Is there a different way I can set that up so I don't need to? I tried removing .withProfileCore(true) to no avail. The tutorial hasn't mention anything about custom shaders at this point.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25345469

http://stackoverflow.com/q/25233709
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39308367
downvote count: 4
upvote count: 0
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/39308312
answer count: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/39308397
favorite count: 0
type: Question
has body: I am having issues in implementing the Generic DirectGraph Implementation. Please help me! public interface DirectedGraph&lt;Vertex&lt;T extends Comparable&lt;T&gt;&gt;&gt; { &lt;T extends Comparable&lt;T&gt;&gt; boolean addVertex(Vertex&lt;T&gt; v); &lt;T extends Comparable&lt;T&gt;&gt; boolean addEdge(Vertex&lt;T&gt; v1, Vertex&lt;T&gt; v2); int size(); &lt;T extends Comparable&lt;T&gt;&gt;boolean removeEdge(Vertex&lt;T&gt; v1, Vertex&lt;T&gt; v2); &lt;T extends Comparable&lt;T&gt;&gt;boolean hasEdge(Vertex&lt;T&gt; v1, Vertex&lt;T&gt; v2); } public class Vertex&lt;E extends Comparable&lt;E&gt;&gt; { E vertex; } What is wrong with the above code?. Eclipse is showing the error Multiple markers at this line - Syntax error on token "&lt;", , expected - The type parameter Vertex is hiding the type Vertex&lt;E&gt; - Syntax error on token "&gt;&gt;&gt;", &gt;&gt; expected
accepted answer: http://stackoverflow.com/a/25233800
has comment: http://stackoverflow.com/comment/39308241
has comment: http://stackoverflow.com/comment/39308295
has answer: http://stackoverflow.com/a/25233800
has comment: http://stackoverflow.com/comment/39308279
has title: Generic Implementation of Directed Graph

http://stackoverflow.com/a/25363235
answers question: http://stackoverflow.com/q/25362316
accepted answer of: http://stackoverflow.com/q/25362316
has body: Found it: one have to set useCodeAsDefaultMessage to true it doesn't log errors but at least don't bother you with fatal errors for example in XML config: /WEB-INF/i18n/main /WEB-INF/i18n/dashboard protip: In dev you can also use a ReloadableResourceBundleMessageSource with cacheSeconds=0 to reload translations on each page refresh
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/39360283
score: 5
type: AnswerComment
has text: Yes - that's certainly the case - though the part is verbatim from the original code - so the OP will have to structure it to what is actually needed.
type: Comment
comment on: http://stackoverflow.com/a/25259487

http://stackoverflow.com/a/25305555
answers question: http://stackoverflow.com/q/25304506
has comment: http://stackoverflow.com/comment/39468933
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39443782
upvote count: 1
score: 1
has body: In your AndroidManifest.xml, need some of the tag. Please reference my sample AndroidManifest.xml. <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="bm.app.shiftmanagement" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.RECEIVE_SMS"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> In your AndroidManifest.xml, need to modify this place. <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

http://stackoverflow.com/q/25329965
downvote count: 0
has answer: http://stackoverflow.com/a/25355739
tagged with: java
tagged with: hibernate
tagged with: jpa
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41345001
has title: How to properly implement optimistic locking for related entities in JPA
tagged with: locking
has comment: http://stackoverflow.com/comment/39489912
type: UnansweredQuestion
tagged with: database
has answer: http://stackoverflow.com/a/25332757
score: 2
upvote count: 2
has body: Below is the simplified version of my data model: @Entity @Table(name = "DATA_TABLE") public class DataTable implements Serializable { @Id @Column(name = "DATA_TABLE_ID") private int dataTableId; @Column(name = "TITLE") private String title; @OneToMany(mappedBy = "dataTableId", cascade = CascadeType.ALL, orphanRemoval = true) private Set&lt;Row&gt; rows; @Version @Column(name = "VERSION") private long version; } @Entity @Table(name = "ROW") public class Row implements Serializable { @Id @Column(name = "ROW_ID") private int rowId; @ManyToOne @JoinColumn(name = "DATA_TABLE_ID") private DataTable dataTable; @OneToMany(mappedBy = "dataTableId", cascade = CascadeType.ALL, orphanRemoval = true) private Set&lt;Row&gt; rows; } @Entity @Table(name = "CELL") public class Cell implements Serializable { @Id @Column(name = "CELL_ID") private int cellId; @ManyToOne @JoinColumn(name = "ROW_ID") private Row row; @Column(name = "TEXT") private String text; } I need to implement the optimistic locking for that model that is compatible with existing system. In it, the version from the DataTable is sent to the user of the service, they have to send it back alongside the acion they performed and this is used to verify that there were no changes in the meantime. The version field is updated whenever there is a change to Row or Cell that belongs to that particular DataTable. Unfortunately this does not seem to work with JPA @Version annotation(Hibernate 4.1.9). The version field is updated when there is a change to the properties persisted in DATA_TABLE table, e.g. title, but changing/adding rows and cells does not increment the version value. Is there any way to achieve this functionality in JPA either by @Version or some other mechanism(expicit locking?) that prevents concurrency bugs such as Time of check to time of use?
answer count: 2

http://stackoverflow.com/comment/39433484
type: AnswerComment
has text: And wouldn't an empty file simply be 0 bytes long? What if the file contained nothing more the line breaks??
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25299766

http://stackoverflow.com/comment/39308434
score: 0
comment on: http://stackoverflow.com/q/25233768
has text: @UperOne done. Check it now
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39353196
has text: The jar should contain the icons. By putting them outside of the src directory and using the basic export functions of your IDE, the images were probably not included in the jar file. A jar file is just a zip file, so open it, and see if they're present and in which package. But really, since they're resources that must be loaded by the ClassLoader just like class files, they should be in some package under the src directory (or any other directory that is a source folder in your IDE project)
comment on: http://stackoverflow.com/q/25257513
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40496155
score: 0
type: QuestionComment
has text: Why did you just delete your [recent Swing mouse question](http://stackoverflow.com/questions/25877081/how-to-get-mouse-coordinates-on-a-canvas-without-an-event-in-java) after I already had answered it and as I was working on improving the answer? Most of us don't enjoy wasting time trying to help, just to see our answers disappear.
type: Comment
comment on: http://stackoverflow.com/q/25334426

http://stackoverflow.com/comment/39512956
score: 0
has text: above you can see the main app or should I show something specific?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25343629

http://stackoverflow.com/q/25352185
tagged with: java
has comment: http://stackoverflow.com/comment/39527424
has comment: http://stackoverflow.com/comment/39527520
has answer: http://stackoverflow.com/a/25352360
has comment: http://stackoverflow.com/comment/39527286
has comment: http://stackoverflow.com/comment/39527625
has body: I am trying to send the text data entered in popquizisabout class to the popquiz class and set it in text view but my app crashes when i do so this is the popquizisabout class public class PopQuizIsAbout extends Activity implements OnClickListener { EditText person; Button start, startforresult; TextView result; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.popquizisabout); initialize(); start.setOnClickListener(this); startforresult.setOnClickListener(this); } private void initialize() { // TODO Auto-generated method stub person = (EditText) findViewById(R.id.Etperson); start = (Button) findViewById(R.id.Bsa); startforresult = (Button) findViewById(R.id.Bsar); result = (TextView) findViewById(R.id.Tvresult); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.Bsa: String bread = person.getText().toString(); Bundle basket = new Bundle(); basket.putString("keyid", bread); Intent a = new Intent(PopQuizIsAbout.this,PopQuiz.class); a.putExtras(basket); startActivity(a); break; case R.id.Bsar: break; } } } this is the popquiz class public class PopQuiz extends Activity implements OnClickListener, OnCheckedChangeListener { TextView name, thought; Button returndata; RadioGroup selectionlist; String gotBread; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.popquiz); initialize(); returndata.setOnClickListener(this); selectionlist.setOnCheckedChangeListener(this); Bundle gotbasket = getIntent().getExtras(); gotBread = gotbasket.getString("keyid"); name.setText(gotBread); } private void initialize() { // TODO Auto-generated method stub name = (TextView) findViewById(R.id.Tvname); thought = (TextView) findViewById(R.id.Tvthought); returndata = (Button) findViewById(R.id.Breturn); selectionlist = (RadioGr…
type: Question
linked to: http://stackoverflow.com/q/4208886
has answer: http://stackoverflow.com/a/25352413
has comment: http://stackoverflow.com/comment/39527281
accepted answer: http://stackoverflow.com/a/25352502
tagged with: android
has comment: http://stackoverflow.com/comment/39527641
has comment: http://stackoverflow.com/comment/39527564
has answer: http://stackoverflow.com/a/25352502
has comment: http://stackoverflow.com/comment/39527222
has comment: http://stackoverflow.com/comment/39527359
has comment: http://stackoverflow.com/comment/39527161
has comment: http://stackoverflow.com/comment/39527456
has comment: http://stackoverflow.com/comment/39527272
type: AnsweredQuestion
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39527444
possible better answer: http://stackoverflow.com/a/25352360
has title: sending data between different activity not working

http://stackoverflow.com/q/25346565
has comment: http://stackoverflow.com/comment/39522941
downvote count: 0
has comment: http://stackoverflow.com/comment/39522940
favorite count: 0
tagged with: security
tagged with: html-sanitizing
tagged with: java
tagged with: sanitization
has body: I currently use owasp-java-html-sanitizer to sanitize user inputs from CKEditor/ FCKEditor but it removes embedded iframes as well. But I have genuine use cases like embedding a YouTube video or slide share presentation within posts. How do I allow such embedded iframes safely?
tagged with: ckeditor
has title: Sanitize html keeping embedded youtube etc videos/other media
type: Question
score: 2
linked to: http://stackoverflow.com/q/25341980
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/25358298
type: Answer
answers question: http://stackoverflow.com/q/25357666
has comment: http://stackoverflow.com/comment/39542750
has comment: http://stackoverflow.com/comment/39539073
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25357666
has body: Get the matched group from index 1 and 2 ([a-zA-Z0-9]+)\((.*?)\)(?=\+|$) Here is online demo The above regex pattern looks of for )+ as delimiter between keys and values. Note: The above regex pattern will not work if value contains )+ for example number(abc(kk)+123+4+4)+status(open) Sample code: String str = "number(abc(kk)123)+status(open)"; Pattern p = Pattern.compile("([a-zA-Z0-9]+)\\((.*?)\\)(?=\\+|$)"); Matcher m = p.matcher(str); while (m.find()) { System.out.println(m.group(1) + ":" + m.group(2)); } output: number:abc(kk)123 status:open

http://stackoverflow.com/q/25362316
possible better answer: http://stackoverflow.com/a/25362464
has body: I am using Spring Message Source for internationalization of my webapp. The problem is that a JspException is thrown whenever a message is not defined, it's a real pain in developement stage when many texts are added. What i would like is to log the error (in order to know which texts are missing) and print the key or a placeholder in the generated HTML. Is this a configurable thing ? -- edit: there is the text attribute, but it needs to be added to each message tag, and it doesn't log anything
type: Question
has answer: http://stackoverflow.com/a/25363235
answer count: 2
tagged with: jsp
tagged with: spring
tagged with: internationalization
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/25363235
type: AnsweredQuestion
score: 0
tagged with: java
has title: Silent fail for spring:message
has answer: http://stackoverflow.com/a/25362464

http://stackoverflow.com/comment/39594089
type: Comment
type: AnswerComment
has text: Yes controls go in one or parts on the page. These forms are called 'managed forms', there is a little bit on them in the help, some in the Javadoc and bits and pieces on the web. You can also look at the source of the PDE plugin.xml editor which uses this extensively.
comment on: http://stackoverflow.com/a/25384510
score: 0

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/25316058

http://stackoverflow.com/comment/39495145
score: 0
type: QuestionComment
has text: Seems like you'd benefit from using a `Map`
type: Comment
comment on: http://stackoverflow.com/q/25333718

http://stackoverflow.com/q/25329175
has title: How to load one of same named resources from different jars in a classpath?
has answer: http://stackoverflow.com/a/25329278
answer count: 5
has answer: http://stackoverflow.com/a/25330572
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58130859
downvote count: 0
tagged with: jar
tagged with: embedded-resource
upvote count: 7
tagged with: spring
has body: Let's say there is a jar main.jar which depends on two other jars - dep1.jar and dep2.jar. Both dependencies are in a classpath in MANIFEST.MF of main.jar. Each of dependency jars has a directory foo inside with a file bar.txt within: dep1.jar | \--foo/ | \--bar.txt dep2.jar | \--foo/ | \--bar.txt Here is a main class of main.jar: public class App { public static void main( String[] args ) { ApplicationContext ctx = new StaticApplicationContext(); Resource barResource = ctx.getResource("classpath:foo/bar.txt"); } } Which of two bar.txt files will be loaded? Is there a way to specify in a resource URL a jar the file should be loaded from?
has answer: http://stackoverflow.com/a/25329812
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/25330651
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39486207

http://stackoverflow.com/comment/39543844
type: QuestionComment
has text: _"It doesn't work"_ What exactly doesn't work?
score: 0
comment on: http://stackoverflow.com/q/25361219
type: Comment

http://stackoverflow.com/q/25290663
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39414480
has title: Java Regular Expression Concatenate single letters
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39414027
accepted answer: http://stackoverflow.com/a/25290771
tagged with: regex
has answer: http://stackoverflow.com/a/25290771
has comment: http://stackoverflow.com/comment/39414049
score: 1
tagged with: java
has body: I suspect I need a look around of some sort to achieve the replacement that I want. In simple terms, I want to combine all single alphanumeric into one term. The single letters could be at the start or in the middle of a sentence. A A Towing becomes AA Towing (Combine A + A) PL B C J Enterprises becomes PL BCJ Enterprises (Combine B+C+J) A B CD E Limitation becomes AB CD E Limitation (Combine A+B) About A River becomes About A River (No changes)
answer count: 1

http://stackoverflow.com/comment/39511711
type: Comment
comment on: http://stackoverflow.com/q/25342962
type: QuestionComment
has text: When I change the ciudad value doesn't change from Home_fragment() to Home_fragment_staFe()
score: 0

http://stackoverflow.com/q/25388366
has title: Android layout_weight not working as it should be
has comment: http://stackoverflow.com/comment/39595552
tagged with: java
has answer: http://stackoverflow.com/a/25388514
has comment: http://stackoverflow.com/comment/39595548
has comment: http://stackoverflow.com/comment/39595497
tagged with: http://stackoverflow.com/tag/xml
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39595560
has comment: http://stackoverflow.com/comment/39595617
tagged with: layout
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39595495
has comment: http://stackoverflow.com/comment/39595540
has answer: http://stackoverflow.com/a/25388489
has body: I'm trying to set my ImageView and LinearLayout to have half of the screen each. This works fine on tablets, but on smaller screens the image takes up the entire screen (thus, not actually working). The way I see it is, I have set a layout_weight="1" on both the ImageView and LinearLayout and the layout_width="0dp" on both also. This SHOULD work, as I have researched a lot into this. My Code: <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="@drawable/image"/> <TextView android:id="@+id/text_view_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:gravity="center" android:textSize="24dp" android:textColor="@color/button_text_white" android:visibility="invisible"/> <TextView android:id="@+id/text_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sign_up_in_username_text" android:textColor="@color/color"/> <EditText android:id="@+id/edit_text_username" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:inputType="text" android:textColor="@color/color" android:hint="@string/sign_up_in_username_hint"/> <TextView android:id="@+id/text_email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sign_up_in_email_text" android:textColor="@color/color"/> <EditText android:id="@+id/edit_text_email" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:inputType="textEmailAddress" android:textColor="@color/color" android:hint="@string/sign_up_in_email_hint"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sign_up_in_password_text" android:textColor="@color/color"/> <EditText android:id="@+id/edit_text_password" android:lay…
has comment: http://stackoverflow.com/comment/39595660
score: 0

http://stackoverflow.com/comment/39476609
score: 1
comment on: http://stackoverflow.com/a/25320944
type: Comment
type: AnswerComment
has text: No it will not keep reading for the Channels that are assigned to the EventLoop.

http://stackoverflow.com/q/25338127
answer count: 2
tagged with: sharedpreferences
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has title: How to set app background via the SharedPreferences?
has body: I want to allow users to change my app's background from the settings (for the Main_UI activity class). I am not able to store the uri in a string since there is no startActivityForResult() method that could extract the intent's uri (The Preferences only allow starting an intent, preferably to other settings)(I tried creating custom Preference Class but again, not startActivityForResult). I tried doing it via the menu options, taking the uri and creating a drawable from it. But when I apply that drawable to my RelativeLayout instance, it says its supported only beyond API 16. Mine is 15. Any help would be really appreciated, since this android is getting on my nerves.
type: Question
has answer: http://stackoverflow.com/a/25338597
tagged with: android
has answer: http://stackoverflow.com/a/60217441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39503375
tagged with: image
has comment: http://stackoverflow.com/comment/39509224
tagged with: java

sensors
type: Tag
tags question: http://stackoverflow.com/q/25340877
tag name: sensors
tags question: http://stackoverflow.com/q/25264997

http://stackoverflow.com/q/25265834
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25265992
possible better answer: http://stackoverflow.com/a/25265992
tagged with: jaxb2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25266709
tagged with: java
accepted answer: http://stackoverflow.com/a/25266709
tagged with: jaxb
has title: How parse xml using jaxb
tagged with: http://stackoverflow.com/tag/xml
has body: I am new in JAXB, I want to read XML file to Java object, which is in the following format: G H Y Please help me how to read this type of XML.
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/q/25264827
tagged with: java
has comment: http://stackoverflow.com/comment/39399837
has title: ArrayIndexOutOfBoundsException while Spring save data to MongoDB
has comment: http://stackoverflow.com/comment/39400034
has comment: http://stackoverflow.com/comment/39399604
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39654717
answer count: 0
linked to: http://stackoverflow.com/q/25237986
downvote count: 0
has body: This qustion is separated from: Spring doesn't save object to MongoDB correctly I have SampleClass which has one field - TreeMap&lt;String, TreeMap&lt;String,String&gt;&gt; map. When I deploy application and run following code: SampleClass sample = new SampleClass(); mongo.save(sample, "SampleCollection"); //MongoOperations object I get following exception: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 0] with root cause java.lang.ArrayIndexOutOfBoundsException: 0 at org.springframework.data.util.ParameterizedTypeInformation.getComponentType(ParameterizedTypeInformation.java:147) at org.springframework.data.util.TypeDiscoverer.getActualType(TypeDiscoverer.java:292) at org.springframework.data.util.ParentTypeAwareTypeInformation.getActualType(ParentTypeAwareTypeInformation.java:29) at org.springframework.data.mapping.model.AbstractPersistentProperty.getPersistentEntityType(AbstractPersistentProperty.java:125) at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:469) at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:427) at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:607) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:295) at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:470) at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:427) at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:607) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(A…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39399361
tagged with: spring-data-mongodb
tagged with: spring
tagged with: spring-boot
score: 1
upvote count: 1

http://stackoverflow.com/a/25381309
score: 0
answers question: http://stackoverflow.com/q/25380845
type: Answer
has body: Please use form submission on that with post. Please use hidden tag for that value and submit the page. In that action class you will get from form.

jmockit
type: Tag
tag name: jmockit
tags question: http://stackoverflow.com/q/25334139
tags question: http://stackoverflow.com/q/25260342
tags question: http://stackoverflow.com/q/25239477

http://stackoverflow.com/comment/39360461
score: 0
type: Comment
has text: are you closing the writer in the end? like csvOutputCount.close(); sometimes, writers need to be closed to flush their internal buffers
type: QuestionComment
comment on: http://stackoverflow.com/q/25261618

http://stackoverflow.com/a/25355212
type: AcceptedAnswer
downvote count: 3
answers question: http://stackoverflow.com/q/25354999
has body: You can use isAnnotationPresent() reflection method // Get all classes List&lt;Class&gt; klasses = .. // Filter only those containing for(Class k : klasses) { if(k.isAnnotationPresent(MainForm.class)) ... }
type: Answer
has comment: http://stackoverflow.com/comment/118425670
has comment: http://stackoverflow.com/comment/39532673
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25354999
score: 0

http://stackoverflow.com/q/25270239
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: HttpPost works on Android's SDK 8, but not SDK 17
tagged with: http
answer count: 1
has comment: http://stackoverflow.com/comment/39376578
tagged with: sdk
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39376765
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25272238
has body: When I insert SDK 17 into the manifest file, nothing works (it does not load). But when I insert SDK 8, it works. private void loadq(){ DefaultHttpClient httpclient = new DefaultHttpClient(new BasicHttpParams()); HttpPost httppost = new HttpPost("http://iwindroids.ru/app/fla/getq"); httppost.setHeader("Content-type", "application/json"); InputStream inputStream = null;String result = null; try { HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); inputStream = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null){sb.append(line + "\n");} result = sb.toString(); JSONObject jObject = new JSONObject(result); String t = jObject.getString("t").replace("--", "—"); String a = jObject.getString("a"); //String i = jObject.getString("i"); TextView et = (TextView) findViewById(R.id.textView1); EditText at = (EditText) findViewById(R.id.editText2); et.setText(t+"."); at.setText(a); live(); showTimer(); } catch (Exception e){} finally {try{if(inputStream != null)inputStream.close();}catch(Exception squish){}} } Thank You!

http://stackoverflow.com/q/25371359
has title: Eclipse Java Debugger: easier way see values in the debugger that are in nested collections?
has body: I'm new to the debugger and Eclipse. I have many situations where holder objects, POJOs, are put into collections and sometimes those collections are even put into other collections. It becomes very cumbersome when debugging a loop to keep opening many tree nodes just to see the value of a particular variable, have it turn out not to be what I was looking, having to advance to the next step,then having to open up all of those tree nodes again. I tried setting a "watch" but values that showed in the rest of the debugger didn't show there. I'm not very familiar with debbugers so perhaps I am misunderstanding the concept of a watch. In any event, is there an easy way to see a particular variable's value when that variable is nested in several collections or objects, such that I don't have to expand tree nodes each time I want to see it?
answer count: 1
has comment: http://stackoverflow.com/comment/39563458
favorite count: 0
tagged with: debugging
has comment: http://stackoverflow.com/comment/39563503
tagged with: java
has answer: http://stackoverflow.com/a/25371410
tagged with: eclipse
type: Question
upvote count: 2
score: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25355299
type: AnsweredQuestion
score: 0
tagged with: android-fragments
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39533145
has comment: http://stackoverflow.com/comment/39532834
has comment: http://stackoverflow.com/comment/39532818
has answer: http://stackoverflow.com/a/25355471
has comment: http://stackoverflow.com/comment/39533052
has comment: http://stackoverflow.com/comment/39532931
accepted answer: http://stackoverflow.com/a/25355471
has comment: http://stackoverflow.com/comment/39533071
has body: I have found a lot of questions related to this, but not still able to over come mine. android.view.InflateException: Binary XML file line #91: Error inflating class fragment My question is does the case differ with #91? Because no body has ever asked with this(though other questions have #20, #2, #11). Or this is just like indicating line number in .java?. Let me know if I have to provide some more details. P.S.: I get this error, when I swipe the pages of ViewPager but only at second round. Thank you My complete logcat 08-19 07:32:24.080: E/AndroidRuntime(15498): FATAL EXCEPTION: main 08-19 07:32:24.080: E/AndroidRuntime(15498): android.view.InflateException: Binary XML file line #91: Error inflating class fragment 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 08-19 07:32:24.080: E/AndroidRuntime(15498): at com.example.fragments.Recommend.onCreateView(Recommend.java:47) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1291) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:672) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) 08-19 07:32:24.080: E/AndroidRuntime(15498): at android.support.v4.app.FragmentM…
has comment: http://stackoverflow.com/comment/39532963
answer count: 1
has comment: http://stackoverflow.com/comment/39532998
has comment: http://stackoverflow.com/comment/39533043
has title: android.view.InflateException: Binary XML file line #91: Error inflating class fragment
has comment: http://stackoverflow.com/comment/39532899
has comment: http://stackoverflow.com/comment/39532854
type: Question

http://stackoverflow.com/a/25365956
answers question: http://stackoverflow.com/q/25365664
score: 0
accepted answer of: http://stackoverflow.com/q/25365664
type: AcceptedAnswer
has body: It can be done without different values in your property file. For e.g. you could have your label as such: my.label=Length must be lower than 5!,Length must be value between 2 and 5! But this is NOT recommended. You need to split it based on your separator, comma in this case, and handle that logic yourself. The clean solution would be: my.label.error.maxsize=Length must be lower than 5! my.label.error.size=Length must be between 2 and 5! And of course the value maxsize or size can be set programatically. EDIT: The java implementation depends a lot on the framework used to load values from property files.
type: Answer

http://stackoverflow.com/a/25302977
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Use setContentView(textView); before findViewById i.e. rewrite your code as @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set the text view as the activity layout setContentView(R.layout.activity_main); // Get the message from the intent } and change Intent intent = getIntent(); to Intent intent = getActivity().getIntent(); and use Intent intent = getActivity().getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); TextView textView = (TextView) findViewById R.id.DisplayActivityMessageTextView); // Create the text view textView.setText(message); in onCreateView of your mainFragment because DisplayActivityMessageTextView is part of your fragment.
accepted answer of: http://stackoverflow.com/q/25302887
type: Answer
answers question: http://stackoverflow.com/q/25302887
score: 2

http://stackoverflow.com/a/25307880
accepted answer of: http://stackoverflow.com/q/25307776
has body: Change for(int i=0;i&gt;arrTrans.size(); i++) to for(int i=0;i&lt;arrTrans.size(); i++) You misunderstood the condition in the middle of the for loop : it does not mean "While my condition is not true", it means "While my condition is true" The loop would have never been executed with what you typed. arrTrans.length will never give you something inferior to 0, because the ArrayList's length is 0 if it is empty. EDIT : If it is not a problem with the for-loop condition, it might be a problem with the ArrayList. Try to replace i&lt;arrTrans.size() by i&lt;arrTrans.toArray().length, it might help
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/25307776
type: Answer
has comment: http://stackoverflow.com/comment/39446040
has comment: http://stackoverflow.com/comment/39446470

paint
tags question: http://stackoverflow.com/q/25337121
tag name: paint
tags question: http://stackoverflow.com/q/25314503
tags question: http://stackoverflow.com/q/25251261
type: Tag
tags question: http://stackoverflow.com/q/25379397

http://stackoverflow.com/comment/41779084
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25387105
has text: You might also want to look at the [JPAContainer](https://vaadin.com/book/-/page/jpacontainer.html).

http://stackoverflow.com/q/25320086
answer count: 0
tagged with: operating-system
tagged with: java
downvote count: 0
tagged with: bundle
tagged with: classpath
favorite count: 0
type: Question
has body: Does OS X permit a signed application to execute Java class files that are outside of the application bundle? For years we've distributed a Java application whose class files lie outside the executable bundle -- so that modules can be found and loaded dynamically -- using the bundle's Info.plist file to specify the external classpath (as $APP_PACKAGE/../). Before starting the apparently-arduous journey to getting the app signed, I wanted to see if such an arrangement was even permitted in the modern security-conscious world.
upvote count: 2
type: UnansweredQuestion
score: 2
has title: Classpath outside of signed Java application bundle in OS X?

http://stackoverflow.com/q/25328956
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39494444
has answer: http://stackoverflow.com/a/25709895
has body: I have a multi-module maven project. My story files are in a module of their own, because we have separate gui and api tests driven from them, and a jar is created containing these -- the story files are named *.feature. In another module I have created a Story class: public class NewAnnouncements extends JUnitStory { @Override public Configuration configuration() { return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath()); } @Override public InjectableStepsFactory stepsFactory() { return new InstanceStepsFactory(configuration(), new NewAnnouncements()); } } But, predictably, this does not find its stories. How could it? The stories aren't called *.story and they aren't on the filesystem (though they are in the same classpath). The error I get is: org.jbehave.core.io.StoryResourceNotFound: Story path 'org/.../announcement/new_announcements.story' not found by class loader sun.misc.Launcher$AppClassLoader@63e68a2b How do I get jbehave to find my story files? How do I make it understand that they're not called *.story?
type: Question
has title: Loading stories from classpath (and stories aren't called .story)
tagged with: jbehave
has comment: http://stackoverflow.com/comment/39486676
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39485761
has comment: http://stackoverflow.com/comment/39494002
has comment: http://stackoverflow.com/comment/39487743

http://stackoverflow.com/comment/39334158
has text: i read the same article it states that even if it thread reference is made null is still complete its processing and is also not applicable for garbage collection . Running Thread has always reference to the ThreadGroup [link](http://stackoverflow.com/questions/6676035/what-will-happen-when-a-java-thread-is-set-to-null)
type: Comment
comment on: http://stackoverflow.com/q/25247340
score: 0
type: QuestionComment

http://stackoverflow.com/a/25331811
has body: Get the id from database as: String id = c.getString(1);//c is object of cursor then convert to integer by using Integer.parseInt() int integerId = Integer.parseInt(id);
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25331750
downvote count: 0
has comment: http://stackoverflow.com/comment/39524663
upvote count: 1

http://stackoverflow.com/comment/39532653
type: Comment
comment on: http://stackoverflow.com/q/25355187
type: QuestionComment
score: 0
has text: Try it and see what happens ;)

http://stackoverflow.com/q/25251945
score: 0
tagged with: groovy
has title: Is it possible to have 2 classes with the same name and in the same package?
tagged with: java
type: Question
has body: I'm developing a grails app, and I need to modify a groovy class that is in a plugin, so I decided to override the class, so I have these method and class in my plugin: def example = new a(); a.method(); class a { void method() { println "2"; } } all this was Inside the plugin, so I want to create another class in the same package in my project, to change the method, but how can I set my new class to run instead the plugin's? or is it impossible? class a { void method() { println "4"; } }
possible better answer: http://stackoverflow.com/a/25252053
answer count: 2
has answer: http://stackoverflow.com/a/25252053
tagged with: overriding
accepted answer: http://stackoverflow.com/a/25252092
has answer: http://stackoverflow.com/a/25252092
tagged with: grails
type: AnsweredQuestion

http://stackoverflow.com/comment/39468733
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25317037
has text: Thanks @EJP, is there any other info that you'd argue is wrong in my post?

http://stackoverflow.com/comment/39480304
comment on: http://stackoverflow.com/q/25325408
type: QuestionComment
score: 0
has text: doesn't it work when you add the barcode not in the constructor of the `cell`, but via a `cell.addElement()` call?
type: Comment

http://stackoverflow.com/comment/39502327
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25337676

http://stackoverflow.com/comment/39335764
score: 0
comment on: http://stackoverflow.com/a/25247856
type: Comment
has text: Nevermind, my mistake, your code works fine. Tks
type: AnswerComment

http://stackoverflow.com/comment/39438746
type: AnswerComment
has text: Could you explain a bit.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25303569

http://stackoverflow.com/a/25389549
has comment: http://stackoverflow.com/comment/39598204
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39598672
answers question: http://stackoverflow.com/q/25389506
has comment: http://stackoverflow.com/comment/39602898
accepted answer of: http://stackoverflow.com/q/25389506
has comment: http://stackoverflow.com/comment/39598293
type: Answer
has comment: http://stackoverflow.com/comment/39603268
has comment: http://stackoverflow.com/comment/39602959
has comment: http://stackoverflow.com/comment/39603285
upvote count: 2
score: 2
has body: This is not related to String pooling at all. Main answer: Is Java "pass-by-reference" or "pass-by-value"? That's because D creates a new instance of C based on C#c. This mean that the instance of D#c is not the same instance as parameter C passed in constructor D, thus modifying that instance won't affect the current instance in D#c. Re explaining all this in nice terms. Here's what you're testing: class Surprise { String item; public Surprise(String item) { this.item = item; } //this is called copy constructor //because you receive an object from the same class //and copy the values of the fields into the current instance //this way you can have a "copy" of the object sent as parameter //and these two object references are not tied by any mean public Surprise(Surprise another) { //here you just copy the value of the object reference of another#item //into this#item this.item = another.item; } } class Box { Surprise surprise; public Box(Surprise surprise) { //here you create a totally new instance of Surprise //that is not tied to the parameter surprise by any mean this.surprise = new Surprise(surprise); } public static void main(String[] args) { Surprise surprise1 = new Surprise("1"); Surprise surprise2 = new Surprise("2"); Box[] boxes = { new Box(surprise1), new Box(surprise1), new Box(surprise2), new Box(surprise2) }; boxes[0] = boxes[3]; //you update surprise1 state //but the state of Box#surprise in the boxes that used surprise1 //won't get affected because it is not the same object reference surprise1.item = "3"; //print everything... System.out.println("Boxes full of surprises"); //this code does the same as the printing above for (Box box : boxes) { System.out.print(box.surprise.item); } System.out.println(); } }
downvote count: 0

http://stackoverflow.com/comment/39511026
type: Comment
has text: Ok last one error Cannot find symbol and showing return Allowance
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25342407

http://stackoverflow.com/q/25346687
has comment: http://stackoverflow.com/comment/39517970
has body: The following code shows the following error: Exception in thread "main" java.lang.NullPointerException at cdtWorkspace.swap.main(swap.java:25) PS: I have initialized a scanner object globally as static. 15 public static void main(String args[] ) throws Exception { 16 17 int n=scn.nextInt(); 18 int[][] param=new int[n][2]; 19 int[][] arr=new int[n][]; 20 for(int i=0; i&lt;n;i++){ 21 param[i][0]=scn.nextInt(); 22 param[i][1]=scn.nextInt(); 23 int j=0; 24 while (j&lt;param[i][0]){ 25 arr[i][j]=scn.nextInt(); 26 j++; 27 } 28 } 29 } I am getting the same error each time i try to fill in an array using a for loop! Any suggestions?
has comment: http://stackoverflow.com/comment/41304200
type: AnsweredQuestion
has title: JAVA- NullPointerException
score: 0
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39517788
possible better answer: http://stackoverflow.com/a/25346893
upvote count: 3
accepted answer: http://stackoverflow.com/a/25346849
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/39518110
has answer: http://stackoverflow.com/a/25346849
favorite count: 0
has comment: http://stackoverflow.com/comment/39517815
type: Question
has comment: http://stackoverflow.com/comment/39517737
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25346893

http://stackoverflow.com/a/25380371
answers question: http://stackoverflow.com/q/25380077
score: 1
type: Answer
has body: did you give these permission in manifest file? if not give it &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; i think this will solve your problem.
has comment: http://stackoverflow.com/comment/39660998
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25246328
score: 0
has body: I think it is very simple to write a method that does that and use it as a utility in your program... here's an example: import java.util.ArrayList; public class Test { public static void main(String[] args) { String str = "23412+\"11\"+244+\"11\"+abc+\"11\"\"abcd\"pqrs"; int i=0; ArrayList&lt;String&gt; strList = new ArrayList&lt;String&gt;(); while (i&lt;str.length()) { if(str.charAt(i) == '\"') { int temp = i; do { i++; } while (str.charAt(i) != '\"'); strList.add(str.substring(temp+1, i)); } i++; } for(int j=0; j&lt;strList.size(); j++) { System.out.println(strList.get(j)); } } } you can change it to return the ArrayList instead of printing it and then you have the perfect utility to do the job
type: Answer
answers question: http://stackoverflow.com/q/25245892

http://stackoverflow.com/q/25373034
upvote count: 0
answer count: 2
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25373090
has body: If I have an Array List with classes in it and I remove a class from the list, will the class be removed/deleted and the memory it used be freed up? thanks
has answer: http://stackoverflow.com/a/25373062
accepted answer: http://stackoverflow.com/a/25373090
possible better answer: http://stackoverflow.com/a/25373062
tagged with: memory
has title: Java removing class from arraylist
favorite count: 0
type: Question
score: -2
linked to: http://stackoverflow.com/q/148681
tagged with: class
tagged with: arraylist
type: AnsweredQuestion

http://stackoverflow.com/comment/39502997
has text: Same thing was on my mind, But can't we just hide and then show fragment? I have implemented facebook login through facebook guide. They made fragments in their guide. And following that tutorial I made more fragments and they just load data once. Just show that fragment.
score: 0
comment on: http://stackoverflow.com/a/25337970
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39577746
comment on: http://stackoverflow.com/q/25277683
type: QuestionComment
has text: Your question is not precise enough. What do you want to do with the report? View it in a Web application? Or generate a PDF file?
type: Comment
score: 0

http://stackoverflow.com/comment/39366352
type: QuestionComment
comment on: http://stackoverflow.com/q/25264767
score: 0
has text: I am by no means a pro with selenium or indeed java as you may have deduced from the question. What I need to do is validate values on a web application and then manually validate them from within a windows application (oracle). I'm taking my first steps here so have not considered, at this stage, adding further code to check the windows application using the automation tool, as I believe this will be a whole different language to find the values in a windows application.
type: Comment

http://stackoverflow.com/comment/39568150
type: AnswerComment
has text: Would it be easier to use implementations of the [`Shape`](http://docs.oracle.com/javase/8/docs/api/java/awt/Shape.html) interface and then draw them with [`Graphics2D.draw(Shape)`](http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html#draw-java.awt.Shape-) ?
comment on: http://stackoverflow.com/a/25373786
score: 0
type: Comment

http://stackoverflow.com/comment/39529534
score: 0
type: Comment
has text: @madengineer here is my code with candy and currencyrenderer what to add or remove here https://www.dropbox.com/s/hij9127d1v6eoo3/Candy%20With%20Currency%20Renderer.txt
type: AnswerComment
comment on: http://stackoverflow.com/a/25279954

http://stackoverflow.com/a/25374805
answers question: http://stackoverflow.com/q/25373565
has comment: http://stackoverflow.com/comment/67466548
downvote count: 0
type: Answer
upvote count: 29
score: 29
has body: I am sure IntelliJ Idea does not use 1099 port internally. I have used this PORT for Tomcat. I would suggest checking if any of idea plugins that you have installed are running on this port. Most of the operating systems can give you the application name that is running on that port. Eg: lsof -w -n -i tcp:8080 would give me the application running on 8080 on my linux machine. Hope this helps.
accepted answer of: http://stackoverflow.com/q/25373565
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39597661

http://stackoverflow.com/a/51073730
answers question: http://stackoverflow.com/q/25381435
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/126368483
score: 7
has body: Unconditional layout inflation from view adapter: Should use View Holder pattern (use recycled view passed into this method as the second parameter) for smoother scrolling. It means that you need to use View Holder pattern in your Adapter. The point of using View Holder is to reusing the views because inflating and using findViewById are slow. When you're using the following code: public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder mViewHolder; mViewHolder = new ViewHolder(); LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.activity_friend_list_row, parent, false); mViewHolder.cb = (CheckBox) convertView.findViewById(R.id.checkBox); convertView.setTag(mViewHolder); ... return convertView; } you're not reusing the views but instead you always create new views. You need to change your code to something like this (please check the comment): // class for holding the cached view static class ViewHolder { TextView tvFriendsName; ImageView imvThumbImage; CheckBox cbInviteFriend; } public View getView(final int position, View convertView, ViewGroup parent) { // holder of the views to be reused. ViewHolder viewHolder; // get data based on the position HashMap&lt;String, String&gt; song = data.get(position); // if no previous views found if (convertView == null) { // create the container ViewHolder viewHolder = new ViewHolder(); // inflate the views from layout for the new row LayoutInflater inflater = LayoutInflater.from(parent.getContext()); convertView = inflater.inflate(R.layout.rowlayout, parent, false); // set the view to the ViewHolder. viewHolder.cbInviteFriend = convertView.findViewById(R.id.checkBox); viewHolder.tvFriendsName = convertView.findViewById(R.id.friendsName); viewHolder.imvThumbImage = convertView.findViewById(R.id.list_image); // save the viewHolder to be reused later. convertView.setTag(viewHolder); } else { // there is already ViewHol…
type: Answer
has comment: http://stackoverflow.com/comment/95293153

http://stackoverflow.com/q/25267980
has answer: http://stackoverflow.com/a/25268159
possible better answer: http://stackoverflow.com/a/25268159
type: AnsweredQuestion
tagged with: smsmanager
score: 0
answer count: 2
tagged with: sms
tagged with: java
type: Question
has body: Just wondering if I could get some advice about how next to handle my App, currently I have class called: MySMSReceiver.java, it can check if an incoming SMS has a particular keyword that had been placed in the incoming SMS. It works fine with just checking the one word "Locate" on it's own but, I can seem to figure out how to check say 3 different Keywords on an incoming message. Below is the code that I'm currently using for the MySMReceiver.java package com.example.myautosms; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.SmsMessage; import android.widget.Toast; public class MySMSReceiver extends BroadcastReceiver { private String[] keyword = {"Locate", "Lock", "Unlock"}; public void onReceive(Context context, Intent intent) { Object[] pdus = (Object[])intent.getExtras().get("pdus"); SmsMessage shortMessage = SmsMessage.createFromPdu((byte[])pdus[0]); if(shortMessage.getDisplayMessageBody().equals(keyword)) { Toast.makeText(context, keyword.toString(), Toast.LENGTH_LONG).show(); } else { Toast.makeText(context, keyword.to, Toast.LENGTH_LONG).show(); } } } Any suggestions would be welcomed! :)
has answer: http://stackoverflow.com/a/25268013
tagged with: android
accepted answer: http://stackoverflow.com/a/25268013
has title: Checking SMS for Multiple Keywords in Android

http://stackoverflow.com/q/25292004
tagged with: serialization
tagged with: http://stackoverflow.com/tag/json
has body: I am trying to use Gson to extract a field from a Json: { "attributes": { "538": { "id": "538", "code": "sabor", "label": "Sabor", "options": [ { "id": "24", "label": "Baunilha", "price": "0", "oldPrice": "0", "products": [ "1376" ] }, { "id": "25", "label": "Chocolate", "price": "0", "oldPrice": "0", "products": [ "1377" ] } ] } } } What i need is the label field inside the options( in this case, Baunilha and Chocolate). I tried with the following classes: public class Customer implements Serializable{ @SerializedName("options") private Produto options; public Produto getOptions() { return options; } public void setEmail(Produto options) { this.options = options; } and public class Produto implements Serializable{ @SerializedName("label") private String label; public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } } Customer cust = g.fromJson(ja, Customer.class); But i keep getting null pointer errors.
has answer: http://stackoverflow.com/a/25292051
accepted answer: http://stackoverflow.com/a/25292051
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: gson
answer count: 1
has title: How to extract the field using Gson
type: Question

http://stackoverflow.com/q/25306743
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39483615
tagged with: java
has comment: http://stackoverflow.com/comment/39479287
tagged with: authentication
has comment: http://stackoverflow.com/comment/39488047
tagged with: spring-security
tagged with: denial-of-service
type: Question
has title: Spring authentication, avoid unnecessary BCrypt operation
has body: Today I was looking for a way to make our servers more robust against a very special way of DOS attack. We use BCrypt with a strength of 12 to store user passwords. Validation of a password on our environments may take up to 500ms. It's acceptable for a user on login. I think somebody may flood our servers with login request with invalid passwords to take it under heavy load. First I thought this problem can only occur with an existing user but then during debugging I found this code in the DaoAuthenticationProvider: } catch (UsernameNotFoundException notFound) { if(authentication.getCredentials() != null) { String presentedPassword = authentication.getCredentials().toString(); passwordEncoder.isPasswordValid(userNotFoundEncodedPassword, presentedPassword, null); } throw notFound; In case of a UsernameNotFoundException it checks the provided password against a userNotFoundEncodedPassword! Also here the system needs the same calculation time, cause the userNotFoundEncodedPassword also has a strength of 12. Where is it set? How can I avoid that calculation? Do I have to write my own AuthenticationProvider?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39546340

http://stackoverflow.com/q/25244689
tagged with: java
linked to: http://stackoverflow.com/q/11324372
has body: How to inject static variables from spring bean? public class MyClass{ static String str; // how to set value to this variable through Spring } Spring bean <property name="str" value="xmlpath" /> .
has answer: http://stackoverflow.com/a/36898961
possible better answer: http://stackoverflow.com/a/36898961
favorite count: 0
type: Question
answer count: 2
has title: How to inject static variables from spring bean?
has comment: http://stackoverflow.com/comment/39330430
has comment: http://stackoverflow.com/comment/39334103
downvote count: 2
has comment: http://stackoverflow.com/comment/39329261
tagged with: spring
score: -1
has answer: http://stackoverflow.com/a/25244802
accepted answer: http://stackoverflow.com/a/25244802
tagged with: static-members
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/comment/97282331
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25363884
has text: Adding `Mockito.verify(aSpy, times(3)).mainMethod(100500);` will give compilation error as `mainMethod()` is `protected` !
score: 0

http://stackoverflow.com/comment/41344555
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25291582
type: Comment
has text: have you solved this issue? if yes, how did you solve it?

http://stackoverflow.com/q/25277567
has comment: http://stackoverflow.com/comment/39417601
tagged with: playframework-2.0
score: 0
has comment: http://stackoverflow.com/comment/39391054
tagged with: amazon-s3
tagged with: java
tagged with: image
has body: I'm storing images on S3 for use in emails. When I view the image in an email, some of the images are rotated. I'm uploading using the AmazonS3Client, and uploading images using MultipartFormData in a Play2 app like this: Http.MultipartFormData body = request().body().asMultipartFormData(); String[] pics = new String[]{"picture1", "picture2", "picture3"}; String[] fileNames = new String[3]; for(int i = 0; i &lt; pics.length; i++) { Http.MultipartFormData.FilePart picture = body.getFile(pics[i]); if (picture != null) { String fileName = picture.getFilename(); play.Logger.info("fileName: " + fileName); File file = picture.getFile(); String existingBucketName = "yadayadayada"; String keyName = UUID.randomUUID().toString(); PutObjectRequest putObjectRequest = new PutObjectRequest(existingBucketName, keyName + "-" + fileName, file); putObjectRequest.withCannedAcl(CannedAccessControlList.PublicRead); // public for all s3Client.putObject(putObjectRequest); fileNames[i] = "https://s3.amazonaws.com/yadayadayada/" + keyName + "-" + fileName; } }
type: Question
has title: How do I reorient images when storing on S3?
answer count: 0
type: UnansweredQuestion
tagged with: multipartform-data

http://stackoverflow.com/a/25249563
score: 2
answers question: http://stackoverflow.com/q/25248717
type: Answer
upvote count: 2
has body: Expediter 6.2.3 is dated Oct 11, 2011 so is probably built to work with a much older Eclipse base than Kepler SR2. Given the error version range is [3.4.0,3.5.0) I would guess it's mean to work with Eclipse 3.4.2 (aka Ganymede) or possibly 3.5.2 (aka Helios). If you're working with a newer Notes version then I expect Expediter is not the way any longer, but I don't know what to suggest. I'll post again if I can find out.
downvote count: 0

http://stackoverflow.com/comment/39437281
comment on: http://stackoverflow.com/q/25294647
type: Comment
type: QuestionComment
has text: Usually in such situations, it's not rules execution that slows down. Rather, it's the amount of time it takes to insert new facts that takes longer. Something to consider is whether all of those facts are new. Can you insert a base set of facts and keep them in working memory? Inserting/modifying small numbers of additional facts is usually very fast.
score: 0

http://stackoverflow.com/comment/45521453
comment on: http://stackoverflow.com/q/25365952
has text: @Kayaman the latest version has a different problem: it refuses to connect to old server versions. I did not try it earlier because I suspected something like this would happen :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39474667
score: 0
type: Comment
type: QuestionComment
has text: There is no closing vxml tag. Does adding that help?
comment on: http://stackoverflow.com/q/25309063

http://stackoverflow.com/a/25307499
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25306543
type: Answer
has body: Possibly this question may give you a clue. The accepted answer suggests to change the Hue value of HSV color scheme with some interval, while making other two parameters random. This is how it would look like in Android: for (int i = 0; i &lt; 360; i += 360 / colorsNumber) { // hsv[0] is Hue [0 .. 360) hsv[1] is Saturation [0...1] hsv[2] is Value [0...1] float[] hsv = new float[3]; hsv[0] = i; hsv[1] = (float) Math.random(); // Some restrictions here? hsv[2] = (float) Math.random(); colors[i] = Color.HSVToColor(hsv); }
score: 2

http://stackoverflow.com/q/25322645
has title: GPS Location on Button Press
has answer: http://stackoverflow.com/a/25511308
type: Question
type: UnansweredQuestion
tagged with: android
has body: I am currently writing an app which will access the current location on the press of a button, and print it out. What I have right now is a method which gets the last known location. I have seen in many places that one is to implement a class that gets the location. My current code returns it as a string, but it only gets the location that was last updated by the phone. How can I change this so that when I press the button and call a method that uses this String, it will get the currentLocation rather than the lastLocation? Thank you so much! Also, This is my first ever android app, and I only have intermediate knowledge of Java and class implementation. public String getLocation(){ String userLocation; try { LocationManager locMgr = (LocationManager) this.getSystemService(LOCATION_SERVICE); Location recentLoc = locMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER); String userLocator = recentLoc.toString(); userLocation = compressString(userLocator); //userLocation = recentLoc.toString(); } catch(Exception e) { userLocation = "Location failed"; } return userLocation; }
tagged with: android-activity
has answer: http://stackoverflow.com/a/25322916
tagged with: gps
score: 0
answer count: 3
tagged with: location
has answer: http://stackoverflow.com/a/25332479
tagged with: java

http://stackoverflow.com/q/25338113
has body: I recently came across a tool for android hotswapping. It has a tutorial to begin using with eclipse(Luna) http://www.instareloader.com/enabling-instareloader-in-the-eclipse-ide/ . What that tutorial says is: Right Click on the main project, and click on New Test project Add their library jar into the junit test. This is my main project's xml: <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> And this is my TestProject's xml: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.layoutreloadmyown" /> <uses-library android:name="android.test.runner" /> <meta-data android:name="instareloader.ip" android:value="192.168.56.1" /> <meta-data android:name="instareloader.port" android:value="18080" /> <meta-data android:name="instareloader.file.logger" android:value="true" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> I did everything that it said, and exactly that, But I get a classnotfoundException: 08-16 12:29:51.995: E/AndroidRuntime(1745): FATAL EXCEPTION: main 08-16 12:29:51.995: E/AndroidRuntime(1745): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.layoutreloadmyown.test/com.example.layoutreloadmyown.MainActivity}: java.lang.ClassNotFoundException: com.example.layoutreloadmyown.MainActivity 08-16 12:29:51.995: E/AndroidRuntime(1745): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983) 08-16 12:29:51.995: E/AndroidRuntime(1745): at android.app.ActivityThread.handleLau…
type: Question
has answer: http://stackoverflow.com/a/25338223
type: UnansweredQuestion
answer count: 1
has title: JUnit testing throws ClassNotFoundException
score: 0
tagged with: android
tagged with: java
tagged with: junit
tagged with: eclipse

http://stackoverflow.com/q/25381052
score: -4
has title: How to define a grouping separator for parsing BigDecimal numbers in Camel Bindy?
has answer: http://stackoverflow.com/a/25520671
accepted answer: http://stackoverflow.com/a/25520671
favorite count: 0
type: AnsweredQuestion
downvote count: 5
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/39638777
tagged with: java
tagged with: bigdecimal
tagged with: apache-camel
type: Question
possible better answer: http://stackoverflow.com/a/25411096
answer count: 2
tagged with: bindy
upvote count: 1
has body: I have a CSV file that contains numbers in this format: 1,234.56 with , being the grouping separator and . being the decimal separator. I'd like to parse that number as a BigDecimal using Camel Bindy. This is the part of the model class for this number: @DataField(pos = 6, required = true, precision = 2, pattern = "#,###.##") public BigDecimal value; The problem right now is, that this will cause a java.lang.NumberFormatException even though the correct pattern has been applied. If I remove that pattern from the annotation and the grouping separator from the number in the data file, then everything works fine. Or if I use Double type instead of BigDecimal. The Camel Bindy Documentation mentions that the grouping separater for BigDecimal can be set, but the table beneath that information says that the pattern is only supported for Decimals not the BigDecimal type. Also the source code of the used FormatFactory class shows that the pattern won't be used for BigDecimal types. So my question is: how can I set and use a grouping separator for a BigDecimal type, like the documentation mentioned? Or is this currently not supported and I have to use Double instead? P.S: the locale is currently set to en_US.
has answer: http://stackoverflow.com/a/25411096

http://stackoverflow.com/a/25488859
type: Answer
accepted answer of: http://stackoverflow.com/q/25377124
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25377124
has body: If you use the Maven Resources plugin and set filtering=true, then you can replace Maven variables like 'project.version'. See https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

http://stackoverflow.com/q/25353584
answer count: 1
tagged with: tomcat
has title: Use cases for ServletContextAttributeListener
score: 0
has answer: http://stackoverflow.com/a/25354342
has body: I understand that we can use javax.servlet.ServletContextAttributeListener if we want to know that an attribute in a web app context has been added, removed or replaced. But what are some practical use cases for this listener? (I googled around for a while, but could not find any practical examples for this listener.)
tagged with: java
type: Question
tagged with: listener
type: UnansweredQuestion

http://stackoverflow.com/q/25376688
has body: In my android app, I have a custom listview of installed apps with a checkbox next to it. I am using SharedPreferences to store the boolean true for checked and false for unchecked. The key value is the packagename of the app and the value is a boolean, true or false. I am trying to store all the keys (packagenames) with the value-- true, all together and so then I can use the packagenames in another class for a specific task. However, I want the data structure that stores all the keys to stay the same and hold all the checked packagename keys even when the app is killed. Currently, I am using code like this: String findKey(SharedPreferences sharedPreferences, String value) { for (Map.Entry&lt;String, ?&gt; entry: sharedPreferences.getAll()) { if (value.equals(entry.getValue())) { return entry.getKey(); } } return null; // not found } I have tried researching but still unable to produce a solution. Get all SharedPreferences names and all their keys? Gather all Strings from SharedPreference getAll() Method? How would I implement this correctly to get all my packagenames in a data structure that I can use in another class and have it stored with the same stuff even when the app is killed? This is my code in my adapter class: for(int i= 0; i&lt;packageList.size(); i++){ PACKAGE_NAME = packageInfo.packageName; sharedPrefs = context.getSharedPreferences(PACKAGE_NAME, Context.MODE_PRIVATE); holder.ck1.setChecked(sharedPrefs.getBoolean(PACKAGE_NAME,false)); } holder.ck1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor editor = context.getSharedPreferences(packageInfo.packageName, Context.MODE_PRIVATE).edit(); if (holder.ck1.isChecked()) { itemChecked[position] = true; holder.ck1.setChecked(true); editor.putBoolean(packageInfo.packageName, true); editor.apply(); } else { itemChecked[position] = false; holder.ck1.setChecked(false); editor.putBoolean(packageInfo.packageName, false); editor.apply(); } } });
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25388516
has title: How to store all keys from a specific value from SharedPreferences
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39574502
tagged with: sharedpreferences
has answer: http://stackoverflow.com/a/25377385
type: Question
tagged with: key-value
has comment: http://stackoverflow.com/comment/39574399
linked to: http://stackoverflow.com/q/24718964
tagged with: android
has answer: http://stackoverflow.com/a/25377060
linked to: http://stackoverflow.com/q/6672949

http://stackoverflow.com/comment/39477013
has text: Try using the string value `"consumer_ir"`, which is what `Context.CONSUMER_IR_SERVICE` maps to.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25276144
score: 1

http://stackoverflow.com/comment/39399430
has text: It is nested in the pluginManagement tag, but that should be ok, right? But you are right, it is looking for the plug-in in the wrong group it seems.
type: Comment
comment on: http://stackoverflow.com/a/25282354
score: 0
type: AnswerComment

jboss-messaging
tags question: http://stackoverflow.com/q/25262184
type: Tag
tag name: jboss-messaging

http://stackoverflow.com/comment/39576169
type: QuestionComment
comment on: http://stackoverflow.com/q/25346968
has text: I tried but no luck with it. Anyways thanks Laune, I really appreciate your help.
score: 0
type: Comment

http://stackoverflow.com/comment/39553621
type: QuestionComment
comment on: http://stackoverflow.com/q/25365532
has text: Jaybird is distributed with a version specific for a Java version, are you using the version that is for your Java version. Also look in the logs if it has a more specific error.
score: 1
type: Comment

http://stackoverflow.com/comment/39569092
type: AnswerComment
comment on: http://stackoverflow.com/a/25374293
has text: +1 for using an IDE, there is enough to learn without worrying (at first) where the files are.
type: Comment
score: 2

http://stackoverflow.com/comment/39485660
score: 0
type: Comment
type: QuestionComment
has text: Thanks, I would have a try!
comment on: http://stackoverflow.com/q/25328779

http://stackoverflow.com/comment/39483843
type: Comment
comment on: http://stackoverflow.com/a/25327836
type: AnswerComment
score: 0
has text: @stealthjong Just a typo. Fixed it. Thanks for the hint!

http://stackoverflow.com/comment/39584551
has text: It's possible if both of the labels are class attributes, but I wouldn't recommend this...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25381782

http://stackoverflow.com/comment/39453992
comment on: http://stackoverflow.com/a/25309143
type: AnswerComment
score: 0
type: Comment
has text: Leigh, I am using JavaLoader and POI 3.10 Final. Unable to access simply means the object does not have a setParagraph() method.

http://stackoverflow.com/comment/39462909
has text: Even sorting the full array with `Arrays.sort` will be faster than your approach unless the array is very short.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25316687
score: 0

http://stackoverflow.com/a/25350515
has body: Just use small y instead of Y: final String TWITTER="EEE, dd MMM yyyy HH:mm:ss ZZZZZ";
score: 4
has comment: http://stackoverflow.com/comment/39527218
downvote count: 0
has comment: http://stackoverflow.com/comment/39527179
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25350164
answers question: http://stackoverflow.com/q/25350164
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39527304
has comment: http://stackoverflow.com/comment/39527968

http://stackoverflow.com/comment/39449221
comment on: http://stackoverflow.com/a/25309179
score: 0
has text: It would be good if you updated your question showing an example of where the present solution wouldn't work. Thanks
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25374178
has answer: http://stackoverflow.com/a/25389958
has comment: http://stackoverflow.com/comment/39576091
favorite count: 0
type: Question
tagged with: command-line
type: UnansweredQuestion
has body: i have my main class as below. public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); SimpleCommandLinePropertySource cmdLineSrc = new SimpleCommandLinePropertySource(args); ctx.getEnvironment().getPropertySources().addFirst(cmdLineSrc); ctx.register(MyConfig.class); ctx.refresh(); ctx.start(); MyClass myclass = ctx.getBean(MyClass.class); // do something... } now in my MyApp.config, i have following.. @Autowired Environment env; however, when i try to get values out, i get NPE. env.getProperty("something"); what am i missing here? I do have @PropertySource as below (which works fine), but could that cause any issues here? @Configuration @PropertySource({ "classpath:my.properties" }) public class MyConfig { @Autowired private Environment env;
tagged with: configuration
tagged with: spring
has title: how to read values from command line and use them in bootstrapped annotation config class to define spring bean?
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/a/25233008
score: 3
type: Answer
has body: I think it makes more sense that only a single place would set the value of the field, and it should be the last method being called. It makes the code easier to understand. Your first snippet looks much more readable to me. Here's another snippet which, in my opinion, supports this convention : Lets say we have an int member with two setters - one accepts an int and the other accepts a String representation of that int (which is used, for example, if we de-serialize an instance from an XML String). int value; public void setIntField (String value) throws SomeException { if (value == null) throw new SomeException(); try { int val = Integer.parseInt (value); setIntField (val); } catch (NumberFormatException ex) { throw new SomeException(); } } public void setIntField (int value) throws SomeException () { if (value &lt; MIN_ALLOWED || value &gt; MAX_ALLOWED) throw new SomeException (); this.value = value; }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25232990
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25232990

http://stackoverflow.com/q/25283140
has answer: http://stackoverflow.com/a/25283565
has body: To validate exception message I can use ExpectedMessage object but what if I want to validate concreate exception and it's details? For example I have exception class TerribleWindException which has some additional methods like getWindSpeed() and in junit test method I want to check the getWindSpeed() result. Look at this example: // pseudo implementation public class TerribleWindException extends Exception { private Integer windSpeed = 0; public TerribleWindException(final Integer windSpeed) { this.windSpeed = windSpeed; } } public class WalkService { private Integer windSpeed = 0; public WalkService(final Integer windSpeed) { this.windSpeed = windSpeed; } public void goForAWalk() throws TerribleWindException { if (windSpeed&gt;10) { throw new TerribleWindException(windSpeed); } } } // test public class WalkServiceTest { @Test public void testGoForAWalkWhenSpeedIsToPowerfulShouldThrowTerribleWindException throws TerribleWindException { WalkService ws = new WalkService(100); goForAWalk(); // this will throw TerribleWindException. The only way to check it's exception details is to use try {} catch() {} ? } } The only way to check exception details is to use try {} catch() {} ?
has answer: http://stackoverflow.com/a/25283201
favorite count: 0
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/25283236
answer count: 8
has answer: http://stackoverflow.com/a/25283618
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25283180
has answer: http://stackoverflow.com/a/25332084
has answer: http://stackoverflow.com/a/25283178
score: 2
has answer: http://stackoverflow.com/a/25317243
upvote count: 2
has title: Validate concrete exception details in JUnit
tagged with: java
tagged with: junit
downvote count: 0

http://stackoverflow.com/comment/39581917
comment on: http://stackoverflow.com/q/25374362
score: 0
has text: Haskell has no direct equivalent to NullPointerException. The closest would be a pattern match failure or a `Exception: Prelude.(!!): index too large`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25380314
has answer: http://stackoverflow.com/a/25380526
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39589127
upvote count: 0
has comment: http://stackoverflow.com/comment/39579878
type: UnansweredQuestion
score: -2
downvote count: 2
tagged with: countdowntimer
has answer: http://stackoverflow.com/a/25405422
has body: I have created a Counter from the class CountdownTimer.java and I'd like to adjust this Timer so that it stores a co-ordinate, say every 2 seconds. This should be general at a later point. For now I'm happy if the result is storing a coordinate each second. The problem I am having is that the Timer is too fast. After pressing Start at the Timer he prints the coordinates within 1 second! I have printed out the result in a file with a data stamp, which is why I know that it is too fast. So here is my code: package com.bosch.uadclient; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.osmdroid.util.GeoPoint; import android.annotation.SuppressLint; import android.app.AlarmManager; import android.app.Fragment; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Environment; import android.os.SystemClock; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.example.uadclient.R; public class PartyFragment extends Fragment { private MyCountdownTimer countDownTimer; private long pointsCollected; private boolean timerHasStarted = false; private TextView text; private TextView EdittextTime; private TextView EdittextIntervall; private TextView timeElapsedView; private ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); private long mPauseTime; private long startTime; private long interval; private int point = 0; private Button buttonTimer; // LocationProviderService locService; String s1 = ""; String s2 = ""; Stri…
has title: CountdownTimer in Java: Every x seconds do something
answer count: 2
tagged with: android-fragments
tagged with: android
tagged with: java

http://stackoverflow.com/a/45019672
has body: Yea, this has to be a bug. Overriding doAfterPropertiesSet() with some dummy logic in my custom auth provider prevents the error. Setting a breakpoing in that override method, it's apparent that while UserDetailsService is initially null, it does get set immediately after. @Component public class CustomAuthenticationDaoProvider extends DaoAuthenticationProvider ... @Override protected void doAfterPropertiesSet() throws Exception { if(super.getUserDetailsService() != null){ System.out.println("UserDetailsService has been configured properly"); } }
type: Answer
has comment: http://stackoverflow.com/comment/87943918
answers question: http://stackoverflow.com/q/25230445
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39354955
type: QuestionComment
has text: Can't see your error. There is a prepacked release that can be started with java -jar a-..jar This is perhaps not the correct forum to handle that trouble shooting though.
comment on: http://stackoverflow.com/q/25246578
score: 0
type: Comment

http://stackoverflow.com/comment/39409316
type: QuestionComment
comment on: http://stackoverflow.com/q/25288128
has text: possible duplicate of [how to build fat jar with maven](http://stackoverflow.com/questions/16222748/how-to-build-fat-jar-with-maven)
score: 2
type: Comment

http://stackoverflow.com/a/25363644
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43367613
type: AcceptedAnswer
score: 16
upvote count: 16
accepted answer of: http://stackoverflow.com/q/25362127
has body: Solution was to change eclipse vm to jdk. Eclipse used jre - also I configured jdk. If somebody else has the same problem, add following in eclipse.ini: -vm C:\Program Files\Java\jdk1.7.0_60\bin\javaw.exe Important: The entry has to be placed in first two lines - as posted - in eclipse.ini !!! (Eclipse Luna and possibly others)
answers question: http://stackoverflow.com/q/25362127

http://stackoverflow.com/q/25319880
type: Question
tagged with: uuid
upvote count: 2
type: UnansweredQuestion
tagged with: jpa
downvote count: 0
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/25324070
has body: I have a field in MySQL as varbinary(36), which stores UUID. Then i click on the field in MySQL workbench, I can see the text value of field as "4479633f-a7e5-4ea9-945c-589263022634". I use JPA in my code, when I do a SELECT U FROM USER in JPA, it turns the value as "66653565373765302D663832312D313165332D613361632D303830303230306339613636", which is the hexadecimal equivalent of the value. What should I do to let JPA return the Text value of the field. Here is my definition of the filed in my code: @Id @Column(name = "COUNTRY_ID") private String countryId;
has title: JPA not returning the UUID "Text" value of a MySQL varbinary field
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: mysql

http://stackoverflow.com/comment/39548767
has text: By your logic no class should have a getter for fear that another class might use it. Abusing design patterns is as bad as not knowing them.
comment on: http://stackoverflow.com/a/25363055
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39433345
score: 0
type: Comment
has text: http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist
type: QuestionComment
comment on: http://stackoverflow.com/q/25300915

http://stackoverflow.com/comment/39517199
score: 0
type: Comment
type: QuestionComment
has text: You're stating two separate rules here: one, that the constant should come first; second, that 'the comparison should be ... `equalsIgnoreCase().` I doubt that the second is what you intended. Please clarify.
comment on: http://stackoverflow.com/q/25345238

http://stackoverflow.com/q/25346512
has title: Read Multiple Objects JSON with Java
has comment: http://stackoverflow.com/comment/39517436
type: Question
has answer: http://stackoverflow.com/a/49516671
has comment: http://stackoverflow.com/comment/39568970
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39035166
has comment: http://stackoverflow.com/comment/71603790
has answer: http://stackoverflow.com/a/36920281
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/39517528
has answer: http://stackoverflow.com/a/44626709
tagged with: java
has answer: http://stackoverflow.com/a/25346562
has answer: http://stackoverflow.com/a/36109027
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39518311
downvote count: 0
tagged with: gson
has comment: http://stackoverflow.com/comment/39517444
has answer: http://stackoverflow.com/a/25352198
has answer: http://stackoverflow.com/a/42223823
has answer: http://stackoverflow.com/a/25374377
has answer: http://stackoverflow.com/a/36932225
answer count: 10
favorite count: 0
has body: I need to read a JSON file in Java with the following structure: {"id_user":"10","level":"medium","text":"hello 10"} {"id_user":"20","level":"medium","text":"hello 20"} {"id_user":"30","level":"medium","text":"hello 30"} Thanks!. [POST-EDITED] I have this code but only read the first JSON Object, I need read the three objects one by one. private void loadJSONFile(){ FileReader fileReader = new FileReader(pathFile); try (JsonReader jsonReader = new JsonReader(fileReader)) { jsonReader.beginObject(); while (jsonReader.hasNext()) { String name = jsonReader.nextName(); if (name.equals("filter_level")) { System.out.println(jsonReader.nextString()); } else if (name.equals("text")) { System.out.println("text: " + jsonReader.nextString()); } else { jsonReader.skipValue(); } } jsonReader.endObject(); jsonReader.close(); } } thanks!
has comment: http://stackoverflow.com/comment/39517395

http://stackoverflow.com/comment/39569640
score: 1
type: Comment
type: QuestionComment
has text: @DanK He didn't specify that the must-pass nodes have an order. How do you suppose he could find an optimal order efficiently?
comment on: http://stackoverflow.com/q/25368709

http://stackoverflow.com/q/25260342
accepted answer: http://stackoverflow.com/a/40957478
downvote count: 0
has answer: http://stackoverflow.com/a/40957478
possible better answer: http://stackoverflow.com/a/48112448
favorite count: 0
tagged with: unit-testing
tagged with: testng
has answer: http://stackoverflow.com/a/48112448
has body: I'm using TestNG and JMockit for testing. My code goes like this: public boolean testMethod(String a, String b) { //processing ..... mockClass.mockMethod(a); //processing.... } The mockMethod(): Class MockClass { public void mockMethod(String a) { //some operations to mock } } I'm using MockUp according to this question: (How to mock public void method using jmockit?) I'm still getting the NPE. What am I doing wrong? Also, is it because I'm using it like this? @Test public void test() { new Expectations() { { //for statements preceding mockMethod().... new MockUp&lt;MockClass&gt;(){ @Mock public void mockMethod(String a) { //do nothing } }; } }; } I've put it outside Expectations() &amp; used NonStrictExpectations too. How do I fix this?
type: Question
upvote count: 2
answer count: 2
tagged with: jmockit
has title: How do I mock a method with void return type in JMockit?
linked to: http://stackoverflow.com/q/24112799
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39362835
score: 2
has comment: http://stackoverflow.com/comment/39358056
tagged with: java

http://stackoverflow.com/q/25243883
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25265721
has body: I'm learning Android programming and I've been trying to figure this out for a couple days now. I'm writing and Android app that is supposed to connect to XMPP server. I'm getting same error all the time and don't really know what I'm doing wrong. I've tried example codes found with google but can't manage to create a connection with them either. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Context context = getApplicationContext(); SmackAndroid.init(context); ConnectionConfiguration ConnectionConfiguration = new ConnectionConfiguration("192.168.0.101", 5222); ConnectionConfiguration.setDebuggerEnabled(true); XMPPConnection connection = new XMPPTCPConnection(ConnectionConfiguration); try { connection.connect(); } catch (ConnectionException e) { Log.e("ERROR", "ConnectionException", e); for (int i = 0; i &lt; e.getFailedAddresses().size(); i++) { HostAddress element = e.getFailedAddresses().get(i); Log.e("ERROR", element.getErrorMessage().toString()); } } catch (Exception e) { Log.e("ERROR", "Exception", e); } // Log into the server try { connection.login("user", "password", "SomeResource"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } This is error I'm getting: 08-11 15:48:27.476: E/ERROR(11117): ConnectionException 08-11 15:48:27.476: E/ERROR(11117): org.jivesoftware.smack.SmackException$ConnectionException 08-11 15:48:27.476: E/ERROR(11117): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:433) 08-11 15:48:27.476: E/ERROR(11117): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:808) 08-11 15:48:27.476: E/ERROR(11117): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:396) 08-11 15:48:27.476: E/ERROR(11117): at com.example.gps_pubsub.MainActivity.onCreate(MainActivity.java:34) 08-11 15:48:27.476: E/ERROR(11117): at android.app.Acti…
has comment: http://stackoverflow.com/comment/39336166
favorite count: 0
type: Question
tagged with: asmack
has comment: http://stackoverflow.com/comment/39337026
has answer: http://stackoverflow.com/a/26328948
linked to: http://stackoverflow.com/q/24482595
possible better answer: http://stackoverflow.com/a/26328948
tagged with: android
tagged with: xmpp
accepted answer: http://stackoverflow.com/a/25265721
linked to: http://stackoverflow.com/q/26497773
has comment: http://stackoverflow.com/comment/39328818
score: 2
upvote count: 2
type: AnsweredQuestion
answer count: 2
has title: Can't establish a new connection with aSmack 4.0.2
has comment: http://stackoverflow.com/comment/41685460

http://stackoverflow.com/a/25290355
has comment: http://stackoverflow.com/comment/39441563
has comment: http://stackoverflow.com/comment/39436308
has comment: http://stackoverflow.com/comment/39435926
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25286999
has comment: http://stackoverflow.com/comment/39440804
has comment: http://stackoverflow.com/comment/39441515
has body: Try add CascadeType.REMOVE and orphanRemoval @OneToMany(mappedBy = "one", orphanRemoval = true, fetch = FetchType.EAGER, cascade = CascadeType.REMOVE, orphanRemoval = true) Than perform delete following one.getManies().remove(manyToRemove); oneDao.save(one); Edited: I have created POC, look on the UserRepositoryIntegrationTest.departmentTestCase (code)
has comment: http://stackoverflow.com/comment/39443412

http://stackoverflow.com/comment/39719379
type: Comment
comment on: http://stackoverflow.com/q/25361621
score: 0
has text: Your topology is running 24/7 and so are your spouts/bolts. There is no "stopping" your bolt because it will be constantly processing tuples that are emitted from the previous bolt.
type: QuestionComment

http://stackoverflow.com/comment/39455625
comment on: http://stackoverflow.com/q/25312993
score: 0
type: Comment
type: QuestionComment
has text: write a maven plugin - it would be faster than this

http://stackoverflow.com/q/25290935
tagged with: proxy
has comment: http://stackoverflow.com/comment/39420002
has comment: http://stackoverflow.com/comment/39415856
tagged with: java
has comment: http://stackoverflow.com/comment/39419019
has comment: http://stackoverflow.com/comment/39421377
has comment: http://stackoverflow.com/comment/39417073
has title: Spring proxy to choose implementation based on annotation and runtime value
has answer: http://stackoverflow.com/a/25295200
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25295552
has comment: http://stackoverflow.com/comment/39417870
has comment: http://stackoverflow.com/comment/39417444
accepted answer: http://stackoverflow.com/a/25295200
downvote count: 0
score: 1
upvote count: 1
tagged with: spring
has body: I would like to inject a proxy implementation of an interface to a component and then let spring choose the right implementation based on a runtime property (and the value of an annotation at the implementation class). So my component does not have to care about choosing the right one. It is kind of like a scope. But i think scopes are only for handling different instances of the same implementation class. Am i wrong with this? I would like this to run for arbitrary interfaces without creating a service locator or some other construct for every new service. Here is an example. Suppose I have an interface defining a service package test; public interface IService { void doSomething(); } and two implementations: package test; import javax.inject.Named; @Named @MyAnnotation("service1") public class Service1 implements IService { @Override public void doSomething() { System.out.println("this"); } } ... package test; import javax.inject.Named; @Named @MyAnnotation("service2") public class Service2 implements IService { @Override public void doSomething() { System.out.println("that"); } } Now I would like to inject an IService to another component and let spring choose the correct implementation based on some queryable run time property and the value of MyAnnotation. Is there a way to do this in a general way in spring? EDIT: I have a Context that holds some value. It is a thread local in this case. package test; public class MyValueHolder { private static final ThreadLocal&lt;String&gt; value = new ThreadLocal&lt;&gt;(); public static void set(String newValue) { value.set(newValue); } public static String get() { return value.get(); } public static void reset() { value.remove(); } } And I have an component which uses IService package test; import javax.inject.Inject; import javax.inject.Named; @Named public class MyComponent { @Inject private IService service; public void myImportantWorkflow(){ MyValueHolder.set("service1"); service.doSomething(); MyValueHolder.set("serv…
favorite count: 0
has comment: http://stackoverflow.com/comment/39415297
type: Question
possible better answer: http://stackoverflow.com/a/25295552
tagged with: scope

http://stackoverflow.com/a/25321240
score: 0
has body: You can use Reflection like this import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; class ReflectionExample { public static void main(String[] args){ String[] checklist = { "check100", "check101", "check105" }; ReflectionExample example = new ReflectionExample(); for (String methodName : checklist) { try { Method method = ReflectionExample.class.getMethod(methodName, String[].class); String[] configFile = new String[1]; method.invoke(example,configFile); }catch(Exception e) { e.printStackTrace(); } } } // ... public void check100(String[] configFile) { // performs the configFile // check100 System.out.println("check100"); } public void check101(String[] configFile) { // performs the configFile // check101 System.out.println("check101"); } public void check103(String[] configFile) { // check not applicable to this // device System.out.println("check103"); } } of course, an exception will be thrown for check105
answers question: http://stackoverflow.com/q/25321134
type: Answer

http://stackoverflow.com/comment/39403341
type: Comment
has text: @RajavelD since you are not overriding you are getting wrong answer
comment on: http://stackoverflow.com/a/25284780
type: AnswerComment
score: 0

http://stackoverflow.com/q/25310632
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25332205
upvote count: 3
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39482510
accepted answer: http://stackoverflow.com/a/25332205
has title: Spring Integration and Transaction Management - how difficult need it be?
favorite count: 0
type: Question
score: 3
tagged with: spring-integration
tagged with: transactions
has body: Using Spring Integration I am trying to built a simple message producing component. Basically something like this: &lt;jdbc:inbound-channel-adapter channel="from.database" data-source="dataSource" query="SELECT * FROM my_table" update="DELETE FROM my_table WHERE id IN (:id)" row-mapper="someRowMapper"&gt; &lt;int:poller fixed-rate="5000"&gt; &lt;int:transactional/&gt; &lt;/int:poller&gt; &lt;/jdbc:inbound-channel-adapter&gt; &lt;int:splitter id="messageProducer" input-channel="from.database" output-channel="to.mq" /&gt; &lt;jms:outbound-channel-adapter channel="to.mq" destination="myMqQueue" connection-factory="jmsConnectionFactory" extract-payload="true" /&gt; &lt;beans:bean id="myMqQueue" class="com.ibm.mq.jms.MQQueue"&gt; &lt;!-- properties omitted --!&gt; &lt;/beans:bean&gt; The "messageProducer" may produce several messages per poll but not necessarily one per row. My concern is that I want to make sure that rows are not deleted from my_table unless the messages produced has been committed to the MQ channel. On the other hand I will accept that rows in case of db- or network failure are not deleted thus causing duplicate messages to be produced. In other words I will settle for a non-XA one-phase commit with possible duplicates. When trying to figure out what I need to put to my Spring configuration I quickly get lost in endless discussions about transaction managers, AOP and transaction advice chains which I find difficult to understand - I know I ought to though. But I fear that I will spend a lot of time cooking up a configuration that is not really necessary for my problem at hand. So - my question is: Can it be that simple - or do I need to provide explicit configuration for transaction synchronization?
tagged with: java

http://stackoverflow.com/comment/39433932
has text: please read the documentation at the facebook integration to adnroid
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25301217
score: 0

http://stackoverflow.com/comment/39310236
score: 0
type: Comment
has text: `Object[][] data2 = dlist.toArray(new Object[dlist.size()][]);` would avoid creating unnecessary garbage as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/25234561

http://stackoverflow.com/q/25231531
has answer: http://stackoverflow.com/a/25313289
has comment: http://stackoverflow.com/comment/39304124
type: Question
linked to: http://stackoverflow.com/q/8515561
tagged with: thread-safety
has answer: http://stackoverflow.com/a/25241665
has comment: http://stackoverflow.com/comment/39303804
has comment: http://stackoverflow.com/comment/39304972
score: 2
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39304400
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25231561
downvote count: 0
accepted answer: http://stackoverflow.com/a/25241665
answer count: 3
has body: hi guys i was wondering if i can get a little advice im trying to write a program that can counts how many threads are waiting to process a function, and then once a certain number is achieved it releases all the thread. but my problem is i cant increment properly being that i can the all process the increment code at the same time , thus not incrementing it at all. protected synchronized boolean isOpen() { //this code just calls mymethod intrested where the problem lies lock.interested(); while(!lock.isReady()) { } return true;// this statement releases all my threads } public synchronized void interested() { count++;// how do i make this increment correctly with threads System.out.println(count+"-"+ lanes+"-"+ThreadID.get()); if(count==lanes) { count =0; ready =true; } }
has answer: http://stackoverflow.com/a/25231561
has comment: http://stackoverflow.com/comment/39303654
tagged with: critical-section
has comment: http://stackoverflow.com/comment/39303857
favorite count: 0
has title: how to safely increment while using threads in java

http://stackoverflow.com/comment/39516614
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25346085
score: 0
has text: Since the radius is 1, the width of the square would be 2, and since Math.random generates a number between 0.0 and 1.0, wouldn't multiplying by two give the full range of coordinates from 0 to 2.0? Regardless, multiplying by the radius got me closer to pi.

http://stackoverflow.com/a/55253552
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25352102
downvote count: 0
type: Answer
has body: Just call your changes to the size after you call dialog.show(). In this case, I am using a Stage with a FitViewport, so I scale down my actors so that they fit. When I adjust their size, I have to factor in the scale. public void create(Dialog dialog, float scale){ dialog.setScale(scale); dialog.setMovable(false); dialog.text("Are you sure you want to yada yada?"); dialog.button("Yes", true); //sends "true" as the result dialog.button("No", false); //sends "false" as the result } public void show(Stage st) { dialog.show(st); //pack() is called internally dialog.setWidth(worldWidth/scale); //we override changes made by pack() dialog.setY(Math.round((st.getHeight() - dialog.getHeight()) / 2)); //we override changes made by pack() }

http://stackoverflow.com/comment/39598892
type: Comment
has text: @Doval: That is correct, of course. But the wording of the answer, which I quoted, does not make that clear. See the confusion it caused Ian Ringrose. A better worded explanation might be: "`IO` code can be defined anywhere in Haskell, but it must be explicitly labeled as such via the type system. This ensures that side-effecting and pure code cannot mix. All `IO` code must be called either directly or indirectly from `main`"
comment on: http://stackoverflow.com/a/25376140
type: AnswerComment
score: 0

http://stackoverflow.com/a/25361324
has body: Have you considered using a HashMap for your problem: put the name in the key and the counter in the value. This way you don't need an Item class at all.
type: Answer
answers question: http://stackoverflow.com/q/25361122
score: 0

http://stackoverflow.com/a/25343477
answers question: http://stackoverflow.com/q/25343430
has comment: http://stackoverflow.com/comment/39512416
has comment: http://stackoverflow.com/comment/39645961
has comment: http://stackoverflow.com/comment/39512364
has comment: http://stackoverflow.com/comment/39512999
has body: You have put an semicolon there DriverManager.getConnection("jdbc:derby:datahold;"); remove it here is correct code DriverManager.getConnection("jdbc:derby:datahold");
score: 0
has comment: http://stackoverflow.com/comment/39512328
has comment: http://stackoverflow.com/comment/39586645
type: Answer

http://stackoverflow.com/a/25276171
score: 0
answers question: http://stackoverflow.com/q/25276074
has body: There is not a lot of fat in your inner loop. In the python version you constructng a new columns object each time you call getarray(). Since the getarray() function itself is pretty simple, you could in-line the whole thing. Unlikely to be a significan speedup. You could also try PyPy, which might make a relatively large difference -- probably still not as fast as the Java version though.
has comment: http://stackoverflow.com/comment/39419105
type: Answer

http://stackoverflow.com/comment/93020432
has text: As others have pointed out, null pointer exceptions here can also be caused by trying to pass null into a primitive type field, ie long or int, which cannot be null. Use Long or Integer instead.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25322583

http://stackoverflow.com/a/32736440
upvote count: 5
type: Answer
score: 4
downvote count: 1
has body: Even simpler just set SwipeRefreshLayout enabled if firstVisibleItem or disabled if not: yourList.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { yourSwipeRefreshLayout.setEnabled(firstVisibleItem == 0); } });
answers question: http://stackoverflow.com/q/25270171

http://stackoverflow.com/q/25341037
has comment: http://stackoverflow.com/comment/39508385
accepted answer: http://stackoverflow.com/a/25345623
has answer: http://stackoverflow.com/a/25345623
type: AnsweredQuestion
tagged with: object
tagged with: static
answer count: 3
has comment: http://stackoverflow.com/comment/39508441
possible better answer: http://stackoverflow.com/a/25341051
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25341051
has title: Are all objects created in java, are static objects in the main method?
score: -1
has answer: http://stackoverflow.com/a/79432864
tagged with: memory
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/6569557
tagged with: memory-management
upvote count: 2
has body: In order to access a non-static members/variables of a class you need to first create an object in public static void main(String args[]) method. Does this mean that all the objects that are created are static? I need a clear explanation and also I need to know how the memory allocation is done for static methods/variables of a class. I know this sounds like a naive question, but I need to know about it.
has comment: http://stackoverflow.com/comment/39508376

http://stackoverflow.com/comment/39511874
type: Comment
has text: @OliCharlesworth Well, I think this kind of questions can be good (+1) or bad (-1), regardless of their relevance for others. If someone is particularly interested in compiler construction or the more "formal", theoretical side of programming, these questions **are** relevant (for him, and possibly for his peers). However, I definitiely agree that **if**, at a certain point, one has to assume that the questions are asked "just for having been asked", they may turn into a waste of time (but I can't judge objectively whether this is the case here)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25342643

http://stackoverflow.com/comment/39575659
has text: Ok i understood. The other answer provided by @bbrakenhoff is correct : you should override the methods related to `getView` of `Adapter`
comment on: http://stackoverflow.com/a/25369392
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25366867
has body: You have not initialized your titlelist array, therefore referencing an element of that array will throw a NullPointerException. Initialize it with: String[] titlelist = new String[titles.size()];
answers question: http://stackoverflow.com/q/25366844
type: Answer
score: 0

http://stackoverflow.com/a/25732283
has comment: http://stackoverflow.com/comment/40319802
has comment: http://stackoverflow.com/comment/40247655
type: Answer
has body: Well, there is always a solution and maybe the "hacking" solution is the best here : Class overriding of that class. Create that package and create that class (exactly the same package and classname). Copy the code from your link to your class. Change the code, I'll suggest try to remove the complete if. => See what result it gives (test al your listboxes!) When you ever think of upgrading ZK version : Don't forget to remove or update the class !!! If removing doesn't help, try to change the style,... On the other hand, if updating ZK version is possible, you should try that. The version you use is old, and doesn't support newer browsers.
answers question: http://stackoverflow.com/q/25330705
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25330705

http://stackoverflow.com/q/25359225
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/25359751
accepted answer: http://stackoverflow.com/a/25359751
has body: I have a bunch of files, say 4 files.. I want to zip 2 files to a zip say "inner.zip" And the rest to the parent directory of "outer.zip". I.e InputStream streamToReadFile=readFile(filePath); String zipEntryName = folderName + "/" + fileNameToWrite; ZipEntry anEntry = new ZipEntry(zipEntryName); // I couldn't able to create zip in a zip file. streamToWriteInZip.putNextEntry(anEntry); while ((bytesIn = streamToReadFile.read(readBuffer)) &gt; 0) { streamToWriteInZip.write(readBuffer, 0, bytesIn); }
has title: Is there any way to create zip in a zip file using java dynamically..?
has comment: http://stackoverflow.com/comment/39540322
upvote count: 4
type: AnsweredQuestion
score: 3
tagged with: dynamic
tagged with: java
tagged with: compression
answer count: 1
downvote count: 1
tagged with: archive
favorite count: 0
type: Question

http://stackoverflow.com/q/25242240
type: AnsweredQuestion
tagged with: java
has body: I want to move a ball along the x-axis to either the right or the left, depending on which JButton the user clicks. The ball is not moving when either of the JButtons is clicked. I have used System.out.println() to try and find out what is wrong and the program is detecting clicks on the JButtons and changes the variable (int horizontal) which has to be changed to move the ball as well. MoveBallPanel class: package test; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class MoveBallPanel extends JPanel implements ActionListener { // declarations private JButton moveLeft; private JButton moveRight; private int center; private int horizontal; public MoveBallPanel() { // make elements moveLeft = new JButton("To the left"); moveLeft.addActionListener(this); moveRight = new JButton("To the right"); moveRight.addActionListener(this); // add to panel add(moveLeft); add(moveRight); } // to do when JButton is clicked @Override public void actionPerformed(ActionEvent e) { final int MOVE = 50; if (e.getSource() == moveLeft) { horizontal -= MOVE; // System.out.println("moveLeft JButton has been clicked"); // System.out.println(horizontal); } else { horizontal += MOVE; // System.out.println("moveRight button has been clicked"); // System.out.println(horizontal); } repaint(); } // draw ball @Override public void paintComponent(Graphics g) { final int DIAMETER = 100; final int VERTICAL = (getHeight() / 2) - (DIAMETER / 2); center = getWidth() / 2; horizontal = center - DIAMETER / 2; super.paintComponents(g); g.setColor(Color.ORANGE); g.fillOval(horizontal, VERTICAL, DIAMETER, DIAMETER); g.setColor(Color.BLACK); g.drawOval(horizontal, VERTICAL, DIAMETER, DIAMETER); g.drawOval(horizontal + DIAMETER / 4, VERTICAL, DIAMETER / 2, DIAMETER); } } MoveBall class: package test; import javax.swing.*; public class MoveBall extends JFrame { public MoveBall() { // JFrame object JFrame frame = new JFrame(); // JFrame properties frame.setSize(500, 500); frame.setLocation…
tagged with: paintcomponent
score: 1
accepted answer: http://stackoverflow.com/a/25242383
favorite count: 0
has title: Drawing not being repainted
tagged with: actionlistener
type: Question
downvote count: 0
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/25242383
has comment: http://stackoverflow.com/comment/39324245

http://stackoverflow.com/q/25368438
tagged with: webview
has title: Stuck on WebView Tutorial - R.id issue?
linked to: http://stackoverflow.com/q/16941556
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/16622515
tagged with: java
has answer: http://stackoverflow.com/a/25369598
has body: Good morning - I hope everyone has had an enjoyable weekend. I am having some issues following the tutorial at https://developer.chrome.com/multidevice/webview/gettingstarted Everything is going well until I reach the step regarding an edit of the MainActivity class. This is Step 3 in the section Add the WebView: https://developer.chrome.com/multidevice/webview/gettingstarted#add_the_webview Here is the content of my AndroidManifest.xml: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.nathan.myapplication" &gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MyActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;/manifest&gt; And here is my MyActivity.java: package com.example.nathan.myapplication; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebView; public class MyActivity extends Activity { private WebView mWebView; // Added by ND Guthrie 8.15.2014:2229 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); mWebView = (WebView)findViewById(R.id.activity_my_webview); // Added by ND Guthrie 8.15.2014:2231 } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.my, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Ho…
has comment: http://stackoverflow.com/comment/39557678
type: Question
linked to: http://stackoverflow.com/q/2483732
has comment: http://stackoverflow.com/comment/39558369
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39557734
answer count: 1

http://stackoverflow.com/q/25316695
favorite count: 0
has comment: http://stackoverflow.com/comment/39462537
type: Question
possible better answer: http://stackoverflow.com/a/25316767
has answer: http://stackoverflow.com/a/25316767
has body: I have a arraylist variable this variable returns like this data: [user01:message1, user02:message2, user01:message3] I want to list each item,I'll put to log screen like this "user01 said:message1" "user02 said:message2" "user01 said:message3" How can I list like this ? Edit: This is my arraylist class class Message { public String message, sender; public Message (String msg, String from) { // check here that msg and from are not null. If so, use a default value or throw an NullPointerException message = msg; sender = from; } // Just a utility method for printing out the Message to System.out public String toString () { return sender+":"+message; } } And this is the list: Hashtable&lt;String, ArrayList&lt;Message&gt;&gt; table = new Hashtable&lt;String, ArrayList&lt;Message&gt;&gt;();
tagged with: android
accepted answer: http://stackoverflow.com/a/25316736
has answer: http://stackoverflow.com/a/25316795
has title: List datas in arraylist
has answer: http://stackoverflow.com/a/25316736
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25317081
score: 1
tagged with: java
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39481524
has text: Thanks! I wondered about just `/rest` from some of the examples I saw, but ended up going with `http://0.0.0.0`. That seems to work fine, at this point it's mostly an annoyance that the default services list at `:8181/cxf` explicitly lists the 0.0.0.0 address instead of inferring it, but that's on me :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25316015
type: AnswerComment

http://stackoverflow.com/comment/39497647
type: AnswerComment
comment on: http://stackoverflow.com/a/25325649
score: 0
has text: Don't think this is likely to work; what happens when conditionMet.put(false) is called?
type: Comment

http://stackoverflow.com/q/25363676
tagged with: saml-2.0
has body: In order to fetch metadata from a remote source, I defined an ExtendedMetadataDelegate bean as follows: @Bean @Qualifier("replyMeta") public ExtendedMetadataDelegate replyMetadataProvider() throws MetadataProviderException { String metadataURL = "https://ststest.mydomain.it/FederationMetadata/2007-06/FederationMetadata.xml"; final Timer backgroundTaskTimer = new Timer(true); HTTPMetadataProvider provider = new HTTPMetadataProvider( backgroundTaskTimer, httpClient(), metadataURL); provider.setParserPool(parserPool()); ExtendedMetadataDelegate emd = new ExtendedMetadataDelegate( provider, new ExtendedMetadata()); return emd; } To ensure the signature trust establishment, I added the related key both in JDK keystore and application keystore (the second step might not be enough); despite that, an error occurs by running the webapp. [2014-08-18 14:36:47.200] boot - 6000 DEBUG [localhost-startStop-1] --- SignatureValidator: Attempting to validate signature using key from supplied credential [2014-08-18 14:36:47.200] boot - 6000 DEBUG [localhost-startStop-1] --- SignatureValidator: Creating XMLSignature object [2014-08-18 14:36:47.206] boot - 6000 DEBUG [localhost-startStop-1] --- SignatureValidator: Validating signature with signature algorithm URI: http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 [2014-08-18 14:36:47.207] boot - 6000 DEBUG [localhost-startStop-1] --- SignatureValidator: Validation credential key algorithm 'RSA', key instance class 'sun.security.rsa.RSAPublicKeyImpl' [2014-08-18 14:36:47.329] boot - 6000 DEBUG [localhost-startStop-1] --- SignatureValidator: Signature validated with key from supplied credential [2014-08-18 14:36:47.329] boot - 6000 DEBUG [localhost-startStop-1] --- BaseSignatureTrustEngine: Signature validation using candidate credential was successful [2014-08-18 14:36:47.330] boot - 6000 DEBUG [localhost-startStop-1] --- BaseSignatureTrustEngine: Successfully verified signature using KeyInfo-derived credential [2014-08-18 14:36:47.330] …
linked to: http://stackoverflow.com/q/28190923
downvote count: 0
linked to: http://stackoverflow.com/q/24698914
possible better answer: http://stackoverflow.com/a/56092149
tagged with: spring
tagged with: spring-security
has answer: http://stackoverflow.com/a/56092149
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39550516
has answer: http://stackoverflow.com/a/74771671
has title: Signature trust establishment failed for SAML metadata entry
tagged with: java
tagged with: spring-saml
has answer: http://stackoverflow.com/a/25384924
upvote count: 18
score: 18
answer count: 4
has comment: http://stackoverflow.com/comment/65606907
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/66780596
has comment: http://stackoverflow.com/comment/39550094
accepted answer: http://stackoverflow.com/a/25384924

http://stackoverflow.com/a/25371334
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25371274
has body: in your code you need to add single quotes: String query = "UPDATE " + TABLE_FB_FEED + " SET " + COL_FB_COMMENTS +"="+"'HELLO'" + " WHERE " + COL_FB_ID+"="+id or String query = "UPDATE " + TABLE_FB_FEED + " SET " + COL_FB_COMMENTS +"='HELLO' WHERE " + COL_FB_ID+"="+id this is another example "UPDATE DB_TABLE SET YOUR_COLUMN='newValue' WHERE id=myidValue");
type: Answer
answers question: http://stackoverflow.com/q/25371274
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/25298962
has answer: http://stackoverflow.com/a/25299144
has comment: http://stackoverflow.com/comment/39430089
type: AnsweredQuestion
has title: How to set image wallpaper, when user click on Image?
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39430196
linked to: http://stackoverflow.com/q/20783203
has comment: http://stackoverflow.com/comment/39430126
has comment: http://stackoverflow.com/comment/39429948
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39430130
has comment: http://stackoverflow.com/comment/39430146
upvote count: 0
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/39430151
answer count: 1
has body: I am new to coding and never worked with it before! I am working on wallpaper application were I created the gallery . I managed to do this , but I want to modify the app so that when user click on specific image It allow them to set as wallpaper. I need some help with this! (Sorry for bad English) Does anyone know how I should do this? Really thankful for help Following are my code... MainActivity .java import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.Gallery; import android.widget.ImageView; import android.widget.ImageView.ScaleType; public class GalleryDemoActivity extends Activity { private ImageView selectedImageView; private ImageView leftArrowImageView; private ImageView rightArrowImageView; private Gallery gallery; private int selectedImagePosition = 0; private List<Drawable> drawables; private GalleryImageAdapter galImageAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); getDrawablesList(); setupUI(); } private void setupUI() { selectedImageView = (ImageView) findViewById(R.id.selected_imageview); leftArrowImageView = (ImageView) findViewById(R.id.left_arrow_imageview); rightArrowImageView = (ImageView) findViewById(R.id.right_arrow_imageview); gallery = (Gallery) findViewById(R.id.gallery); leftArrowImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (selectedImagePosition > 0) { --selectedImagePosition; } gallery.setSelection(selectedImagePosition, false); } }); rightArrowImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (sele…
accepted answer: http://stackoverflow.com/a/25299144
favorite count: 0

http://stackoverflow.com/q/25258653
favorite count: 0
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/25258685
tagged with: java
has title: Terminology for path till class name in Java
has answer: http://stackoverflow.com/a/25258685
accepted answer: http://stackoverflow.com/a/25258676
has answer: http://stackoverflow.com/a/25258770
has answer: http://stackoverflow.com/a/25258676
type: AnsweredQuestion
has body: Suppose, I've package org.test.selenium and class which is defined for it is TestClass. Then, what is the terminology for the path org.test.selenium.TestClass in Java? Actually, I want to pass the variable which contains this path to a method and hence want to give correct name to the variable.
answer count: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39487601
has text: @user3907211 What's in `usermatch.java`, line 32?
type: Comment
comment on: http://stackoverflow.com/a/25329322
type: AnswerComment
score: 1

http://stackoverflow.com/q/25256023
answer count: 4
tagged with: user-input
type: Question
has comment: http://stackoverflow.com/comment/39350570
type: UnansweredQuestion
has title: String input of more than one word causes exception error
has comment: http://stackoverflow.com/comment/39374326
has body: I am inputting the following things: book 12.46 music cd For some reason, the prompt for cost comes up and the next output line comes on the same line. Could someone help me to spot my mistake? public class SalesTax { public static void main(String[] args) { // Input items for shopping cart HashMap&lt;String, String&gt; cart = new HashMap&lt;String, String&gt;(); // Create a Scanner Scanner input = new Scanner(System.in); // variables char done; boolean goods; double tax; // Pick items for list. do { System.out.print("Please enter an item."); String item = input.next(); System.out.print("Please enter the price for "+ item + ": "); String price = input.next(); if (item.contains("book")) { goods = false; } else if(item.contains("chocolate")) { goods = false; } else if(item.contains("pill")) { goods = false; } cart.put(item, price); System.out.print("Would you like to continue to add items? (Type Y) for Yes and (Type N) for No."); done = input.next().charAt(0); } while(Character.toUpperCase(done) == 'Y'); } }
score: 0
has answer: http://stackoverflow.com/a/25256069
has answer: http://stackoverflow.com/a/25256075
has comment: http://stackoverflow.com/comment/39375054
tagged with: java
has answer: http://stackoverflow.com/a/25256073
tagged with: output
has answer: http://stackoverflow.com/a/25256136

http://stackoverflow.com/q/25350732
has comment: http://stackoverflow.com/comment/39529816
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39525916
tagged with: file-upload
favorite count: 0
score: 8
type: Question
tagged with: rest
upvote count: 8
linked to: http://stackoverflow.com/q/16510618
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39528568
tagged with: google-cloud-endpoints
has title: Upload image on Google Cloud Storage with Google Endpoints
has answer: http://stackoverflow.com/a/46291519
tagged with: java
has body: I'm trying to create a RESTFul Web Service for upload photos. Is it possible create a Google Cloud Endpoints to upload images/photos? My problem is that I can't understand how to write the function declaration and which parameters I need to handle. public void uploadPhoto(@Named("token") String token, @Named("title") String title, @Named("description") String description, @Named("photo") HttpServletRequest req) {} If I handle value of req, what I will find in it? Thank you

http://stackoverflow.com/q/25332633
tagged with: java
has comment: http://stackoverflow.com/comment/39493513
possible better answer: http://stackoverflow.com/a/25332664
type: Question
has answer: http://stackoverflow.com/a/25332664
has title: Throwing an Exception in the object constructor
tagged with: constructor
answer count: 2
has comment: http://stackoverflow.com/comment/39493158
upvote count: 1
has body: Lets say I've this code: public class MyClass { public final static int valueA = 0; public final static int valueB = 1; private int parameter = -1; public MyClass(int parameter) { if(parameter != valueA &amp;&amp; parameter != valueB) { throw new IllegalArgumentException("Exception description here"); } this.parameter = parameter; } } Is this a best practice? Or is there a better way to grantee that whatever the value passed on the constructor it has the same value as one of those variables?
favorite count: 0
has answer: http://stackoverflow.com/a/25332665
accepted answer: http://stackoverflow.com/a/25332665
type: AnsweredQuestion
downvote count: 0
tagged with: exception
score: 1

http://stackoverflow.com/comment/39482993
comment on: http://stackoverflow.com/q/25327553
type: Comment
type: QuestionComment
has text: Same here, easy to overlook the semi-colon when there's a big glaring error right in front of your face.
score: 0

http://stackoverflow.com/comment/39326638
has text: @user3218187 Don't forget to mark your question as answered. ^.^
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25240047
type: AnswerComment

http://stackoverflow.com/comment/39418309
type: Comment
comment on: http://stackoverflow.com/a/25292877
type: AnswerComment
has text: Let us know if it doesn't work. We may need to see more of your code if it doesn't, such as a snippet of the Class you're creating the `alarmManager` in.
score: 0

http://stackoverflow.com/a/25338142
has comment: http://stackoverflow.com/comment/39507810
has comment: http://stackoverflow.com/comment/39507941
has comment: http://stackoverflow.com/comment/39506394
has comment: http://stackoverflow.com/comment/39507414
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39503514
has comment: http://stackoverflow.com/comment/39503207
has comment: http://stackoverflow.com/comment/39505655
has body: Use a Swing Timer for repeating tasks &amp; a SwingWorker for long running tasks. E.G. of both below - it uses a Timer to repeatedly perform a 'long running' task (a ping) in a SwingWorker. See Concurrency in Swing for more details on the Event Dispatch Thread and doing long running or repeating tasks in a GUI. This code combines a long running task ('pinging' a server) using SwingWorker invoked from a repeating task (updating the JLabel repeatedly with the times) using a Swing based Timer. import java.awt.event.*; import javax.swing.*; import java.net.Socket; public class LabelUpdateUsingTimer { static String hostnameOrIP = "stackoverflow.com"; int delay = 5000; JLabel label = new JLabel("0000"); LabelUpdateUsingTimer() { label.setFont(label.getFont().deriveFont(120f)); ActionListener timerListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new PingWorker().execute(); } }; Timer timer = new Timer(delay, timerListener); timer.start(); JOptionPane.showMessageDialog( null, label, hostnameOrIP, JOptionPane.INFORMATION_MESSAGE); timer.stop(); } class PingWorker extends SwingWorker { int time; @Override protected Object doInBackground() throws Exception { time = pingTime(); return new Integer(time); } @Override protected void done() { label.setText("" + time); } }; public static int pingTime() { Socket socket = null; long start = System.currentTimeMillis(); try { socket = new Socket(hostnameOrIP, 80); } catch (Exception weTried) { } finally { if (socket != null) { try { socket.close(); } catch (Exception weTried) {} } } long end = System.currentTimeMillis(); return (int) (end - start); } public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { new LabelUpdateUsingTimer(); } }; SwingUtilities.invokeLater(r); } }
has comment: http://stackoverflow.com/comment/39505543
has comment: http://stackoverflow.com/comment/39507535
has comment: http://stackoverflow.com/comment/39503167
has comment: http://stackoverflow.com/comment/39503275
accepted answer of: http://stackoverflow.com/q/25337676
upvote count: 6
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/39506528
answers question: http://stackoverflow.com/q/25337676
has comment: http://stackoverflow.com/comment/39508687

http://stackoverflow.com/q/25339542
has comment: http://stackoverflow.com/comment/39505983
has answer: http://stackoverflow.com/a/25339576
favorite count: 0
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/39505774
possible better answer: http://stackoverflow.com/a/25339650
score: -3
has answer: http://stackoverflow.com/a/25339650
has comment: http://stackoverflow.com/comment/39505586
has answer: http://stackoverflow.com/a/25339610
accepted answer: http://stackoverflow.com/a/25339610
has title: Running a method on all objects in a HashMap
tagged with: foreach
type: AnsweredQuestion
upvote count: 0
downvote count: 3
linked to: http://stackoverflow.com/q/448122
has comment: http://stackoverflow.com/comment/39505610
answer count: 3
has body: I think i misunderstood the application of HashMap when i was rewriting parts of my code to make it more maintainable. joints is a HashMap containing a set of objects identified by a String: private HashMap&lt;String, SomeObject&gt; joints = new HashMap(5, 1); Population of the HashMap is straightforward enough via the put() method. However I now need to run a method on each of them. The below code produces a syntax error at the first period, but i believe it illustrates what I am trying to do. joints.("knee").someMethod(someValue); joints.("hip").someMethod(someOtherValue); joints.("shoulder").someMethod(someOtherValue); joints.("neck").someMethod(someOtherValue); joints.("elbow").someMethod(someOtherValue); What would be a valid/correct equivalent? of the above? I am thinking get() the object, delete it from the map, modify the object, put() it back into the HashMap. While a foreach would be a step closer, this is a moot approach as the arguements for someMethod() are different for each object.
tagged with: java

http://stackoverflow.com/q/25381903
tagged with: class
type: AnsweredQuestion
score: 0
answer count: 3
has title: Can I call a class have only instance variable a wrapper class?
tagged with: wrapper
has comment: http://stackoverflow.com/comment/39582803
tagged with: java
has comment: http://stackoverflow.com/comment/39582833
has body: I have a class which only contains instance variables, getter and setters, something like: public class MyClass { @Getter @Setter private String bla; @Getter @Setter private String blabla; @Getter @Setter private Date dateBla; } Can I call it a Wrapper-class? Or do such classes have a specific name? So far I am only familiar with primitive wrapper classes.
accepted answer: http://stackoverflow.com/a/25382045
possible better answer: http://stackoverflow.com/a/25382000
has answer: http://stackoverflow.com/a/25382045
has answer: http://stackoverflow.com/a/25382000
has answer: http://stackoverflow.com/a/25383442
type: Question

http://stackoverflow.com/comment/39432591
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25296842
type: Comment
has text: @ashes999 It seems that both mechanisms have their advantages and disadvantages. I've heard from people who like Java's mechanism and think `internal` is useless. What we probably want is a modifier like `public(com.ashes999.*)` that says "make this name visible to packages that match that pattern, and invisible everywhere else. Java doesn't have anything like that, and AFAIK neither does C#. So maybe we should convince one of the language teams to add this feature and hope the other one copies it. :) :)

http://stackoverflow.com/q/25269044
type: AnsweredQuestion
tagged with: java
tagged with: swagger
answer count: 1
has body: I found that after I started using swagger documentation tool for my REST API, the size of my war file increased almost 4.5 times, from 8.7 MB to 39MB. I am using Maven to build the project. That is because of the Swagger Scala dependencies big size, specially scala-compiler. So I was trying to find out which of those dependencies are not really needed. I created a new issue in the project's Github page: https://github.com/wordnik/swagger-core/issues/624 They answered that it is not a good idea to remove any scala dependency as the framework is written in that language and that could break it. Also recommended as a workaround to put the dependencies in the container/server instead of inside the war.
downvote count: 0
tagged with: maven
upvote count: 7
favorite count: 0
has title: Swagger-core Scala dependencies excessive size
type: Question
has answer: http://stackoverflow.com/a/25269045
score: 7
accepted answer: http://stackoverflow.com/a/25269045

http://stackoverflow.com/a/25255392
has body: You can manipulate flag and iterate through the array while checking the next array if it is a sequential number prior from the current array. sample: int []i = {1,2,3,5,7,8,9,11,12,16,17,18}; boolean flag = true; for(int i2 = 0; i2 &lt; i.length; i2++) { if(i2+1 &lt; i.length &amp;&amp; i[i2+1] == i[i2]+1) { System.out.print(i[i2] + " "); flag = true; } else { if(flag) System.out.print(i[i2]); flag = false; System.out.println(); } result: 1 2 3 7 8 9 11 12 16 17 18
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25255227

http://stackoverflow.com/comment/39494026
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25333132
has text: Without any code we are not going to be able to help you
score: 1

http://stackoverflow.com/a/25334039
score: 1
downvote count: 0
upvote count: 1
type: Answer
has body: protected means you may call the method in any derived class. However, Test isn't derived from Transformation. genOutputSet is only visible inside Transformation and LookupTransformation. This doesn't tell anything about the visibility of methods when they are called on an object of the derived class.
answers question: http://stackoverflow.com/q/25334004

http://stackoverflow.com/comment/39338927
comment on: http://stackoverflow.com/a/25249942
type: Comment
score: 0
type: AnswerComment
has text: I didnt copy the answer,just you were faster.And look our local variables are same too.Lol :)

http://stackoverflow.com/comment/39532902
type: Comment
type: AnswerComment
has text: Thank you for your answer, could you show me how would I do that, put the into an objet array? cause they are not the same size
score: 0
comment on: http://stackoverflow.com/a/25342990

http://stackoverflow.com/a/25279902
type: AcceptedAnswer
type: Answer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25279568
score: 1
has comment: http://stackoverflow.com/comment/39424271
has body: Design is flawed, library should have provided you Observer design pattern, using which you would have submitted listener reference along with downloading details. Upon finishing downloading, library using your provided listener would have notified back to you over download process result, reading which you could have taken action easily with UI. Moreover in your library code saveRemoteFile() spawns a asynctask, return value is irrelevant here as method wont wait until asynctask is executed. Possible implementation as per above mentioned info. // Interface for bserving public interface DownloadListsner{ public void onSuccess(String uri); public void onError(String uri); } // API for submitting download request public void saveRemoteFile(String url, String filename,DownloadListsner listener... ){ ... } AsyncTask{ // Upon finish execution onPostExecute(){ // Take action listener.onSuccess or listener.onError } }
answers question: http://stackoverflow.com/q/25279568

breakpoints
tags question: http://stackoverflow.com/q/25377463
tag name: breakpoints
type: Tag
tags question: http://stackoverflow.com/q/25298724

http://stackoverflow.com/comment/39454393
comment on: http://stackoverflow.com/q/25271569
score: 0
type: Comment
has text: That isn't what I wanted to hear but that was my understanding as well. Thank you for clarifying.
type: QuestionComment

http://stackoverflow.com/comment/39402161
comment on: http://stackoverflow.com/q/25273268
has text: Try to do some "mvn clean install" by console, sometime i sow that some IDE do not take or use the good configuration
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25356118
has answer: http://stackoverflow.com/a/25360491
upvote count: 1
accepted answer: http://stackoverflow.com/a/25360491
score: 1
tagged with: java
answer count: 1
tagged with: jaxb
has comment: http://stackoverflow.com/comment/39534906
has title: Programmatically add or set JAXB XmlRootElement
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39534431
has body: I want to avoid adding an annotation @XMLRootElement to every POJO that I will used to unmarshall a xml. Is there a way to set or add programmatically XmlRootElement to a class? //@XmlRootElement here public class Person{ private String name; private String address; //other fields //getters and setters here If not possible, how can I unmarshall a xml without XmlRootElement in POJO? public static &lt;T&gt; T unmarshal(Class clazz, String xml) { try { JAXBContext ctx = JAXBContext.newInstance(clazz); Unmarshaller u = ctx.createUnmarshaller(); return (T) u.unmarshal(new StringReader(xml)); } catch (JAXBException e) { throw new RuntimeException("Error interpreting XML response", e); } } Exception thrown without @XmlRootElement: Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"report"). Expected elements are (none) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:962) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:399) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:380) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:101) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at o…
downvote count: 0

http://stackoverflow.com/a/25317739
answers question: http://stackoverflow.com/q/25317681
has comment: http://stackoverflow.com/comment/39464576
has body: A FrameLayout "is designed to block out an area on the screen to display a single item". The last child view is displayed on top of all the earlier views. If you want them all to display in a vertical list, a LinearLayout would be better suited to what you are trying to do. Edit: If you want it to work reliably on different screen sizes and resolutions you shouldn't use pixels, you should define your layout in xml using dps instead of pixels. You could make your root layout a RelativeLayout and define relationships for each of the buttons such as android:toRightOf="&lt;id of button&gt;"
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39464777
has comment: http://stackoverflow.com/comment/39464601
score: 1
type: Answer

http://stackoverflow.com/a/25357025
upvote count: 35
type: AcceptedAnswer
downvote count: 2
accepted answer of: http://stackoverflow.com/q/25355232
type: Answer
answers question: http://stackoverflow.com/q/25355232
score: 33
has body: First off, if you know the type of elements in your List, you may want to use the ParameterizedTypeReference class like so. ResponseEntity&lt;List&lt;MyObj&gt;&gt; res = restTemplate.postForEntity(getUrl(), myDTO, new ParameterizedTypeReference&lt;List&lt;MyObj&gt;&gt;() {}); Then if you just want to return the list you can do: return res.getBody(); And if all you care about is the list, you can just do: // postForEntity returns a ResponseEntity, postForObject returns the body directly. return restTemplate.postForObject(getUrl(), myDTO, new ParameterizedTypeReference&lt;List&lt;MyObj&gt;&gt;() {});

http://stackoverflow.com/q/25284022
has answer: http://stackoverflow.com/a/25285838
type: Question
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25285790
tagged with: plugins
score: 0
has body: I have written a Neo4j server plugin and want to return a JSON string. Using String as return type will cause Neo4j to escape the string. The plugin documentation refers to org.neo4j.server.rest.repr.Representation as valid return type next to primitives, Neo4j types and String. Unfortunately I am not able to extends this abstract class in order to build an own representation class, since its abstract methods are package private and can not be overridden. One can easily create an instance of the class using Representation.emptyRepresentation but there is no setter for the value afterwards. Did anyone manage to return a JSON value from a server plugin without escaping yet?
answer count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Neo4j server plugin: disable String escaping
tagged with: neo4j

http://stackoverflow.com/comment/39574982
comment on: http://stackoverflow.com/q/25377355
score: 0
type: QuestionComment
type: Comment
has text: I added the quotes because I was unsuccessful without them. As expected, they don't alter the outcome.

http://stackoverflow.com/q/25283081
score: 1
tagged with: java
tagged with: jboss
tagged with: jms
type: Question
tagged with: spring-jms
downvote count: 0
answer count: 1
tagged with: jms-topic
upvote count: 1
accepted answer: http://stackoverflow.com/a/25302451
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25302451
has title: How to create a shared subscription using spring JMS
has body: JMS 2.0 specification introduced the concept of shared durable subscriptions. I have a use case where I have to create subscriptions programmatically upon server start up. We have clustered JBoss servers. Hence each JBoss will have similar configurations and every JBoss will have applications which will create durable subscribers(messaging provider is WMQ). Since durable subscriptions have to have a unique name, I thought of using shared subscriptions. Now the problem is that spring's 4.0.6.RELEASE has support for new features in JMS 2.0, however I did not find a way to create shared durable subscriptions via spring. We use spring's DefaultMessageListenerContainer to create the listeners. Am I doing it right? I appreciate any suggestions that you might have.

http://stackoverflow.com/q/25294275
has answer: http://stackoverflow.com/a/25294338
has comment: http://stackoverflow.com/comment/39460997
favorite count: 0
type: Question
upvote count: 25
has answer: http://stackoverflow.com/a/25294665
answer count: 5
has answer: http://stackoverflow.com/a/25294449
has body: I'm preparing for Java 7 certification and have the following question. Byte b = 10 compiles ok. Looks like the compiler is narrowing int 10 to byte 10 and then boxing it. How come Byte b = new Byte(10) won't compile? Why can't the compiler narrow int 10 to byte 10 like it did in the first case? Also how come Long l = new Long(10) compiles ok but Long l = 10 fails? I'm not clear about how this works. Can somebody provide an clear explanation?
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25294386
has comment: http://stackoverflow.com/comment/39420995
score: 25
has comment: http://stackoverflow.com/comment/39427545
has answer: http://stackoverflow.com/a/25294394
linked to: http://stackoverflow.com/q/25292510
has comment: http://stackoverflow.com/comment/39460953
tagged with: java
has title: Java widening conversions
has comment: http://stackoverflow.com/comment/39454265

http://stackoverflow.com/comment/39519916
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25347593
has text: But the server is still loading, and if you have other webapps, they will load and will attempt to communicate with each over (messages etc.) and will fail. Maybe this is a unique case... I would like a fatal error that will fail the entire server.
score: 0

http://stackoverflow.com/a/25357530
score: 1
type: Answer
has body: LinkedHashMap is hashmap. But it maintains order of insertion. But HashMap doesnt maintain order.
downvote count: 0
answers question: http://stackoverflow.com/q/25357462
upvote count: 1

http://stackoverflow.com/q/25302359
has body: I am currently working with Libgdx for Android and Desktop development and I ran into some trouble. (nothing specific with Libgdx). This is just a user error (aka I've been trying to fix this for 2 hours now and I'm completely stumped). So this is whats up: I created a class so I can simply use a string to load a Texture (to use as a spritesheet) public class Animator{ private int FRAME_Y; private int FRAME_X; private Animation walk_down, walk_left, walk_right, walk_up, walk_spin; private Animation MainAnimation; private static Texture Sheet; static TextureRegion[] walkRegion_down, walkRegion_left, walkRegion_right, walkRegion_up, walkRegion_spin; private SpriteBatch spriteBatch; static TextureRegion currentFrame; static float stateTime; private TextureRegion test; private TextureRegion MainRegion; public Animator(String location, int Y, int X, boolean flipped) { this.FRAME_Y = Y; this.FRAME_X = X; Sheet = new Texture(Gdx.files.internal(location)); int frameWidth = Sheet.getWidth() / FRAME_Y; int frameHeight = Sheet.getHeight() / FRAME_X; TextureRegion[][] tmp = TextureRegion.split(Sheet, frameWidth, frameHeight); MainRegion = new TextureRegion(Sheet, 0, 0, frameWidth, frameHeight); MainAnimation = new Animation(0.2f, MainRegion, MainRegion); spriteBatch = new SpriteBatch(); stateTime = 0f; return; } public static void render(Animator G, float x, float y) { SpriteBatch spriteBatch1 = new SpriteBatch(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); stateTime += Gdx.graphics.getDeltaTime(); currentFrame = G.MainAnimation.getKeyFrame(stateTime); spriteBatch1.begin(); spriteBatch1.draw(currentFrame, x, y); spriteBatch1.end(); }} Both of the funcitons are being used in this class / / / to create new Objects public class LetSurviveMain extends Game{ //public static Entity player1; public static Animator test, test2; @Override public void create () { //Map = new TmxMapLoader().load("Tutorial.tmx"); //GameStart.show(); Animator test = new Animator("An…
score: 0
tagged with: nullpointerexception
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39437584
has title: New object with parameters pulls nullpointerexception
has comment: http://stackoverflow.com/comment/39437975
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: parameters
tagged with: object

http://stackoverflow.com/comment/39458576
has text: Thank you! I guess I've got an idea. You made it clear for me now. Thus, "days" can be safety used as "int" with no problems at all, right?
type: AnswerComment
comment on: http://stackoverflow.com/a/25314382
score: 0
type: Comment

http://stackoverflow.com/a/25288941
has body: Like this: String.valueOf(intValue); or new Integer(intValue).toString();
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25288901
type: Answer
score: 2
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25288901

http://stackoverflow.com/comment/39308783
has text: I create it in the [environment](http://www.bluej.org/) that I use.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25233881
type: QuestionComment

http://stackoverflow.com/comment/39508430
type: Comment
has text: Thank you... Once pointed out I feel like hitting my head against the wall repeatedly. Lesson 2: When your brain tells you, that you need to sleep, ignore your body being all vibrant and eager for work, get a bottle of scotch, vodka, sleeping pills or whatever works for you and go to sleep.
type: AnswerComment
comment on: http://stackoverflow.com/a/25336506
score: 0

http://stackoverflow.com/q/25363324
tagged with: mysql
has answer: http://stackoverflow.com/a/25363393
type: Question
has comment: http://stackoverflow.com/comment/39547602
has comment: http://stackoverflow.com/comment/39547531
type: UnansweredQuestion
has body: I am trying to insert an Int to a table, via label. So I have 6 columns, starting with Name, Lastname as varchars, and Number, Points, Assists and Rebounds as ints. Query with: String sql = ("INSERT INTO `PlayerTable`(`Name`, `Lastname`, `Number`, `Points`, `Assists`, `Rebounds`) VALUES (?,?,?,?,?,?)"); PreparedStatement ps = PlayerBase.get().prepareStatement(sql); ps.setString(1, playerNameFld.getText()); ps.setString(2, playerLNFld.getText()); works just fine, but when I try to parse: try { ps.setInt(3, Integer.parseInt(playerNumberFld.getText())); } catch (Exception e) { e.printStackTrace(); } I get an NumberFormatException: For input string: "" and SQLException: No value specified for parameter 3. How can I fix this? Thanks
score: 0
has title: Insert INT into MySql table via label in Java - NumberFormatException
tagged with: sql
tagged with: java
answer count: 1

http://stackoverflow.com/q/25346658
has title: Java: Multiple columns in combo boxes
has comment: http://stackoverflow.com/comment/39517684
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39517935
answer count: 0
score: 1
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39518276
has body: I'm quite new to Java, so I'm using NetBeans to create my application. I was wondering if there was a relatively simple way to create columns within a combo box? I've tried using tabs but the tabs show up as spaces. Ideally, I'd like some sort of character that could align the next column, but anything would be great. Thanks!
type: UnansweredQuestion
tagged with: combobox

http://stackoverflow.com/comment/39497155
has text: @jdphenix Why would I care if it has any other children or Parent in it? I want to know if I can access the variable I and do stuff with it if and only if that object is of type Child as well. If I had for example a Child2 that extended parent that was also in the array, it would not be an instance of Child and I would not need to see that variable anyway. So what is wrong with 'dirty type checks'? I would have to write a second class that actually does something to extend Parent, which I would have made abstract, and then would still have to cast in order to access the variables.
type: Comment
comment on: http://stackoverflow.com/a/25334485
score: 0
type: AnswerComment

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/25371473

http://stackoverflow.com/comment/39505454
has text: What have you tried so far? Please read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). Post your code, see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25339446

http://stackoverflow.com/q/25289107
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39411117
has answer: http://stackoverflow.com/a/25289838
tagged with: sqlite
has comment: http://stackoverflow.com/comment/39411707
type: Question
has comment: http://stackoverflow.com/comment/39411183
has title: How to remove DB in method onUpgrade?
answer count: 3
accepted answer: http://stackoverflow.com/a/25289838
tagged with: android
has answer: http://stackoverflow.com/a/25289508
tagged with: java
possible better answer: http://stackoverflow.com/a/25289508
has body: How can i remove file with my database on SQLite in method onUpgrade? I tried: public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { context.deleteDatabase(DATABASE_NAME); onCreate(db); } error: context cannot be resolved. and second: public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { File dbFile = getDatabasePath("your_db_file_name"); boolean deleted = dbFile.delete(); onCreate(db); } error: The method getDatabasePath(String) is undefined for the type TestDatabase.
tagged with: eclipse
has answer: http://stackoverflow.com/a/25289579

http://stackoverflow.com/a/25348486
score: 0
type: Answer
has body: I'm not entirely sure what you mean by translating every object. Every object should be translated anyway according to its position - meaning, each object has a defined x/y, and when you draw it you do something as follows: glPushMatrix() glTranslate(position.x, position.y); // Draw object glPopMatrix() Now, you want to make sure your camera is always centered at a certain position which moves. For example, let's say you're always centered at the player's position which can move around. glLoadIdentity() glTranslate(-playerPosition.x, -playerPosition.y); for each drawable object: if (isObjectWithinCamerasView(object)) // no need to draw objects outside of the viewport object.draw() The method isObjectWithCamerasView should check how far the object's position is from the player's position (since if it's too far, it will be outside of the camera and therefore there's no need to draw it). No need to alter the look-at matrix, all you need is one global translation before you individually translate each object according to its actual position.
answers question: http://stackoverflow.com/q/25344924

http://stackoverflow.com/a/25316753
score: 1
has body: Try this for( int i = 0; i &lt;= count; i++){ //System.out.print(r + space); spaceR += r + space; } The problem is that you are assigning spaceR each time in the loop, not appending. You show build your string in each loop iteration by adding a new r + space, not start from zero and only make one r + space. Anyway, use StringBuilder instead of String, and use its append method. EDIT: Please note if you start your loop at 0 and stop when is &lt;= count, you will have count + 1 elements. if you only want count elements, stop the loop condition with i &lt; count
type: Answer
answers question: http://stackoverflow.com/q/25316647
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25262264
has body: I'm trying to implement a RSS reader but i keep getting a RuntimeException. Here is my code of the .java file : public class TopRatedFragment extends Fragment { Context context; ListView listView; List<String> headlines; List<String> links; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false); context = getActivity().getApplicationContext(); listView = (ListView) rootView.findViewById(R.id.list); new RssFeed1().execute(); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int pos, long id) { Log.d("ListView", String.valueOf(pos)); Uri uri = Uri.parse((String) links.get(pos)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); return rootView; } private class RssFeed1 extends AsyncTask<Void, Void, List<String>> { @Override protected List<String> doInBackground(Void... params) { // Initializing instance variables headlines = new ArrayList<String>(); links = new ArrayList<String>(); try { URL url = new URL("http://feeds.pcworld.com/pcworld/latestnews"); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(false); XmlPullParser xpp = factory.newPullParser(); // We will get the XML from an input stream xpp.setInput(getInputStream(url), "UTF_8"); /* We will parse the XML content looking for the " " tag which appears inside the "<item>" tag. * However, we should take in consideration that the rss feed name also is enclosed in a " " tag. * As we know, every feed begins with these lines: "<channel> Feed_Name ...." * so we should skip the " " tag which is a child of "<channel>" tag, * and take in consideration only " " tag which is a child of "<item>" * * In order to achieve this, we will make use of a boolean variable. */ boolean insideItem = false; // Returns the type of current event: START_T…
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39362030
has comment: http://stackoverflow.com/comment/39390609
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/25499625
tagged with: rss
has comment: http://stackoverflow.com/comment/39362491
type: UnansweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39362091
has comment: http://stackoverflow.com/comment/39361728
upvote count: 1
has title: FATAL EXCEPTION: AsyncTask #1 while implementing RSS Reader
type: Question
has comment: http://stackoverflow.com/comment/39363044

http://stackoverflow.com/comment/39417423
comment on: http://stackoverflow.com/q/25292551
has text: Are you essentially asking whether there's some error check similar to the compiler's checking that's run at error time? If you edited in illegal code, you'd get an exception just as you would with something that wasn't caught by the compiler. Your question is broad and not exactly clear.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39524501
type: AnswerComment
has text: Thanks for you help. I want to vote but my vote has crossed maximum for the day. Thank you
score: 1
comment on: http://stackoverflow.com/a/25350394
type: Comment

http://stackoverflow.com/q/25363467
type: AnsweredQuestion
has title: Read property of an annotation in another
has comment: http://stackoverflow.com/comment/39550533
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25368405
has comment: http://stackoverflow.com/comment/39556123
has body: If I declare an attribute from my class this way: @Order(value=1) @Input(name="login") private String login; and the definition for @Input is this: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Input { String type() default "text"; String name(); String pattern() default ""; String tag() default "&lt;custom:Input ordem=''/&gt;"; } Is there any way to read the property value from @Order and use for the property tag from @Input?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25368405
tagged with: annotations
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25364689
favorite count: 0
has answer: http://stackoverflow.com/a/25364689

http://stackoverflow.com/q/25271501
tagged with: java
has title: Java application updating itself on Windows Vista and higher
tagged with: upgrade
answer count: 1
has comment: http://stackoverflow.com/comment/39383177
type: Question
tagged with: windows
accepted answer: http://stackoverflow.com/a/26725917
tagged with: updating
has answer: http://stackoverflow.com/a/26725917
has body: long time lurker and finally a member here. I have a java application that I am getting ready to release to the public for Windows/OSX/Linux but I am running into problems related to permissions on Windows Vista and higher. Basically the application installs to the standard c:\Program Files (configurable within the installer) which is great and my application data is stored in the users respective application data folder. Now here is the part I am struggling with. My application (like most) has the ability to check for updates and update itself. The update process performs the following steps; Download update Backup current application files (ones stored under c:\Program Files....) Unzip update over top of current application files Clean up (deletes update archive etc) Restart main application There in lies the problem. In order to allow the update process to change its own files, I need to grant the JAR with administrative privileges; this seems crazy. Is there no way to install a java application on these operating systems that are allowed to change their own files by default? Obviously not installing the application into the "Program Files" directory works perfectly fine - but most people install files into these directories (since that is their purpose). I've been trying to figure out a good solution to this problem for well over a week now but alas I keep coming up empty handed. I am hoping someone here who has experience deploying on these OS' can shed some light on the topic. Additional information: Application structure is an executable jar, with a lib folder of jars, an updater executable jar with a lib folder JWS is insufficient with my needs This is a problem only on Windows Vista and higher, Windows XP works great because it doesn't have the UAC mechanism Application prompts the user that an upgrade is available and what the upgrade contains. Maybe I am going about this all wrong? I cannot be the first one coming into this problem, there are millions of …
tagged with: deployment
has comment: http://stackoverflow.com/comment/39379154
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25280363
has comment: http://stackoverflow.com/comment/39395354
answer count: 0
has title: How to parse my log.txt in this format in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39395348
score: 0
has comment: http://stackoverflow.com/comment/39394903
tagged with: java
has body: I am trying to parse this certain log entry "[Zone] ZoneChangeList.ProcessChanges() - processing index=9 change=powerTask=[power=[type=TAG_CHANGE entity=[id=78 cardId=FP1_007t name=Nerubian] tag=IGNORE_DAMAGE_OFF value=1] complete=False] entity=[name=Nerubian id=78 zone=GRAVEYARD zonePos=1 cardId=FP1_007t player=2] srcZoneTag=INVALID srcPos= dstZoneTag=INVALID dstPos="; I am using a scanner delimiter in Java but the problem is that the change field which has multiple values enclosed in a bracket. I would also want to put the parsed record on a bean having their values So far, here is what I have coded: public class HearthstoneParser { public void zoneParser(String line) { Scanner scanner = new Scanner(line); scanner.useDelimiter(" "); while (scanner.hasNext()) { System.out.println(scanner.next()); } } public static void main(String args[]) { String zoneString = "[Zone] ZoneChangeList.ProcessChanges() - processing index=9 change=powerTask=[power=[type=TAG_CHANGE entity=[id=78 cardId=FP1_007t name=Nerubian] tag=IGNORE_DAMAGE_OFF value=1] complete=False] entity=[name=Nerubian id=78 zone=GRAVEYARD zonePos=1 cardId=FP1_007t player=2] srcZoneTag=INVALID srcPos= dstZoneTag=INVALID dstPos="; HearthstoneParser parser = new HearthstoneParser(); parser.zoneParser(zoneString); } } I would want to keep them organized that they are group with their brackets respectively sample output would be: Zone event = ZoneChangeList.ProcessChanges() index = 9 change powerTask power type = TAG_CHANGE entity id = 78 cardID=Fp1_007t name Nerubian tag=IGNORE_DAMAGE_OFF value=1 complete=False entity name=nerubian id=78 zone=GRAVEYARD zonePos=1 cardId=FP1_007t player=2 srcZoneTag=INVALID srcPos= dstZoneTag=INVALID dstPos=
type: Question

http://stackoverflow.com/comment/39427124
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25297323
score: 0
has text: Thanks but I don't want return strings in method. But thanks for idea

http://stackoverflow.com/comment/39524416
comment on: http://stackoverflow.com/a/25261838
type: AnswerComment
has text: On your ResourceTestRule builder call `.addProvider(new BasicAuthProvider<User>(new PocAuthenticator(), "Auth-Provider for tests"))`. See this project on github for example: https://github.com/phxql/dropwizard-itest-authentication
score: 0
type: Comment

http://stackoverflow.com/q/25252374
tagged with: spring
tagged with: spring-java-config
type: AnsweredQuestion
score: 8
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25260336
type: Question
has title: Overriding beans in Java-based spring configuration hierarchy
has body: Let's assume we have an application that can be customized for some customers. The application is using Java-based spring configuration (a.k.a. Java config) for dependency injection. The application consists of modules and their submodules. Each module and submodule has its own @Configuration class which is imported by parent configuration using @Import. This creates the following hierarchy: MainConfig ----------+---------------- .... | | ModuleAConfig ModuleBConfig |--------------------| | | SubModuleA1Config SubModuleA2Config For example ModuleAConfig looks like this: @Configuration @Import({SubModuleA1Config.class, SubModuleA2Config.class}) public class ModuleAConfig { // some module level beans } Let's say that SubModuleA1Config defines bean someBean of type SomeBean: @Configuration public class SubModuleA1Config { @Bean public SomeBean someBean() { return new SomeBean(); } } Now I want to customize the application for Customer1 (C1) - I want to use C1SomeBean (extending SomeBean) instead of SomeBean as someBean. How can I achieve this with minimum duplication? One of my ideas was to prepare alternative hierarchy with C1Config inheriting from MainConfig, C1ModuleAConfig from ModuleAConfig and C1SubModuleA1Config from SubModuleA1Config. C1SubModuleA1Config would override someBean() method returning C1SomeBean. Unfortunately with Spring 4.0.6 I get something like: Overriding bean definition for bean 'someBean': replacing [someBean defined in class C1SubmoduleA1Config] with [someBean defined in class SubModuleA1Config] and indeed SomeBean class is returned from context instead of C1SomeBean. This is clearly not what I want.
upvote count: 8
tagged with: java
accepted answer: http://stackoverflow.com/a/25260336

http://stackoverflow.com/comment/39399592
type: Comment
has text: While this might work, it is very inefficient
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25283005

http://stackoverflow.com/comment/39341230
score: 0
type: Comment
type: QuestionComment
has text: This link will likely help: http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java
comment on: http://stackoverflow.com/q/25251083

http://stackoverflow.com/q/25348761
accepted answer: http://stackoverflow.com/a/25348835
type: AnsweredQuestion
has title: Clone project with eclipse?
has answer: http://stackoverflow.com/a/25348835
answer count: 3
tagged with: java
tagged with: eclipse
upvote count: 29
type: Question
has answer: http://stackoverflow.com/a/59299897
has answer: http://stackoverflow.com/a/25348845
downvote count: 0
has body: I'm learning JAVA with Eclipse (ADT , Latest version - For Android development). Each lesson we enhance the same project. (I don't like this approach) So - I want to create different project for each lesson so : Each lesson I'm cloning the main folder - and then I import it as an existing project. ( I thought that cloning + renaming the folder - would be fine) But : Eclipse says that the project already exists. (make sense) Question If I have a folder that contains a project ( LeadoMat) : , And I'm creating folder LeadoMat_Ver2 ( cloned files) — How/What should I do in order for eclipse to accept it as a new project named : LeadoMat_Ver2 ?
favorite count: 0
possible better answer: http://stackoverflow.com/a/25348845
score: 29

http://stackoverflow.com/q/25238260
tagged with: java
tagged with: jdbc
linked to: http://stackoverflow.com/q/8652336
has comment: http://stackoverflow.com/comment/39317935
has body: What are the resources consumed by a left-open result set / statement if a statement is created before each query? Are result sets / statements closed by the garbage collection in this case?
type: UnansweredQuestion
score: 1
answer count: 1
downvote count: 0
upvote count: 1
has title: What happens if the statements / result sets are not closed?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25238312

http://stackoverflow.com/q/25340032
answer count: 2
has title: java StreamCorruptedException: invalid type code: 77040000, what the ObjectInputStream expects?
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
tagged with: serialization
has answer: http://stackoverflow.com/a/25340128
has body: i'm working on a network java code, and i can't seem to understand what are the prerequisites an ObjectInputStream needs to interpret bytes. Here is a part of the code : InputStream is = /* creation of the stream */ ObjectInputStream in = new ObjectInputStream(is); System.out.println(in.readInt()); // the exception is thrown here exception and stack trace : java.io.StreamCorruptedException: invalid type code: 77040000 at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.refill(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.read(Unknown Source) at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) sending code : OutputStream os = /* creation of output stream */ out = new ObjectOutputStream(os); out.writeInt(1); out.flush(); now the interesting part, when i replace "in.readInt()" with a manual reading of "is", when i pring the bytes i got : -84 -19 0 5 119 4 0 0 0 1 i googled serialization protocols and it seems to mean : "-84 -19" -> serialization protocol magic numbers "0 5" -> version "119" -> type of data (TC_BLOCKDATA) "0 0 0 1" -> my integer = 1 so, the invalid type code "77040000" is the hexadecimal for the "119 4 0 0" part. at this point, i don't know where to search, the ObjectInputStream seems to not be able to understand the protocol. the input stream is custom, here is part of its code: @Override public int read() throws IOException { byte[] bytes = new byte[4]; if(read(bytes, 0, 4) != 4) return -1; else return bytes[0] &lt;&lt; 24 | (bytes[1] &amp; 0xFF) &lt;&lt; 16 | (bytes[2] &amp; 0xFF) &lt;&lt; 8 | (bytes[3] &amp; 0xFF); } @Override public int read(byte[] b) throws IOException { return read(b, 0, available()); } @Override public int read(byte[] b, int off, int len) throws IOException{ int i; for(i = 0; i &lt; len; i++){ if(!isReady()…
has answer: http://stackoverflow.com/a/25340046
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39506757
score: 0

http://stackoverflow.com/a/25255218
answers question: http://stackoverflow.com/q/25251876
type: AcceptedAnswer
downvote count: 0
has body: I've always found using the android:onClick property in layout files to make the code difficult to navigate. The reason behind your code not working is likely due to @Lena Bru's answer (The method needs to be in the activity). I would recommend you do the following: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // ... Button b = (Button) rootView.findViewById(R.id.button1); b.setOnClickListener(mButtonClickListener); return rootView; } private OnClickListener mButtonClickListener = new OnClickListener() { public void onClick(View v) { addTaskNow(); } } Then remove the android:onClick property from fragment_tasks.xml. In response to your previous comment, you would have had an activity implement onClick, and specified in the xml file to point to onClick. In general I find it's usually better to avoid having your fragments/activities implementing your click listeners, because it causes confusion when there are multiple buttons. Additionally, to avoid a NullPointerException in addTaskNow, you need to change a couple things. You are calling v.findViewById(R.id.editText1), which is going to return null. This is because findViewById can only return views which are contained inside that view. The view you are passing into addTaskNow is going to be the button, not your root view, which contains the R.id.editText1. To resolve this, your best option is to make the an EditText member variable in your fragment, and initialize it in onCreateView with R.id.editText1, like you do with your button. As a result, you no longer need a View as a parameter of addTaskNow.
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39414892
accepted answer of: http://stackoverflow.com/q/25251876
has comment: http://stackoverflow.com/comment/39414064
score: 5

http://stackoverflow.com/a/25371557
downvote count: 0
upvote count: 2
has body: Is normal this behavior mappedBy indicates only that the entity in this side is the inverse of the relationship, and the owner resides in the "other" entity. I suggest you this link
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25371481

http://stackoverflow.com/q/25316903
has comment: http://stackoverflow.com/comment/39463219
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39463070
tagged with: button
has answer: http://stackoverflow.com/a/25317020
accepted answer: http://stackoverflow.com/a/25317020
has body: I have a list of buttons, b1, b2, etc.. each of which has an onclick method that adds a number to an arraylist. I thought that adding the line while(myArrayList.size()&lt;2){} Would make the program wait until two buttons were clicked, but instead the screen turns black. Why does this happen, and how can I fix it?
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39463088
has comment: http://stackoverflow.com/comment/39463003
tagged with: android
possible better answer: http://stackoverflow.com/a/25317193
has title: How can I make the android program wait until two buttons are pressed?
has answer: http://stackoverflow.com/a/25317193

http://stackoverflow.com/q/25351168
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/25352110
accepted answer: http://stackoverflow.com/a/25352110
has comment: http://stackoverflow.com/comment/39526140
has answer: http://stackoverflow.com/a/25353457
has title: Concurrently zipping and download file performance issues
has comment: http://stackoverflow.com/comment/39526615
type: AnsweredQuestion
score: 0
tagged with: performance
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25353848
tagged with: servlets
has answer: http://stackoverflow.com/a/25353848
has body: I have a servlet that compresses file while its downloading. My problem slow process is really slow. I'm zipping files coz files will be more than 1GB. But downloading process is so slow. What kind of betterment would you suggest me? package mainpackage; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class DownloadZipServlet extends HttpServlet { private static final long serialVersionUID = 1L; public DownloadZipServlet() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/zip"); response.setHeader("Content-Disposition", "attachment;filename=download.zip"); ServletOutputStream sos; ZipOutputStream zos; InputStream fis; List&lt;File&gt; filesToDownload = new ArrayList&lt;File&gt;(); filesToDownload.add(new File(getDirectory(), "download.png")); filesToDownload.add(new File(getDirectory(), "downloadpdf.pdf")); sos = response.getOutputStream(); zos = new ZipOutputStream(sos); for (File fileToSend : filesToDownload) { ZipEntry ze = new ZipEntry(fileToSend.getName()); zos.putNextEntry(ze); fis = new BufferedInputStream(new FileInputStream(fileToSend)); byte[] buffer = new byte[131072*100]; int readBytesCount = 0; while ((readBytesCount = fis.read(buffer)) &gt;= 0) { zos.write(buffer, 0, readBytesCount); } fis.close(); sos.flush(); zos.flush(); zos.closeEntry(); } zos.close(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) thr…
type: Question

deserialization
type: Tag
tags question: http://stackoverflow.com/q/25387978
tags question: http://stackoverflow.com/q/25331596
tags question: http://stackoverflow.com/q/25388164
tags question: http://stackoverflow.com/q/25383482
tags question: http://stackoverflow.com/q/25365935
tags question: http://stackoverflow.com/q/25271605
tags question: http://stackoverflow.com/q/25307994
tags question: http://stackoverflow.com/q/25381791
tag name: deserialization
tags question: http://stackoverflow.com/q/25279068

http://stackoverflow.com/comment/39561272
comment on: http://stackoverflow.com/q/25370121
has text: I just added it to a folder called java. When I took it from that folder and put it in the root it still doesn't work. Or isn't that what you mean?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/25237586
has body: I'm assuming that this is a compiler error and not runtime. If that assumption is correct then I'd say the problem is that the variable word is not defined in the scope of that method. Although there are many possible solutions, moving the declaration of word to the class would be simplest.
type: Answer
has comment: http://stackoverflow.com/comment/39315959
answers question: http://stackoverflow.com/q/25237366
score: 0

http://stackoverflow.com/comment/39569046
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25374246
type: Comment
has text: It is not required that the method be static, so long as there is an instance of Person available to access it.

http://stackoverflow.com/comment/52448642
type: Comment
has text: Please format your post by using backticks(the key next to 1 on your keyboard) to surround any code like so `\`code\`` and separate your text into paragraphs to make your text more readable.
type: AnswerComment
comment on: http://stackoverflow.com/a/32285339
score: 0

http://stackoverflow.com/q/25327698
tagged with: jackson
has comment: http://stackoverflow.com/comment/39483723
possible better answer: http://stackoverflow.com/a/25327768
type: AnsweredQuestion
has title: Jackson does not recognize properties
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25347643
has comment: http://stackoverflow.com/comment/39512298
has answer: http://stackoverflow.com/a/25327768
has comment: http://stackoverflow.com/comment/39483300
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39483619
accepted answer: http://stackoverflow.com/a/25347643
has body: Im trying to send request to my service method OperationResult makeOperation( @WebParam(name = "ident") @PathParam("ident") String ident, @WebParam(name = "templateId") @PathParam("templateId") Long templateId, @WebParam(name = "paySystemId") @QueryParam("paySystemId") Integer paySystemId, @WebParam(name = "currency") @QueryParam("currency") Integer currency, @WebParam(name = "payAmount") @QueryParam("payAmount") Long payAmount, @WebParam(name = "payerPhoneNumber") @QueryParam("payerPhoneNumber") String payerPhoneNumber, @WebParam(name = "additionalParameters") AdditionalParameters parameters) throws FailureException; When I create body and put json like {"paySystemId":12312} I see exception: Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "paySystemId" (class com.fib.paynet.classes.TemplateParameters), not marked as ignorable I cannot understand why jackson dont like this my request body...
has comment: http://stackoverflow.com/comment/39485406

http://stackoverflow.com/comment/39341022
comment on: http://stackoverflow.com/q/25250971
type: Comment
type: QuestionComment
score: 0
has text: @BackSlash that's a generic Q/A for `NullPointerException`. This case is a rather specific problem, IMO the API should throw an `IOException` for not finding the file at `getClass().getClassLoader().getResourceAsStream`.

http://stackoverflow.com/a/25367231
answers question: http://stackoverflow.com/q/25366924
has comment: http://stackoverflow.com/comment/39587040
has comment: http://stackoverflow.com/comment/39588559
has body: Trying below code this might work. public static void main(String[] args) throws JSONException { JSONObject obj = null; JSONArray cellArray = new JSONArray(); JSONArray cellArray1 = new JSONArray(); for (int i = 0; i &lt; 2; i++) { obj = new JSONObject(); obj.put("id", i); obj.put("cell", "contecnt 1, content 2, content 3"); cellArray.put(obj); } JSONObject responseData = new org.json.JSONObject(); responseData.put("rows", cellArray); // System.out.println(responseData); JSONObject obj1 = new JSONObject(); obj1.put("stat", "ok"); obj1.put("total", "100"); obj1.put("page", 1); obj1.put("rows", responseData); cellArray1.put(obj1); JSONObject response = new org.json.JSONObject(); response.put("data", cellArray1); System.out.println(response); } Output: {"data":[{"total":"100","page":1,"stat":"ok", "rows": {"rows":[ {"id":0, "cell":"contecnt 1, content 2, content 3"}, {"id":1, "cell":"contecnt 1, content 2, content 3"} ]} }]}
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39561512
has comment: http://stackoverflow.com/comment/39561928
accepted answer of: http://stackoverflow.com/q/25366924
score: 0
has comment: http://stackoverflow.com/comment/39587335
has comment: http://stackoverflow.com/comment/39574273
has comment: http://stackoverflow.com/comment/39587810
type: Answer

http://stackoverflow.com/a/25239022
answers question: http://stackoverflow.com/q/25238573
score: 1
type: Answer
downvote count: 0
has body: Your problem is that it returns a null value. @Bean @Qualifier("stagingDocumentRepository") public StagingDocumentRepository stagingDocumentRepository() { return new StagingDocumentRepository(..); }
upvote count: 1

http://stackoverflow.com/comment/39313933
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25236563
score: 0
has text: Okay mate. Give me a minute

http://stackoverflow.com/comment/39401266
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25272705
has text: By the way, regardless of concurrency and regardless of what `…` actually contains, code like `bool = …? true: false;` smells. Just write `bool = …;`. Adding `? true: false` after an expression is usually a sign that the programmer has missed the fundamental point of the `boolean` type: it doesn’t need to be converted to `true` or `false`, it always is either of them.
score: 0

http://stackoverflow.com/comment/39533626
score: 0
has text: have you tried [google your question](https://www.google.com/#q=java+get+a+list+of+computers+on+a+network)?
type: Comment
comment on: http://stackoverflow.com/q/25355696
type: QuestionComment

http://stackoverflow.com/q/25383122
has answer: http://stackoverflow.com/a/25383342
has comment: http://stackoverflow.com/comment/39585075
has title: unable to parse extra symbol in JAXB
type: UnansweredQuestion
has body: Using JAXB Marshalling and Unmarshalling in java, I am not able parse the symbol which is appearing before the "This end use consumption" text in image. getting following error. Generic Exception being handled : Fatal error: PCDATA invalid Char value 20 at :11. I want skip this kind of symbols, How I can do that using JAXB. Please help.
tagged with: spring
tagged with: jaxb2
answer count: 2
has comment: http://stackoverflow.com/comment/39585123
score: 1
tagged with: java
downvote count: 0
upvote count: 1
tagged with: jaxb
has answer: http://stackoverflow.com/a/25390793
favorite count: 0
type: Question

http://stackoverflow.com/comment/39448163
type: QuestionComment
has text: I also asked the same question on JBoss Community's forum: https://community.jboss.org/message/884512
type: Comment
comment on: http://stackoverflow.com/q/25308636
score: 0

http://stackoverflow.com/q/25247340
has comment: http://stackoverflow.com/comment/39334327
answer count: 0
has comment: http://stackoverflow.com/comment/39334722
type: UnansweredQuestion
tagged with: multithreading
downvote count: 0
has comment: http://stackoverflow.com/comment/39334158
upvote count: 1
linked to: http://stackoverflow.com/q/6676035
favorite count: 0
type: Question
has body: What Would happen if we interrupt a thread by making it's object reference equal to null does the thread stack vanish or it still completes its whole processing and safely exists from the run method There real scenario is 1. Read a file (validate file check for duplicate) 2. Convert the file data to java Beans 3. validate the beans(check for duplicate in the database) 4. insert the bean in the database(Batch of size 100 is added on by one) There are about 1000 Similar Batch for a single file to be added to The Database and all this processing is done in a single task i cannot set a flag of use interrupt because to check flag or interrupt it has to be in while loop in that case the step 1-4 are performed repeatedly but the step 4 is the last then it should exit from run if i have to manually stop the thread i want that if interrupt the thread the processing should stop in any of the above step if the 600th chunk is added to the database and interrupt in called for the thread 601 should not be added to database
has comment: http://stackoverflow.com/comment/39334032
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/6676035
has comment: http://stackoverflow.com/comment/39334652
has comment: http://stackoverflow.com/comment/39338609
has comment: http://stackoverflow.com/comment/39333922
has comment: http://stackoverflow.com/comment/39333915
has title: What happen if we want to interrupt the thread by setting the current by substituting equal to null

http://stackoverflow.com/comment/39497018
type: Comment
has text: I'm not clear, do you want a unit test for saveToDb method itself or for something else?
type: QuestionComment
comment on: http://stackoverflow.com/q/25324636
score: 0

http://stackoverflow.com/comment/39399600
score: 0
type: Comment
type: QuestionComment
has text: Looks like a memory leak. check JVM logs for out of memory exception. Are you using a virtualizer?
comment on: http://stackoverflow.com/q/25278775

http://stackoverflow.com/q/25252127
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39343855
answer count: 1
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/39343647
has comment: http://stackoverflow.com/comment/39343987
tagged with: swing
has answer: http://stackoverflow.com/a/25253453
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/39343382
type: Question
has title: Java rotating non-square JPanel component
has comment: http://stackoverflow.com/comment/39343626
has comment: http://stackoverflow.com/comment/39344323
has comment: http://stackoverflow.com/comment/39344144
tagged with: java
has comment: http://stackoverflow.com/comment/39343674
has comment: http://stackoverflow.com/comment/39343546
has comment: http://stackoverflow.com/comment/39343948
has body: I am attempting to rotate a GridLayout filled with text labels to simulate a portrait orientation view due to an OS restriction. The JPanel they are inside of is not square, so when rotating 90 degrees the labels cut off based on dimensions of the JPanel. Is it possible to resize the layout based on the rotation to still fit within the JPanel? Researching into this showed many options for rotations, but only for square JPanels. To further explain my problem: when I rotate the labels painted inside they stay formatted to the normal oriented x,y, and I want it to format the layout to fit into the 90 degree rotated x,y (so basically y and x are flipped). currently a portion of my grid is cut off after rotating. Also the final display should fit all 13 by 24 letters filled in the current JPnel. edit: Using vague comments shows I need to paint after rotating, but doing so crops the grid and does not fill back to my preferred size. JPanel code: import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JPanel; public class Screen extends JPanel { private JLabel[][] labels = new JLabel[13][24]; private GridLayout layout; public Screen() { //setLocation(315,35); layout = new GridLayout(13, 24); layout.preferredLayoutSize(this); //setBounds(315, 65, 243, 350); setBounds(315, 65, 243, 350); setLayout(layout); for (int i = 0; i &lt; 13; i++) { for (int j = 0; j &lt; 24; j++) { labels[i][j] = new JLabel(); labels[i][j].setBackground(Color.BLACK); add(labels[i][j]); } } //testing new letter for (int i = 0; i &lt; 13; i++) { for (int j = 0; j &lt; 24; j++) { labels[i][j].setText("T"); labels[i][j].setForeground(Color.GREEN); } } setBackground(Color.black); setVisible(true); repaint(); } @Override public void paintComponent(Graphics g) { //Rotates screen graphics to correct orientation Graphics2D g2d = (Graphics2D) g; int w2 = getWidth() / 2; int h2 = getHeight() / 2; g2d.rotate(Math.PI / 2…
has comment: http://stackoverflow.com/comment/39344437
has comment: http://stackoverflow.com/comment/39343515
has comment: http://stackoverflow.com/comment/39343891
score: 2
linked to: http://stackoverflow.com/q/4156518
has comment: http://stackoverflow.com/comment/39344061
linked to: http://stackoverflow.com/q/14324460
tagged with: rotation
has comment: http://stackoverflow.com/comment/39344004

http://stackoverflow.com/comment/39358358
score: 0
type: Comment
type: QuestionComment
has text: @vagg77 The OP wants to inherit from multiple *classes* which is not possible in Java.
comment on: http://stackoverflow.com/q/25260546

http://stackoverflow.com/comment/39412888
comment on: http://stackoverflow.com/q/25290036
score: 4
has text: Choose another data structure to store your strings. For example, a `Map<Character, List<String>>` where the key is a letter for the abecedarium and the `List<String>` contains a sorted list of the words that starts with the character used as key. Or use a [trie](http://en.wikipedia.org/wiki/Trie).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25322732
has body: Your Element class does not implement equals. Because of they use the Object.equals() method which only tests if it is the exact same object. (i.e. that it is == ). If you implement equals it is good practice to also implement hashCode so that equal objects will hash into the same bucket in hash data structures like Map. Here is your Element which will not have this problem: public class Element { private String element; public Element() { } public Element(String element) { setE(element); } public String getElement() { return element; } public void setElement(String element) { this.element = element; } public boolean equals(Object other) { if (other instanceof Element) { Element otherElement = (Element) other; if (null == element) { return otherElement.element == null; } return element.equals(otherElement.element); } return false; } public int hashCode() { if (null == element) { return -7; } return element.hashCode(); } } Note that we have to be careful about cases where element is null because you are not ensuring that element has a sane value. A "better" element class could avoid this if appropriate by only providing a constructor which takes a String and throwing an IllegalArgumentException if the string passed into the constructor is null, or if the setElement call takes a null value. Like so: public class Element { private String element; public Element(String element) { setElement(element); } public String getElement() { return element; } public void setElement(String element) { if (null == element) { throw new IllegalArgumentException("Element must not be null."); } this.element = element; } public boolean equals(Object other) { if (other instanceof Element) { Element otherElement = (Element) other; return element.equals(otherElement.element); } return false; } public int hashCode() { return element.hashCode(); } } Finally, note that null == element is better to write than element == null since you can easily forget an equal sign and end up assigning null to …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25322556
type: Answer
answers question: http://stackoverflow.com/q/25322556
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/25267384
score: -1
upvote count: 0
has body: I'm trying to make a launcher. It works fine, except that when I press the 'Options' button it makes a little window in the corner. How do I prevent this? The Launcher picture: (source: gyazo.com) And now with the option frame running: (source: gyazo.com) You can see the little window in the corner. It does not disappear when the Option frame does. The Main File: package ca.sidez.Launcher; import javax.swing.*; import javax.swing.border.EmptyBorder; import ca.sidez.Main.Game; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; public class Main { private Game ga; public static int game = 0; public static int isUpdate = 0; public static int BigVersion = 00; public static String Version = "04"; public static String Potenic_Version = "1.6a"; public static String DirtLife_Version = "0.1"; public static int lang = 0; private static void createWindow() { Font font; Font font2; final JFrame frame = new JFrame("Nic Launcher " + Version); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(820, 640); frame.setLocationRelativeTo(null); frame.setLayout(null); frame.setResizable(false); JEditorPane jep = new JEditorPane(); jep.setEditable(false); font = new Font("Times New Roman", Font.PLAIN, 28); font2 = new Font("Arial", Font.BOLD, 14); jep.setContentType("text/html"); jep.setText(" Loading... "); jep.setBorder(new EmptyBorder(0, 0, 0, 0)); try { jep.setPage("http://potenic.tumblr.com/"); } catch(IOException e) { jep.setContentType("text/html"); jep.setText(" Could not load, Check Your Connection "); } JScrollPane scrollPane = new JScrollPane(jep); scrollPane.setBackground(Color.BLACK); scrollPane.setSize(640, 480); scrollPane.setLocation(0, 0); scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0)); final JRadioButton potenic = new JRadioButton("Potenic: " + Potenic_Version); final JRadioButton Launcher = new JRadioButton("Launcher"); potenic.setBounds(675, 150, 200, 55); Launcher.setBounds(675, 1…
tagged with: java
answer count: 1
tagged with: swing
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25268122
has title: Eclipse Why Does It Create An Extra Window
type: UnansweredQuestion

http://stackoverflow.com/q/25249280
type: Question
has title: How to run a Lucene 4.9 IndexFiles?
type: UnansweredQuestion
tagged with: lucene
score: 0
has body: I am a Lucene newbie and I am trying to run Lucene 4.9 indexFiles on Eclipse but I got the following error for the line IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_4_9, analyzer); of the IndexFiles.java class from org.apache.lucene.demo. at org.apache.lucene.index.LiveIndexWriterConfig.&lt;init&gt;(LiveIndexWriterConfig.java:125) at org.apache.lucene.index.IndexWriterConfig.&lt;init&gt;(IndexWriterConfig.java:171) at org.apache.lucene.demo.IndexFiles.main(IndexFiles.java:92)Caused by: java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene49' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: [SimpleText, Appending, Lucene40, Lucene3x] at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109) at org.apache.lucene.codecs.Codec.forName(Codec.java:95) at org.apache.lucene.codecs.Codec.&lt;clinit&gt;(Codec.java:122) ... 3 more
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25257158
tagged with: eclipse

http://stackoverflow.com/comment/39536302
type: QuestionComment
comment on: http://stackoverflow.com/q/25357165
type: Comment
score: 0
has text: @NESPowerGlove i meant u can get the jFrame object via this.getFrame()

http://stackoverflow.com/comment/39362163
has text: When I assume correctly, that you need a pair of vectors to calculate their distance, you may not use reduce directly, because it works on each element, but you could calculate a list of distances and then reduce this list to a single result.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25262580
score: 1

http://stackoverflow.com/q/25357967
accepted answer: http://stackoverflow.com/a/25608213
tagged with: colors
tagged with: android
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39537835
has answer: http://stackoverflow.com/a/25358260
answer count: 4
has comment: http://stackoverflow.com/comment/39537687
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: In my project, all Spinner fonts suddenly became white for a reason I can't find. Before all of them were black. For example, in a spinner, the dropdown list comes all in white. It's XML file is as follows; &lt;Spinner android:id="@+id/mainactivity_spinner_city" android:fontFamily="Roboto" android:layout_width="250dp" android:layout_height="wrap_content" android:layout_below="@+id/mainactivity_imageview_logo" android:layout_marginTop="15dp" /&gt; In order to make sure, I added #000000 to all related places, but the list is still white. The spinner gets populated with the following method; ArrayAdapter&lt;String&gt; dataAdapter2 = new ArrayAdapter&lt;String&gt;(context, android.R.layout.simple_spinner_item, list); dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter2); So I added black color to simple_spinner_item and simple_spinner_dropdown_item as well but still no change. In Java part, I do not do anything related to color. What may be causing all these texts being white? Edit: Only spinners have problem. I can change other elemens' text colors. But I can't change spinners even though I inserted textColor:"#000000" to anywhere related with spinners.
possible better answer: http://stackoverflow.com/a/25358066
score: 5
has answer: http://stackoverflow.com/a/25358066
has comment: http://stackoverflow.com/comment/39537711
has comment: http://stackoverflow.com/comment/39542284
has answer: http://stackoverflow.com/a/25608213
downvote count: 0
has comment: http://stackoverflow.com/comment/39537725
linked to: http://stackoverflow.com/q/2118251
has title: Android Eclipse all Spinner fonts became white
has comment: http://stackoverflow.com/comment/39537746
favorite count: 0
has answer: http://stackoverflow.com/a/25358091
type: AnsweredQuestion

http://stackoverflow.com/a/25344794
upvote count: 1
has body: Probably the most significant term for you're searching for is: Role. An interface describes a Role. That's why a lot of interfaces has the suffix "able": Cloneable, Serializable, Runnable etc. It's like assigning one or several roles.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25324076
has comment: http://stackoverflow.com/comment/39514714
has comment: http://stackoverflow.com/comment/39514683
has comment: http://stackoverflow.com/comment/39514737
has comment: http://stackoverflow.com/comment/39514603
downvote count: 0

system
tag name: system
tags question: http://stackoverflow.com/q/25388990
type: Tag
tags question: http://stackoverflow.com/q/25354756

http://stackoverflow.com/comment/39473569
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25321200
has text: I have shared what you want,please help me
type: Comment

http://stackoverflow.com/comment/39471485
comment on: http://stackoverflow.com/a/25314492
has text: replace the string in the sample code. Here is [DEMO](http://regex101.com/r/sV9nA8/2) You might forget to use `i` modifier for case-insensitive. Test it in code and use `while(matcher.find())` to match all.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39387392
type: Comment
type: QuestionComment
has text: Don't use JPA sequencing. Sequencing is used to make a1 unique, which you apparently do not want, since you want to reuse a1 values in different combinations of a2 and a3. So remove it, and assign your own values to a1. That, or use JPA sequencing and don't bother using a composite pK. There is no need to have the two other fields if you have a unique a1 field to use as the pk - it makes everything much more simple and efficient.
comment on: http://stackoverflow.com/q/25267432
score: 1

maven-archetype
tags question: http://stackoverflow.com/q/25239673
type: Tag
tags question: http://stackoverflow.com/q/25385352
tag name: maven-archetype

http://stackoverflow.com/comment/39544793
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25355551
type: QuestionComment
has text: @AndrewThompson: It's also an example of inadequate maintenance, as suggested [here](http://stackoverflow.com/a/12130829/230513).

http://stackoverflow.com/a/25384066
downvote count: 0
has comment: http://stackoverflow.com/comment/39670163
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25383945
has body: You should read about synchronization. Without synchronization you risk getting visibility errors where one thread can't see changes another thread made to a variable shared between the threads. Tutorial: http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html You can use a synchronized block that uses an object both threads know about to do locking. If both threads always synchronize on that known object when reading or updating your shared data, then visibility and atomicity will never be an issue. Read here to fully understand "synchronized": http://tutorials.jenkov.com/java-concurrency/synchronized.html You should also be able to just declare the shared variable as volatile. This means all writes and reads on it create a happens-before relationship with other threads, which is what you want. Read the tutorial above to fully understand the issues and terminology. Read here to fully understand "volatile": http://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html.
has comment: http://stackoverflow.com/comment/39587727
score: 1
accepted answer of: http://stackoverflow.com/q/25383945
type: Answer
has comment: http://stackoverflow.com/comment/39587375
has comment: http://stackoverflow.com/comment/39587827

http://stackoverflow.com/comment/39324518
score: 0
comment on: http://stackoverflow.com/a/25236837
type: Comment
type: AnswerComment
has text: When I used Serial Blob and prepared statement I got 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 'Image``='javax.sql.rowset.serial.SerialBlob@1c58478b' where `PeopleId = '8a8887d' at line 1

http://stackoverflow.com/comment/39429218
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25286931
type: QuestionComment
has text: I clarified the title. Seems there was a mix-up. Sorry about that.

http://stackoverflow.com/comment/39364977
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25246138
type: Comment
has text: Now it works as charm:) sorry, I'm new to lambda. I know it's more than useful, so I'm doing my best to use it, but it's still bit to hard to read it sometimes :) thank you

http://stackoverflow.com/comment/69311867
has text: Why not consider using database table partitions instead? Databases which offer partitioning basically store the table across different files, often different disks, allowing for increased read/write performance while the users of the database still see it as a single contiguous table.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25241180
type: Comment

http://stackoverflow.com/comment/39371874
score: 0
has text: here's what my error is. Ok, noted. I am also trying to debug now.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25246552

http://stackoverflow.com/q/25373220
upvote count: 0
has comment: http://stackoverflow.com/comment/39567062
score: -4
has comment: http://stackoverflow.com/comment/39567147
has comment: http://stackoverflow.com/comment/39567033
favorite count: 0
has answer: http://stackoverflow.com/a/25373288
accepted answer: http://stackoverflow.com/a/25373288
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25373335
possible better answer: http://stackoverflow.com/a/25373335
has title: Regex (java) - extracting from payload
has body: 000klkj1-041-3501-0071-00000kjhh05601 56hj1 66553 78 546623 payload follows same structure every time and I'm trying to find numerical values that reside after 3 spaces (or 3 whitespaces?) (in this case "78"). the number(s) (1 or 2 numbers at most) will always be after 3 spaces; this is the only commonality between multiple payloads. other than \d+, I have nothing so far. any/all help is greatly appreciated.
tagged with: java
tagged with: regex
type: Question
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/39567068

http://stackoverflow.com/a/25251169
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25248494
accepted answer of: http://stackoverflow.com/q/25248494
has body: The problem was that my parent pom was dependent on Spring 3.2.5. And I find out that Spring-Boot 1.5.x needs at least Spring 4. This is not clearly defined on the Spring-Boot page.
type: Answer
has comment: http://stackoverflow.com/comment/99483919

http://stackoverflow.com/q/25291980
has title: is not closing the connection to the DB harmful
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/25292087
tagged with: connection
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/25249224
type: UnansweredQuestion
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/25249224
upvote count: 1
has body: a question just came to my mind when I noticed that I didn't close the connection to the database in many classes of my java application. I wonder if this can affect my entire OS as the time goes by. Thanks in advance.
downvote count: 1

http://stackoverflow.com/comment/39390609
comment on: http://stackoverflow.com/q/25262264
has text: I resolved the issue, it was my firewall that was not allowing to open connection on this line url.openConnection().getInputStream(); the app ran perfectly well on the actual device. Thanks everyone for your help.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39318368
has text: @user3827788 I'd like to understand why you have the variable `userActivitySelectionName` and where you initialize it. It would be appropriate to do what is needed when its value is null. It will be purely based on your context.
comment on: http://stackoverflow.com/a/25237241
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39458490
has text: You're right, that comment that you quoted has really changed the question into something completely different.
type: AnswerComment
comment on: http://stackoverflow.com/a/25314520
type: Comment
score: 2

http://stackoverflow.com/comment/39485475
comment on: http://stackoverflow.com/a/25321717
score: 0
type: AnswerComment
has text: thank you very much, a complete Answer. thanks again!
type: Comment

http://stackoverflow.com/comment/39341318
type: AnswerComment
comment on: http://stackoverflow.com/a/25231028
type: Comment
has text: I was just wondering how would I use the LinkedHashSet as a stack. So basically LIFO. In the code you presented, its FIFO.
score: 0

http://stackoverflow.com/q/25347073
tagged with: date
score: 4
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/25348419
has answer: http://stackoverflow.com/a/25929680
tagged with: java
downvote count: 2
has title: how can I change month only in java date object?
has answer: http://stackoverflow.com/a/25347089
has body: I have java date object. How can I change its month without changing the year. e.g. 12/1/14 I want to change it to 12/3/14 and to 12/10/14 I basically want to change the month by +/- x month without changing the year. Can it be done?
tagged with: calendar
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39518399
has comment: http://stackoverflow.com/comment/118035617
has answer: http://stackoverflow.com/a/25347096
tagged with: time
type: UnansweredQuestion

http://stackoverflow.com/q/25260651
tagged with: java
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/18497458
score: 1
upvote count: 1
has title: Calculating Area, Length and Width of a Rectangle - Java
favorite count: 0
has answer: http://stackoverflow.com/a/25260838
type: Question
has body: I know there was a similar thread: Calculating perimeter and area of a rectangle but I still do not know what to do. public class Rectangle { double length, height, rectArea; // assigning variables for length, height and area of the rectangle Point ul; // assigning variables for all corners Point ur; Point lr; Point ll; Rectangle(Point p_ul, Point p_ur, Point p_lr, Point p_ll) { //constructor assigning Point variables ul = p_ul; ur = p_ur; lr = p_lr; ll = p_ll; } Rectangle(int x_ul, int y_ul, int x_ur, int y_ur, int x_lr, int y_lr, int x_ll, int y_ll) { //constructor assigning coordinates for each corner Point variable ul = new Point (x_ul, y_ul); ur = new Point (x_ur, y_ur); lr = new Point (x_lr, y_lr); ll = new Point (x_ll, y_ll); } public double rectArea() { double length = Math.sqrt( (ur.getX()-ul.getX()) * (ur.getX()-ul.getX()) ) + ( (ur.getY()-ul.getY()) * (ur.getY()-ul.getY()) ); //calculates length double height = Math.sqrt( (ur.getX()-lr.getX()) * (ur.getX()-lr.getX()) ) + ( (ur.getY()-lr.getY()) * (ur.getY()-lr.getY()) ); //calculates height return(length * height); } void displayInfo() { //Print statements System.out.println("Rectangle Info: "); System.out.println("Upper Left Point (x,y) : (" + ul.getX() + "," + ul.getY() + ")"); System.out.println("Upper Right Point (x,y) : (" + ur.getX() + "," + ur.getY() + ")"); System.out.println("Lower Left Point (x,y) : (" + ll.getX() + "," + ll.getY() + ")"); System.out.println("Lower Right Point (x,y) : (" + lr.getX() + "," + lr.getY() + ")"); System.out.println("Area: " + rectArea); System.out.println("Length: " + length); System.out.println("Height: " + height); System.out.println("ur-lr(Y): " + (ur.getY()-lr.getY()));// this prints 4 System.out.println("ur-lr(X): " + (ur.getX()-lr.getX()));// this prints 0 } } I am not sure why when I call the length and height with the actual ul.get(X) etc I get the correct output of length and height but when I print "length" and "height" I just get 0 and therefore making my …
has answer: http://stackoverflow.com/a/25260971
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39358765
has comment: http://stackoverflow.com/comment/39358541

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/25256399
tag name: android-gridview

http://stackoverflow.com/comment/39536197
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25357165
has text: It's likely that `FrameView` is make changes that are overriding your settings, either internally (have overridden those methods) or in time (changing it after you have set it)
score: 1

http://stackoverflow.com/comment/39540586
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25359147
type: Comment
has text: Which version of JBoss AS are you running?

http://stackoverflow.com/a/25389134
score: 3
type: Answer
has body: You seem to be mis-understanding the basics of Java syntax. Specifically, you cannot define your class's members and methods inside main() the way you are attempting to do: import java.awt.*; public class Alien { public static void main(String[] args) { // TODO Auto-generated method stub /** * The Alien class. */ public static int ALIEN_HEIGHT = 25; // you can't put this here public static int ALIEN_WIDTH = 15; // you can't put this here private int leftPosition = 0; // you can't put this here private int heightPosition = 0; // you can't put this here //etc To get this to compile, you need to close main() and delete all the extra } you have at the end of your code: import java.awt.*; public class Alien { public static void main(String[] args) { // TODO Auto-generated method stub } /** * The Alien class. */ public static int ALIEN_HEIGHT = 25; public static int ALIEN_WIDTH = 15; //etc You'll also need to add some code to main() before your program actually does anything. I would suggest that before you continue your current program you read some of the excellent tutorials online. A good place to start is The Java™ Tutorials on the oracle website. Look at the Trails Covering the Basics section and work your way through Getting Started and Learning the Java Language before doing anything else.
has comment: http://stackoverflow.com/comment/39596890
answers question: http://stackoverflow.com/q/25388870
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39421394
score: 0
has text: You mean you want to use single input for that? Then it is more complicated... because you still need to post it like `ids=1&ids=2`.
comment on: http://stackoverflow.com/q/25294312
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39318908
has text: 1 4 2 1 4 2 1 4 2 1 4 2 1 4 2 1 4 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25239349
type: Comment
score: 0

xsd
tags question: http://stackoverflow.com/q/25254514
tags question: http://stackoverflow.com/q/25295917
tags question: http://stackoverflow.com/q/25270191
tags question: http://stackoverflow.com/q/25367043
tags question: http://stackoverflow.com/q/25368805
tags question: http://stackoverflow.com/q/25289910
tags question: http://stackoverflow.com/q/25382162
tags question: http://stackoverflow.com/q/25262724
type: Tag
tags question: http://stackoverflow.com/q/25250418
tag name: xsd
tags question: http://stackoverflow.com/q/25353050
tags question: http://stackoverflow.com/q/25379260

http://stackoverflow.com/a/25393202
answers question: http://stackoverflow.com/q/25362553
has body: The file provided by the OP, 321-174.pdf, is signed using exactly one signature, not three, and the prime error is that the Contents of the signature dictionary content are not the CMS signature but instead something textually, probably base64 encoded. Thus, some decoding in-between in your code seems necessary. That been said I cannot find GOST3410 in the Table 257 – SubFilter value algorithm support - of the specification ISO 32000-1- Thus its use in this context most likely wont be accepted.
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39334169
type: AnswerComment
has text: the website `stackoverflow.com` dont let me post answers who has less than 25 characters. So i must have a test-text who is unfortunatelly part of the answer itself.
type: Comment
comment on: http://stackoverflow.com/a/25247047
score: 0

http://stackoverflow.com/comment/39384503
score: 0
type: QuestionComment
type: Comment
has text: The mistake was mine, it was actually `org.postgresql.Driver ` instead of `rg.postgresql.driver`, the tutorial I was using had it with d so I wouldn't suspect it was with D, I noticed it when I checked the source code of the lib I was using.
comment on: http://stackoverflow.com/q/25232367

http://stackoverflow.com/q/25321299
tagged with: drag-and-drop
linked to: http://stackoverflow.com/q/6391439
tagged with: java
has title: How to know the drop object in DropTargetDragEvent Java Swing comes from Outlook
type: Question
tagged with: outlook
has comment: http://stackoverflow.com/comment/39471305
has body: In a drop event (DropTargetDropEvent) in Java Swing which files,emails and others can be drop into a drop target, I would like to know if the drop object is an email from outlook. In the code below both file and email can enter the "if" condition. public void drop(java.awt.dnd.DropTargetDropEvent dropEvt ) { Transferable transferable = dropEvt.getTransferable(); if(transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { //Dropped files or email from Outlook enters this condition } } Thanks!
answer count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25519553
accepted answer: http://stackoverflow.com/a/25519553
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25255284
type: Question
accepted answer: http://stackoverflow.com/a/25255369
has comment: http://stackoverflow.com/comment/39349216
tagged with: locale
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39349246
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Why detected language result is null in Java
answer count: 1
has body: I'm trying to get the language format in Windows, but when I change the display format to English (United States) or English (United Kingdom) the returned value from System.getProperty() is null. For languages other than English, I get the correct result. I'm using following code: System.out.println(System.getProperty("user.language.format")); System.out.println(System.getProperty("user.country.format"));
has answer: http://stackoverflow.com/a/25255369
favorite count: 0

http://stackoverflow.com/a/49551566
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25260029
has body: Go to the Database and make sure that first column of your SQLquery is not null. i had same issue because my first column of SQLquery was null in DB. so these exception may occur that first column in your SQLquery is null in DB, and dont try to add null column of DB in SQLquery. i hope this might helped you. Prabhu MD

http://stackoverflow.com/q/25314176
type: Question
has comment: http://stackoverflow.com/comment/39466911
score: 0
has comment: http://stackoverflow.com/comment/39461129
tagged with: cors
has title: Jersey cors with basic authentication not working
type: UnansweredQuestion
answer count: 1
tagged with: web-services
tagged with: jersey
has body: Im trying to enable CORS in my jersey web server. I read this page. So i created my filter import java.io.IOException; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.Provider; @Provider public class CORSFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) throws IOException { final MultivaluedMap&lt;String, Object&gt; headers = responseContext .getHeaders(); headers.add("Access-Control-Allow-Origin", "*"); headers.add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); headers.add("Access-Control-Allow-Credentials", "true"); headers.add("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Codingpedia, "); } } This is my jQuery test $.ajax({ type: 'GET', url: myURL, crossDomain: true, dataType: 'jsonp', success: function (data) { console.log(data); }, error: function (data) { console.log(data.statusText); console.log(data.name); }, headers: { "Authorization": "Basic " + btoa('login:pass'), "Accept": "application/json" } }); When i run this js it keep asking me the login and password and, even if i type right always return 401 unauthorized.
tagged with: java
linked to: http://stackoverflow.com/q/7433556
has answer: http://stackoverflow.com/a/25327809

http://stackoverflow.com/comment/39408019
comment on: http://stackoverflow.com/q/25285604
score: 0
has text: Use Netbeans for creating Swing programms, very easy to use.
type: Comment
type: QuestionComment

waveform
tag name: waveform
type: Tag
tags question: http://stackoverflow.com/q/25268734

http://stackoverflow.com/q/25349018
has comment: http://stackoverflow.com/comment/39521665
upvote count: 5
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39521653
has comment: http://stackoverflow.com/comment/39521613
tagged with: eclipse
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: scala
downvote count: 2
has body: hi I am trying to install scala IDE I watched this Getting Started tutorial when I copy http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site this location from here into eclipse it gives me error Cannot complete the install because one or more required items could not be found. Software being installed: Scala Search 0.2.2.v-2_11-201407232051-fc76d40 (org.scala.tools.eclipse.search.feature.feature.group 0.2.2.v-2_11-201407232051-fc76d40) I am using ubuntu LTS12.04 OS eclipse indigo scala-2.11.1 please help
has answer: http://stackoverflow.com/a/25349187
has title: how to install scala ide
has comment: http://stackoverflow.com/comment/39521700
score: 3

http://stackoverflow.com/q/25245299
linked to: http://stackoverflow.com/q/31476843
tagged with: hornetq
tagged with: wildfly
has body: I am using the bundled JMS implementation on Wildfly 8.1 (HornetQ) to OCR a large number of documents. I want to have a pool of 3 MDBs consuming the messages of a Queue with the documents to be OCRed. Each MDB starts a process with the Apache commons-exec and blocks until that process exits. In my test I have 50 JMS messages (each represents a document to be OCRed) which are loaded on the Queue at the beginning of the test. When the processing starts, at any given time I can see that there are 3 CPU intensive OCR processes, one started and blocked upon by each MDB. At some point, after 20 minutes or so, one of the OCR processes dissappears, and only 2 remain alive at any given time. When there are 10 JMS messages or so remaining, another OCR process stops, and there is only 1 at any given time. In the end, all 50 documents have been OCRed, and no exception is being thrown by any of the OCR processes or my application. I find this behaviour strange because I would expect that there would be 3 OCR processes alive at any point in time consuming JMS messages (except at the end of course). This behaviour could be explained if the JMS messages are "assigned" to the MDB instances upon entry in the Queue, and not real time. For instance, if each MDB was assigned around 17 messages. Depending on the document sizes, some MDB instances could finish earlier and stay idle without consuming any other messages, when the other MDB instances could still have messages to consume. Is this what is happening? If yes, is there a way to change this so that the assignment of messages to MDB instances happens whenever an MDB instance finishes processing a message? @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "queue/csrOcrQueue"), @ActivationConfigProperty(propertyName = "minSession", propertyValue = "3"), @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "3") }) @TransactionAttribute(TransactionAttribu…
downvote count: 0
score: 1
upvote count: 1
tagged with: jms
answer count: 1
favorite count: 0
has title: Wildfly JMS: MDB beans idle when messages exist
type: Question
has answer: http://stackoverflow.com/a/25246084
tagged with: java
tagged with: message-driven-bean
type: UnansweredQuestion

http://stackoverflow.com/a/25291018
answers question: http://stackoverflow.com/q/25290872
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: As per the docs http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html int value = JOptionPane.showConfirmDialog(this, "Are you sure?", "Title", YES_NO_CANCEL_OPTION); value will now either be YES_OPTION, NO_OPTION, or CANCEL_OPTION, depending on what they clicked.
type: Answer
accepted answer of: http://stackoverflow.com/q/25290872
score: 2

http://stackoverflow.com/a/25354411
answers question: http://stackoverflow.com/q/25354356
score: 0
has body: You should consider using a Timer which will fire an event when a certain time interval has passed. It can repeat the event every so often, too.
type: Answer

http://stackoverflow.com/comment/39489393
type: Comment
type: QuestionComment
has text: Spring needs to know the profile when the application context is being constructed - i.e. during web application startup. The *Web parameter* method refers to context parameter set via `web.xml` - https://github.com/spring-projects/spring-petclinic/blob/master/src/main/webapp/WEB-INF/web.xml#L12 .
comment on: http://stackoverflow.com/q/25330713
score: 6

http://stackoverflow.com/comment/39313309
type: Comment
comment on: http://stackoverflow.com/a/25231024
type: AnswerComment
has text: Here is [an example](http://stackoverflow.com/a/10862262/418556) of carving up an image tile-set into 4 buttons and 5 labels. As an alternative to the usual focus indication, it uses an 'on focus' image with a (crude) red border. Edit: Oops! By 'on focus' I meant 'on pressed'. ;)
score: 1

http://stackoverflow.com/q/25234611
has title: Protobuf - Missing toByteArray()?
has body: I probably just messed up something in my proto file but I can't seem to call the toByteArray function. Using Java and the proto file was compiled with protoc. What I'm calling... BaseMessage.builder = baseMessage = BaseMessage.newBuilder(); Acknowledgement.builder = acknowledgeMessage = Acknowledgement.newBuilder(); acknowledgeMessage.setOk(true); baseMessage.setAcknowledgement(acknowledgeMessage); baseMessage.build(); byte[] send = baseMessage.toByteArray(); And BaseMessage is declared as... public static final class BaseMessage extends com.google.protobuf.GeneratedMessage implements BaseMessageOrBuilder { Maybe I'm missing somthing... BaseMessage is extending GeneratedMessage which inherits toByteArray() from AbstractMessageLite in which toByteArray is public... So I should be able to use it?
upvote count: 5
has answer: http://stackoverflow.com/a/25244864
has comment: http://stackoverflow.com/comment/39312218
type: AnsweredQuestion
score: 5
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39328719
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39328536
tagged with: protocol-buffers
accepted answer: http://stackoverflow.com/a/25244864

http://stackoverflow.com/a/25303024
has comment: http://stackoverflow.com/comment/39437409
has body: Here is my solution: String input = "abcdabcdeabcedeabcdefffff"; String longest = ""; String temp = ""; for(int pos=0; pos&lt;input.length(); pos++) { if(temp.isEmpty()) { temp = String.valueOf(input.charAt(pos)); } else if(input.charAt(pos) == temp.charAt(temp.length() - 1) + 1) { temp += input.charAt(pos); } else { temp = String.valueOf(input.charAt(pos)); } if(temp.length() &gt; longest.length()) longest = temp; } System.out.println(longest); You could also use a StringBuilder for temp as it is more efficient for building Strings in Java.
score: 0
has comment: http://stackoverflow.com/comment/39438122
type: Answer
has comment: http://stackoverflow.com/comment/39437458
has comment: http://stackoverflow.com/comment/39437177
answers question: http://stackoverflow.com/q/25301474

http://stackoverflow.com/q/25279727
possible better answer: http://stackoverflow.com/a/25279918
tagged with: swing
has answer: http://stackoverflow.com/a/25279918
type: Question
has answer: http://stackoverflow.com/a/25279954
type: AnsweredQuestion
score: 0
has title: java AbstractTableModel 2 Different Color For Each Row
has body: I want to increase readability of my jtable , here is MyTableModel.java class below , how to make each row with 2 different color shown in this picture . What should be the specific method that I can give different color to each row to increase readability of the user. public class MyTableModel extends AbstractTableModel{ String [] columnNames; Vector&lt;Vector&lt;Object&gt;&gt; data; public DataAccessObject ObjDb = new DataAccessObject (); public MyTableModel(String [] coln , Vector&lt;Vector&lt;Object&gt;&gt; data) { columnNames = coln; this.data =data; } @Override public int getColumnCount() { return columnNames.length; } @Override public int getRowCount() { return data.size(); } @Override public String getColumnName(int col) { return columnNames[col]; } public Object getValueAt(int row, int col) { return data.get(row).get(col); } public Class getColumnClass(int c) { return getValueAt(0, c).getClass(); } public boolean isCellEditable(int row, int col) { if (col &lt;= 0) { return true; } else { return true; } } public void setValueAt(Object value, int row, int col) { data.get(row).set(col, value); fireTableCellUpdated(row, col); } private class RowListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } // output.append("ROW SELECTION EVENT. "); // outputSelection(); } } private class ColumnListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } // output.append("COLUMN SELECTION EVENT. "); // outputSelection(); } } } Netbeans automatically created my jtable with variable name I set is mytable then I have problem with defining prepareRenderer below , do I miss step here ? I wanna make each row with different color Here is my sample code below. mytable.prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); // Alternate row col…
tagged with: colors
tagged with: java
has answer: http://stackoverflow.com/a/25279941
has comment: http://stackoverflow.com/comment/39435115
accepted answer: http://stackoverflow.com/a/25279954
has comment: http://stackoverflow.com/comment/39393613
tagged with: jtable
answer count: 3
tagged with: abstracttablemodel

http://stackoverflow.com/comment/39353924
comment on: http://stackoverflow.com/q/25257920
type: QuestionComment
has text: Read up how to create files with Java, then creating a file named ".htaccess" will be only a specific case for your file creation example.
score: 0
type: Comment

http://stackoverflow.com/a/25372238
answers question: http://stackoverflow.com/q/25370751
score: 0
type: AcceptedAnswer
has body: Figured it out. The problem was that I wasn't passing my "response" to my success function, so: function alertHere(){ window.alert("Post Successful!") } should have been: function alertHere(response){ window.alert("Post Successful!") } It was probably posting correctly, but I wasn't getting a success because the response wasn't getting passed.
type: Answer
accepted answer of: http://stackoverflow.com/q/25370751

http://stackoverflow.com/q/25250005
tagged with: xmlbeans
tagged with: java
has title: Can I validade a XML file against XSD fragment in Java
tagged with: jaxb
tagged with: http://stackoverflow.com/tag/xml
type: Question
possible better answer: http://stackoverflow.com/a/25250173
has answer: http://stackoverflow.com/a/25250173
has body: Can I validate a XML file against a xsd fragment? For example, I have a XML like: &lt;tag1&gt; &lt;xx&gt;...&lt;/xx&gt; &lt;/tag1&gt; And a XSD like: &lt;xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:element name="envTeste"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="tag" minOccurs="1" maxOccurs="1"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:int"&gt; &lt;xsd:totalDigits value="1" /&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="tag1" minOccurs="1" maxOccurs="1"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:pattern value="^\d{1,15}$"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; ............................ I want to use just the fragment "name=tag1" to validade my xml. It's possible? Using JAXB? Thanks a lot.
has comment: http://stackoverflow.com/comment/39339908
has answer: http://stackoverflow.com/a/25258924
accepted answer: http://stackoverflow.com/a/25271980
has answer: http://stackoverflow.com/a/25271980
has answer: http://stackoverflow.com/a/25251858
answer count: 4
has comment: http://stackoverflow.com/comment/39339099
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39393404
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25239202
type: AnswerComment
has text: But when I used getActivity() it says "The method getActivity() is undefined for the type new Handler(){}".

http://stackoverflow.com/comment/39496703
type: QuestionComment
score: 0
has text: @JBNizet Correct, sorry about that
type: Comment
comment on: http://stackoverflow.com/q/25334518

http://stackoverflow.com/comment/39405654
type: Comment
comment on: http://stackoverflow.com/q/25285681
score: 0
has text: You can pass them as queryParams with create.jsp. For example, your href would look like : `create.jsp?name=<%=rs.getString(1)%>&address=<%=rs.getString(2)%>&origin=<%=rs.getString(3)%>`. Now, you fetch these values in create.jsp as request params.
type: QuestionComment

http://stackoverflow.com/comment/39416126
comment on: http://stackoverflow.com/q/25291568
type: Comment
type: QuestionComment
score: 0
has text: @Zeb Sometimes you just go speechless.

http://stackoverflow.com/a/25309179
type: Answer
has body: I suggest that in your case you take a look at Mockito's Spy. Here is the javadoc and here is a tutorial of it's use. In your case you would create a spy of the real URLWrapper object, and then perform whatever other interaction is needed. @Test public final void testToMockConstructorInjectedBean() throws IOException { GenericApplicationContext mockContext = new GenericApplicationContext(); // Create our mock controller UrlWrapper spyUrl = spy(new URLWrapper("http://google.com")); // Set the mock object in the context mockContext.refresh(); mockContext.getBeanFactory().registerSingleton("url", spyUrl); UrlWrapper spy = null; spy = (UrlWrapper)mockContext.getBean("url"); } In this case you create the spy with the specified URL, and then just register that object as the bean for the class. UPDATE In my opinion url = (UrlWrapper) ContextProvider.getContext().getBean("url", requestUrl); is to restrictive in the test code. Code like this would mean that the beans need to be created in a specific way (a static factory method) in order to be able to be created as the test expects. What I suggest is that you populate the Spring context with a bean that already contains the desired behavior, and then just use getBean without arguments
answers question: http://stackoverflow.com/q/25308524
has comment: http://stackoverflow.com/comment/39449125
has comment: http://stackoverflow.com/comment/39449619
has comment: http://stackoverflow.com/comment/39450167
downvote count: 0
has comment: http://stackoverflow.com/comment/39450557
has comment: http://stackoverflow.com/comment/39449221
has comment: http://stackoverflow.com/comment/39450771
upvote count: 1
score: 1

github
tags question: http://stackoverflow.com/q/25349663
tags question: http://stackoverflow.com/q/25249138
tag name: github
type: Tag
tags question: http://stackoverflow.com/q/25314974
tags question: http://stackoverflow.com/q/25348716
tags question: http://stackoverflow.com/q/25244722

http://stackoverflow.com/q/25289474
tagged with: swig
has comment: http://stackoverflow.com/comment/39419271
tagged with: java
tagged with: http://stackoverflow.com/tag/c
linked to: http://stackoverflow.com/q/8524871
has title: C structure with pointers, how to Swig?
linked to: http://stackoverflow.com/q/18645095
has comment: http://stackoverflow.com/comment/39419494
has comment: http://stackoverflow.com/comment/39417359
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39436078
answer count: 1
has body: I am trying to use Swig to generate wrappers for some in-house C-code so I can reuse it for a new Android java project and am having problems. I am new to both Java and Swig so please be gentle with me in terms of the technical content of any replies. I am trying to wrap a C-structure called S_MESSAGE_STRUCT which contains pointers in such a way that its elements can be accessed (set up, written, read etc) from java and also by legacy C code. My C header file defining the struct is as follows, the code is exemplary and simplified from my real code (which has the same problems) : #ifndef MESSAGE_H_ #define MESSAGE_H_ #include &lt;stdbool.h&gt; typedef struct { int* i1; char* c1; int len; } *P_S_MESSAGE_STRUCT, S_MESSAGE_STRUCT; bool t_func(P_S_MESSAGE_STRUCT p_s_mystruct); #endif /* ndef MESSAGE_H_ */ My C file contains a single function which tests the int* i1 element of the S_MESSAGE_STRUCT and then writes to the c1 and i1 elements as follows : #include "message.h" bool t_func(P_S_MESSAGE_STRUCT p_s_mystruct) { if (*p_s_mystruct-&gt;i1 == 1) { strcpy(p_s_mystruct-&gt;c1, "Hello from swig"); p_s_mystruct-&gt;c1[p_s_mystruct-&gt;len-1] = '\0'; *p_s_mystruct-&gt;i1 = strlen(p_s_mystruct-&gt;c1); } return true; } I am using a .i file as follows : /* File : Message.i */ %module Message %{ /* Includes the header in the wrapper code */ #include "../../../common/message/message.h" %} // Enable the JNI class to load the required native library. %pragma(java) jniclasscode=%{ static { try { java.lang.System.loadLibrary("Message"); } catch (UnsatisfiedLinkError e) { java.lang.System.err.println("native code library failed to load.\n" + e); java.lang.System.exit(1); } } %} %include &lt;typemaps.i&gt; %apply signed char * INOUT {char*}; typedef struct { int* i1; char* c1; int len; } *P_S_MESSAGE_STRUCT, S_MESSAGE_STRUCT; %include cpointer.i bool t_func(P_S_MESSAGE_STRUCT p_s_mystruct); %pointer_functions(int, intp); My java source function is as follows (edited from a default An…
tagged with: pointers
linked to: http://stackoverflow.com/q/1583293
has comment: http://stackoverflow.com/comment/39435911
type: Question
has answer: http://stackoverflow.com/a/25579957
score: 0

http://stackoverflow.com/comment/39531261
has text: thanks for your response, but if i remove that line i recieve an error
score: 0
comment on: http://stackoverflow.com/q/25352352
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25292422
type: Question
has answer: http://stackoverflow.com/a/25292877
tagged with: android
tagged with: alarmmanager
accepted answer: http://stackoverflow.com/a/25292877
type: AnsweredQuestion
score: 0
tagged with: java
has title: making alarm manager repeat daily with time picker
tagged with: eclipse
has body: i'm trying to make my alarm manager repeat daily at the time chosen by the timepicker, i'm still new to java coding and stuff and i have no idea what to write inside the setRepeating() and in one alarm manager example i found this code alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent); i tried changing it but i get an error Description Resource Path Location Type The method setRepeating(int, long, long, PendingIntent) in the type AlarmManager is not applicable for the arguments (int, long, PendingIntent) help? public class AndroidTimeActivity extends Activity { TimePicker myTimePicker; Button buttonstartSetDialog; Button buttonCancelAlarm; TextView textAlarmPrompt; TimePicker timePicker; CheckBox optRepeat; final static int RQS_1 = 1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); timePicker = (TimePicker)findViewById(R.id.picker); optRepeat = (CheckBox)findViewById(R.id.optrepeat); textAlarmPrompt = (TextView)findViewById(R.id.alarmprompt); buttonstartSetDialog = (Button)findViewById(R.id.startSetDialog); buttonstartSetDialog.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Calendar calNow = Calendar.getInstance(); Calendar calSet = (Calendar) calNow.clone(); calSet.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour()); calSet.set(Calendar.MINUTE, timePicker.getCurrentMinute()); calSet.set(Calendar.SECOND, 0); calSet.set(Calendar.MILLISECOND, 0); if(calSet.compareTo(calNow) &lt;= 0){ //Today Set time passed, count to tomorrow calSet.add(Calendar.DATE, 1); } setAlarm(calSet, optRepeat.isChecked()); }}); buttonCancelAlarm = (Button)findViewById(R.id.cancel); buttonCancelAlarm.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { cancelAlarm(); }}); } private void setAlarm(Calendar targetCal, boolean repeat){ Intent intent = new Intent(getBa…
answer count: 1
tagged with: timepicker

http://stackoverflow.com/q/25280665
has answer: http://stackoverflow.com/a/25280766
answer count: 7
has title: java - where to put "return" in try, catch, finally block?
has answer: http://stackoverflow.com/a/25280822
has body: I was tracking Spring Framework source and found some code which is not friendly to me. I thought I have to put "return" statement in finally block, but this code put that in try block. Here is the source code.(This is part of org.springframework.jdbc.core.JdbcTemplate) 629 public &lt;T&gt; T query( 630 PreparedStatementCreator psc, final PreparedStatementSetter pss, final ResultSetExtractor&lt;T&gt; rse) 631 throws DataAccessException { 632 633 Assert.notNull(rse, "ResultSetExtractor must not be null"); 634 logger.debug("Executing prepared SQL query"); 635 636 return execute(psc, new PreparedStatementCallback&lt;T&gt;() { 637 public T doInPreparedStatement(PreparedStatement ps) throws SQLException { 638 ResultSet rs = null; 639 try { 640 if (pss != null) { 641 pss.setValues(ps); 642 } 643 rs = ps.executeQuery(); 644 ResultSet rsToUse = rs; 645 if (nativeJdbcExtractor != null) { 646 rsToUse = nativeJdbcExtractor.getNativeResultSet(rs); 647 } 648 return rse.extractData(rsToUse); 649 } 650 finally { 651 JdbcUtils.closeResultSet(rs); 652 if (pss instanceof ParameterDisposer) { 653 ((ParameterDisposer) pss).cleanupParameters(); 654 } 655 } 656 } 657 }); 658 } As you can see at line 648, it returns value in try block. and nothing more in finally block. I do not know how could this work?
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/25280709
possible better answer: http://stackoverflow.com/a/25280724
has comment: http://stackoverflow.com/comment/39395201
has comment: http://stackoverflow.com/comment/39395452
has answer: http://stackoverflow.com/a/25281581
has answer: http://stackoverflow.com/a/25280736
has answer: http://stackoverflow.com/a/25280764
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25280766
has answer: http://stackoverflow.com/a/25280724
tagged with: java

http://stackoverflow.com/comment/39384046
score: 0
comment on: http://stackoverflow.com/q/25273331
type: Comment
type: QuestionComment
has text: @LuiggiMendoza: If it does, I don't know now what encoding I will want to fallback on, as the server only accepts UTF-8 for now.

http://stackoverflow.com/comment/39327461
type: Comment
comment on: http://stackoverflow.com/q/25240315
type: QuestionComment
has text: Do you have already a communication partner using **HL7 V2.7**? with version specifics? If not, 2.7 is mostly compatible with prior versions.
score: 1

http://stackoverflow.com/comment/39569136
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25374273
score: 0
has text: learn ant, maven, or gradle, or even, heck, _make_.

http://stackoverflow.com/q/25245653
has body: I currently need a while loop for my toggleButton because the toggleButton is an essential part of my app where it will need to be constantly checked so that my EditText can be reflected accordingly. I tried this thread code, but the UI gets locked up when it ran. My thread code is: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.selectionmode2); Thread whileLoop = new Thread(){ public void run(){ toggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String row1TextContains = row1TextField.getText().toString().trim(); String row2TextContains = row2TextField.getText().toString().trim(); String row3TextContains = row3TextField.getText().toString().trim(); String row4TextContains = row4TextField.getText().toString().trim(); while(isChecked) { if(row1TextField.isFocused()) { row2TextField.setEnabled(false); row2TextField.setHint("Disabled"); //toggleButton.setChecked(true); }else { row1TextField.setEnabled(true); row2TextField.setEnabled(true); row2TextField.setHint(row2Hint); row3TextField.setEnabled(true); row4TextField.setEnabled(true); } if(row2TextField.isFocused()) { row3TextField.setEnabled(false); row3TextField.setHint("Disabled"); toggleButton.setChecked(true); }else { row3TextField.setHint(row3Hint); row3TextField.setEnabled(true); } if(row3TextField.isFocused()) { row4TextField.setEnabled(false); row4TextField.setHint("Disabled"); if(row1TextContains.isEmpty() || row1TextContains.length() == 0 || row1TextContains.equals("")) { row2TextField.setEnabled(true); }else { row2TextField.setEnabled(false); row2TextField.setHint("Disabled"); } }else{ row4TextField.setEnabled(true); row4TextField.setHint(row4Hint); } if(row4TextField.isFocused()) { Toast toast = Toast.makeText(getApplicationContext(), "Row 4 of Large Character is not allowed", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0);…
has comment: http://stackoverflow.com/comment/39363290
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39330838
has title: using Thread with ToggleButton and onFocusChange
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39330679
has comment: http://stackoverflow.com/comment/39330831
has comment: http://stackoverflow.com/comment/39330912
type: Question

http://stackoverflow.com/comment/39545205
type: QuestionComment
has text: i guess you mean: "I am trying to display the current date CONTINOUSLY." right?
comment on: http://stackoverflow.com/q/25362052
score: 0
type: Comment

http://stackoverflow.com/q/25251643
favorite count: 0
type: Question
upvote count: 2
has title: Spring Data Neo4j and queries
type: UnansweredQuestion
answer count: 1
downvote count: 0
has body: I'm trying to write a query that returns a fairly large amount of data (200ish nodes). The nodes are very simple: public class MyPojo{ private String type; private String value; private Long createdDate; ... } I originally used the Spring Data Neo4j template interface, but found that it was very slow after around 100 nodes were returned. public interface MyPojoRepository extends GraphRepository&lt;MyPojo&gt; { public List&lt;MyPojo&gt; findByType(String type); } I turned on debugging to see why it was so slow, and it turned out SDN was making a query for each node's labels. This made sense, as I understand SDN it needs the labels to do its duck-typing. However, Cypher returns all pertinent data in one go so there's no need for this. So, I tried rewriting it as a Cypher query instead: public interface MyPojoRepository extends GraphRepository&lt;MyPojo&gt; { @Query("MATCH(n:MyPojo) WHERE n.type = {0} RETURN n") public List&lt;MyPojo&gt; findByType(String type); } This had the same problem. I dug a little deeper, and while this query returned all node data in one go, it leaves out the labels. There is a way to get them, which works in the Neo4j console so I tried it with SDN: "MATCH(n:MyPojo) WHERE n.type = {0} RETURN n, labels(n)" Unfortunately, this caused an exception about having multiple columns. After looking through the source code, this makes sense because Neo4j returns a map of returned columns which in my case looked like: n, labels(n). SDN would have no way of knowing that there was a label column to read. So, my question is this: is there a way to provide labels as part of the Cypher query to prevent needing to query again for each node? Or, barring that, is there a way to feed SDN a Node containing labels and properties and convert it to a POJO? Note: I realize that the SDN team is working on using Cypher completely under the hood in a future release. As of now, a lot of the codebase uses the old (and, I believe, deprecated) REST services. If there is any …
score: 2
tagged with: spring-data-neo4j
tagged with: java
has answer: http://stackoverflow.com/a/25254180
tagged with: neo4j

http://stackoverflow.com/a/25338185
has comment: http://stackoverflow.com/comment/39934694
score: 0
answers question: http://stackoverflow.com/q/25312838
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39934430
has comment: http://stackoverflow.com/comment/39934618
has comment: http://stackoverflow.com/comment/39934523
accepted answer of: http://stackoverflow.com/q/25312838
has comment: http://stackoverflow.com/comment/39934379
type: Answer
has body: If you plan to interact in your GWT app with bootstrap components (i.e. NavBar, Caoursel, etc) then I would go with gwt-bootstrap because you don't have to use JSNI and you get some type safety. If you don't need to interact those components or you use mostly pure HTML in your GWT app you can also use plain bootstrap and add the corresponding classes. Edit code example: UiBinder: &lt;b:NavPills&gt; &lt;b:AnchorListItem active="true"&gt;Item 1&lt;/b:AnchorListItem&gt; &lt;b:AnchorListItem&gt;Item 2&lt;/b:AnchorListItem&gt; &lt;b:AnchorListItem&gt;Item 3&lt;/b:AnchorListItem&gt; &lt;b:AnchorListItem enabled="false"&gt;Item 4&lt;/b:AnchorListItem&gt; &lt;b:AnchorListItem pull="RIGHT"&gt;Pulled right&lt;/b:AnchorListItem&gt; &lt;/b:NavPills&gt; Code: NavPills pills = new NavPills(); AnchorListItem item1 = new AnchorListItem("Item 1"); item1.setActive(true); pills.add(item1); pills.add(new AnchorListItem("Item 2"); pills.add(new AnchorListItem("Item 3"); ...

http://stackoverflow.com/comment/39427188
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25296810
type: Comment
has text: Your stacktrace should indicate which line exactly is causing the NullPointer exception. Could be your params is null so when you call params.get(0) that would throw a NullPointer.

http://stackoverflow.com/a/25308835
answers question: http://stackoverflow.com/q/25308604
type: Answer
score: 0
has body: You need to create exact replica of JSON string into Java POJO classes or Map Here is simple code to get the firstname and lastname from properties Type type = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() {}.getType(); // JSON string to Java Map object Map&lt;String, Object&gt; data = new Gson().fromJson(jsonString, type); Map&lt;String,Object&gt; properties=(Map&lt;String,Object&gt;)data.get("properties"); Object lastname = properties.get("lastname"); Object firstname = properties.get("firstname"); // convert Object into JSON string back System.out.println(new Gson().toJson(lastname)); You need to spend some time on reading GSON library

http://stackoverflow.com/q/25274743
score: 0
has comment: http://stackoverflow.com/comment/39385180
answer count: 2
tagged with: stylesheet
tagged with: javafx-8
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25277977
has comment: http://stackoverflow.com/comment/39385320
has answer: http://stackoverflow.com/a/25276029
has comment: http://stackoverflow.com/comment/39390634
tagged with: css
has answer: http://stackoverflow.com/a/25277977
has title: How can I stylize the text of a button or toggle button in JavaFX using CSS?
has body: I'm not sure this is even possible. I've looked around on google a bit and found next to nothing on this subject. I like being able to stylize labels to make them look engraved or embossed in the CSS style sheet using the InnerShadow and DropShadow effects. I've tried the same on buttons but it doesn't effect the text, it just applies it directly to the button. What would be the CSS I would need to use to apply the InnerShadow and/or DropShadow effects to the text of a button or toggle button?
possible better answer: http://stackoverflow.com/a/25276029
type: AnsweredQuestion

http://stackoverflow.com/q/25298715
has answer: http://stackoverflow.com/a/25298765
has answer: http://stackoverflow.com/a/25298841
score: 0
answer count: 2
type: Question
has title: Compare 2 strings and return amount of matching letters java
has body: How does one compare 2 Strings to return an int of amount matched in Java? I have a "lottery number" which is a UUID and looks like 561637ba-06f6-4457-9787-ba65768c1b73 I would compare it to another string like 72c92628-5789-4d5c-9287-742dbc57cca9 which excluding the - would be 5 matching characters. would there be a faster way that just simply looping through every single character?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39429452
tagged with: java

http://stackoverflow.com/comment/39589440
has text: It is not so clear. From what I understand you want when you press Button1 comes out of a textfield. If so please use the Activity textfield and add visibility = false. Then you set when you press Button1 changes in visibility true
comment on: http://stackoverflow.com/q/25385180
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25242788
has body: You should create an instance of a concrete class which extends the abstract class or you should create an anonymous inner class instance for the abstract class(and override the methods marked abstract).You can then use that instance and make the method accessible by making setAccessible(true).This will work unless you mess up with the SecurityManager(inmost cases you wont).Then you can invoke the method
answers question: http://stackoverflow.com/q/25242276
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25256885
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/25256980
tagged with: numbers
has comment: http://stackoverflow.com/comment/39352174
has answer: http://stackoverflow.com/a/25261979
possible better answer: http://stackoverflow.com/a/25257311
has comment: http://stackoverflow.com/comment/39352244
tagged with: java
linked to: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/39352107
has title: What class to use to represent currencies in Java?
has comment: http://stackoverflow.com/comment/39360671
answer count: 4
has comment: http://stackoverflow.com/comment/39352223
type: Question
has comment: http://stackoverflow.com/comment/39352267
score: 2
accepted answer: http://stackoverflow.com/a/25256980
linked to: http://stackoverflow.com/q/16999006
has comment: http://stackoverflow.com/comment/39352167
downvote count: 1
has answer: http://stackoverflow.com/a/25257311
has answer: http://stackoverflow.com/a/25257222
has body: I am working on a finacial project developed in Java, I would like to: Establish a system of currencies conversions Convert them and make sure they work I would like to know what is the best Java class to use to make the currencies work properly. It came down to these two choices: BigDecimal Double Can you explain me a bit more what is the best choice for this endeavor?
favorite count: 0
tagged with: class
tagged with: currency
has comment: http://stackoverflow.com/comment/39352180
has comment: http://stackoverflow.com/comment/39352241

http://stackoverflow.com/a/25352882
score: 0
has body: The jre\lib\endorsed works. Tested with running Eclipse/IntelliJ/NetBeans and LWJGL/JOGL demos without any problem. I have to use source from OpenJDK to avoid license problems; New default methods are put in separated classes, such as this: public interface Iterable&lt;T&gt; extends IterableExt&lt;T&gt; { Iterator&lt;T&gt; iterator(); .... } public interface IterableExt&lt;T&gt; { default boolean all(Predicate&lt;? super T&gt; filter) { for (T item : (Iterable&lt;T&gt;) this) { if (!filter.test(item)) { return false; } } return true; } default Iterable&lt;T&gt; filter(Predicate&lt;? super T&gt; filter) { Iterable&lt;T&gt; thiz = (Iterable&lt;T&gt;) this; return () -&gt; new FilteredIterator&lt;&gt;(thiz.iterator(), filter); } } Deployment is simple enough: just wrap everything into jar and put into %JRE_HOME%\lib\endorsed. Since it's applied to entire system and locked on Windows, it'd be impossible to upgrade without stopping all Java programs. Another problem is the classes compiled by Eclipse would not work when referenced by javac later (bad class file etc), but recompiling by javac works for both. EDIT: I uploaded the source to https://github.com/AqD/JXTN (.axi project) under public domain.
answers question: http://stackoverflow.com/q/25315846
type: Answer

http://stackoverflow.com/a/42224609
has body: With the latest API the accepted answer no longer works. Similar solution using latest client (5.2.0): SortedMap&lt;String, AliasOrIndex&gt; lookup = esClient.admin().cluster() .prepareState().execute() .actionGet().getState() .getMetaData().getAliasAndIndexLookup(); if (lookup.containsKey(ALIAS_NAME)) { lookup.get(ALIAS_NAME).getIndices().get(0).getIndex().getName(); } Alternatively, you can use Aliases API like this: esClient.admin().indices().prepareGetAliases(ALIAS_NAME).get().getAliases(); Key of the resulting map is the index name that given alias maps to.
answers question: http://stackoverflow.com/q/25349947
type: Answer
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/39473316
comment on: http://stackoverflow.com/a/25303328
has text: Go to that webpage and view the source, or use dev tools to find that javascript. Would it not be an option not to use the mp3 converter, but using an existing library like youtube-dl and then converting the output yourself, as I suggested?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25400370
type: Answer
has comment: http://stackoverflow.com/comment/39624023
score: 2
answers question: http://stackoverflow.com/q/25389605
downvote count: 0
has comment: http://stackoverflow.com/comment/39630269
has body: The DSL Basics section of the Drools manual describes how to do this. However, here is a summary... You could also define multiple DSL phrases mapping to operators, such as: [when][]is less than=&lt; [when][]is greater than=&gt; [when][]is equal to=== [when][]Given a person with=Person() [when][]- {field:\w*} {operator} {value:\d*}={field} {operator} {value} Lets you write: Given a person with - age is less than 18 Something that I have also done to make life easier in the guided editors is to write enums and DSL such as: 'InOrNotIn.options' : ['contains=in', 'not contains=not in'] [when][]Given a currency "{operator:ENUM:InOrNotIn.options}" the major currencies = $ccy : Currency(isoCode {operator} $majorCurrencies)
has comment: http://stackoverflow.com/comment/39628311
has comment: http://stackoverflow.com/comment/39620715
has comment: http://stackoverflow.com/comment/39621843
upvote count: 2

http://stackoverflow.com/q/25290733
score: 2
has answer: http://stackoverflow.com/a/25290811
tagged with: java
linked to: http://stackoverflow.com/q/1845678
has answer: http://stackoverflow.com/a/25290825
has body: I have a method that I only want to have called when not on the main thread (does heavy work) and if it is called from the main thread I would throw a runtime exception, similar to what happens when you try to do a network call on the main thread and you get a NetworkOnMainThreadException I have not found anything on this issue so is there a way to do it?
has comment: http://stackoverflow.com/comment/39414308
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/1845678
answer count: 2
upvote count: 2
tagged with: multithreading
tagged with: android
downvote count: 0
has title: Check what thread a method is being called from
has comment: http://stackoverflow.com/comment/39414342
has comment: http://stackoverflow.com/comment/39414506
has comment: http://stackoverflow.com/comment/39414132
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25290811
possible better answer: http://stackoverflow.com/a/25290825

http://stackoverflow.com/a/25328535
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25328498
type: Answer
has body: You have to make an instance of WindowFlag class. WindowFlag wf = new WindowFlag(){}; Then call wf.setFlag(true); Since the class is abstract, you have to provide an implementation first. If there are no other abstract methods, you simply can remove the abstract part. If there are other abstract methods, WindowFlag w=new WindowFlag() { // implementations of abstract methods. };

http://stackoverflow.com/comment/39512640
type: Comment
comment on: http://stackoverflow.com/a/25342300
score: 0
type: AnswerComment
has text: @MahiraKhan Try adding this property: `props.put("mail.smtp.starttls.enable","true");`

http://stackoverflow.com/q/25348511
type: Question
has title: java.lang.OutOfMemoryError even if there is enough RAM available
tagged with: out-of-memory
has answer: http://stackoverflow.com/a/25348542
has comment: http://stackoverflow.com/comment/39521692
upvote count: 1
accepted answer: http://stackoverflow.com/a/25348619
tagged with: eclipse-rcp
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25348542
has answer: http://stackoverflow.com/a/25348619
answer count: 2
score: 1
tagged with: java
downvote count: 0
has body: I am trying to open a file in eclipse programmatically. the associated editor for the file is defined in an external plugin which I don't have control over the source code. I use the code snippet shown below to open the file. However I always got Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "AWT-Windows" I tried to increase the memory available for eclipse run configuration, but that didn't help. Any ideas what can cause this? private void openFiles(final IPath filePath ) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IFile iFileInput = workspace.getRoot().getFileForLocation(filePath); IEditorInput editorInput = new FileEditorInput(iFileInput); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPage page = window.getActivePage(); try { iFileInput.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e1) { e1.printStackTrace(); } try { String editorID = "xxxxx"; IDE.openEditor(page, editorInput, editorID); } catch (PartInitException e) { e.printStackTrace(); } } }); }
tagged with: eclipse
tagged with: eclipse-plugin
favorite count: 0

http://stackoverflow.com/a/25240141
has comment: http://stackoverflow.com/comment/39320251
has body: Try this code ;) import java.util.ArrayList; import java.util.List; public class ogr { public static void main(String[] args) throws InterruptedException { final PositionHolder holder = new PositionHolder(); final List&lt;Integer&gt; data = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; 20; i++) { holder.setPosition(i); Thread t = new Thread() { @Override public void run() { data.add(holder.getPosition()); } }; t.start(); t.join(); } for (int i : data) { System.out.println(i); } } } class PositionHolder { int position = 0; public void setPosition(int position) { this.position = position; } public int getPosition() { return this.position; } }
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39320309
accepted answer of: http://stackoverflow.com/q/25240016
has comment: http://stackoverflow.com/comment/39320344
answers question: http://stackoverflow.com/q/25240016
type: Answer
has comment: http://stackoverflow.com/comment/39320594
has comment: http://stackoverflow.com/comment/39356229

http://stackoverflow.com/comment/39566990
comment on: http://stackoverflow.com/q/25373200
type: QuestionComment
has text: This is different from this: http://stackoverflow.com/questions/3479428/android-notification-intent-to-clear-it-self in that, my notification does go away. The problem is when a new notification is added, the receiver gets the first zombie notification again. #notadupe
score: 0
type: Comment

http://stackoverflow.com/a/25292199
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25291981
type: Answer
accepted answer of: http://stackoverflow.com/q/25291981
has body: Assuming that String[] names also initially contains the value "Two" so you actually have 4 buttons, have you tried using JPanel's remove() and updateUI() method? Try adding: checkboxes[i].setVisible(false); // line you have in your code, now panel.remove(checkboxes[i]); // add this line panel.updateUI(); // and this line If you're going to remove something from the UI, you can't just setVisible to false; the component just becomes invisible. You have to actually remove it from the panel and then update it.
score: 3

http://stackoverflow.com/comment/39429529
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25298524
has text: @user3847203 IF the values are stored in the correct format as compared to the `SimpleDateFormat`, then it should just be a matter of parsing the values with the formatter, that simple.

http://stackoverflow.com/comment/39342677
type: QuestionComment
score: 0
has text: Thanks, I tried but still no change
comment on: http://stackoverflow.com/q/25251577
type: Comment

http://stackoverflow.com/q/25273638
accepted answer: http://stackoverflow.com/a/25274348
has body: When using a directory-expression for an &lt;int-file:outbound-gateway&gt; endpoint, the method below is called on org.springframework.integration.file.FileWritingMessageHandler: private File evaluateDestinationDirectoryExpression(Message&lt;?&gt; message) { final File destinationDirectory; final Object destinationDirectoryToUse = this.destinationDirectoryExpression.getValue( this.evaluationContext, message); if (destinationDirectoryToUse == null) { throw new IllegalStateException(String.format("The provided " + "destinationDirectoryExpression (%s) must not resolve to null.", this.destinationDirectoryExpression.getExpressionString())); } else if (destinationDirectoryToUse instanceof String) { final String destinationDirectoryPath = (String) destinationDirectoryToUse; Assert.hasText(destinationDirectoryPath, String.format( "Unable to resolve destination directory name for the provided Expression '%s'.", this.destinationDirectoryExpression.getExpressionString())); destinationDirectory = new File(destinationDirectoryPath); } else if (destinationDirectoryToUse instanceof File) { destinationDirectory = (File) destinationDirectoryToUse; } else { throw new IllegalStateException(String.format("The provided " + "destinationDirectoryExpression (%s) must be of type " + "java.io.File or be a String.", this.destinationDirectoryExpression.getExpressionString())); } validateDestinationDirectory(destinationDirectory, this.autoCreateDirectory); return destinationDirectory; } Based on this code I see that if the directory to use evaluates to a String, it uses that String to create a new java.io.File object. Is there a reason that a ResourceLoader couldn't/shouldn't be used instead of directly creating a new file? I ask because my expression was evaluating to a String of the form 'file://path/to/file/' which of course is an invalid path for the java.io.File(String) constructor. I had assumed that Spring would treat the String the same way as it treats the directory attribute on &lt;in…
answer count: 2
tagged with: spring
type: Question
type: AnsweredQuestion
score: 0
tagged with: spring-integration
has answer: http://stackoverflow.com/a/25274348
possible better answer: http://stackoverflow.com/a/25273783
tagged with: java
has answer: http://stackoverflow.com/a/25273783
has title: Using a resource loader for FileWritingMessageHandler

http://stackoverflow.com/q/25319116
has answer: http://stackoverflow.com/a/25320092
has comment: http://stackoverflow.com/comment/39467480
answer count: 4
has answer: http://stackoverflow.com/a/25319810
tagged with: scopes
has comment: http://stackoverflow.com/comment/39467380
has answer: http://stackoverflow.com/a/50883445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39467228
has comment: http://stackoverflow.com/comment/39467462
has comment: http://stackoverflow.com/comment/39467322
has comment: http://stackoverflow.com/comment/39467529
type: Question
score: 0
has body: While preparing for sitting the Java exams i just came across this snippet class Person { static class Male { static String Desc = "Male"; } static Gender Male = new Gender(); } class Gender { String Desc = "Gender"; } public static void main(String[] args) { System.out.println(Person.Male.Desc); // returns: Gender } } used to depict the precedence of local variables over class members. the overlapping scope(s) is obvious to me. but why would we call Desc a local variable here? Is it because it is not known by any method (be it static or non-static) / class related to Person. - Just as any "ordinary" method-variable with limited i.e. local scope? the snippet is meant to confuse. so i ask to make sure i understood the notion beyond it.
has answer: http://stackoverflow.com/a/25319291
tagged with: java
has title: precedence of (local) variables over class members

http://stackoverflow.com/comment/39421869
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25294540
has text: @Pshemo Html.fromHtml cannot be applied to Java.lang.StringBuilder. That i have to replace `replace` with `replaceAll` is true, but that didn't fix my problem that Html.fromHtml cannot be applied to Java.lang.StringBuilder

http://stackoverflow.com/comment/39556885
type: AnswerComment
has text: Which means, you have to pass SOME value. Empty value from JTextField/TextField will give you a NumberFormatException. Put some kind of filter like `if(playerNumberFld.getText().trim().length() != 0) {...}`
comment on: http://stackoverflow.com/a/25352589
type: Comment
score: 0

http://stackoverflow.com/a/25322304
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25321778
has comment: http://stackoverflow.com/comment/39473090
has body: Using a synchronization block: public class MyApplication extends Application { ...(some code) synchronized (MyApplication.class) { ...(some code) } ...(some code) } As for the monitor, it seems that it can except as a locking object only a specific type of class/object. Check an occurrence where it compiles fine and see which type of object is used there.
has comment: http://stackoverflow.com/comment/39473063
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25321778

http://stackoverflow.com/comment/39554986
comment on: http://stackoverflow.com/q/25367100
type: QuestionComment
has text: possible duplicate of [Getting email from GraphUser with Permissions](http://stackoverflow.com/questions/25191190/getting-email-from-graphuser-with-permissions)
score: 0
type: Comment

jscrollpane
tags question: http://stackoverflow.com/q/25354328
tag name: jscrollpane
tags question: http://stackoverflow.com/q/25364758
tags question: http://stackoverflow.com/q/25290277
tags question: http://stackoverflow.com/q/25255287
tags question: http://stackoverflow.com/q/25379958
tags question: http://stackoverflow.com/q/25293754
tags question: http://stackoverflow.com/q/25374750
type: Tag
tags question: http://stackoverflow.com/q/25258186
tags question: http://stackoverflow.com/q/25256052
tags question: http://stackoverflow.com/q/25326749
tags question: http://stackoverflow.com/q/25304941

http://stackoverflow.com/comment/39346393
type: AnswerComment
has text: It's not clear why you would want to specify CASE_INSENSITIVE on a pattern that is matching only numbers, sign symbols, decimal points, and spaces, or why you would want to specify DOTALL on a pattern that is matching a single line, although it does no harm.
type: Comment
comment on: http://stackoverflow.com/a/25253508
score: 0

http://stackoverflow.com/comment/39397520
comment on: http://stackoverflow.com/q/25281900
has text: As above, are you sure that "ok" is not adding a new line and acting the same as an "enter" key?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39445880
score: 0
has text: I don't want two paths. I'm saying if I use /XML/RequetXML/ path. this does not work in linux. Linux wants /usr/XML/RequestXML/ path to work. I just want only one path which is working in both linux and windows. How can I do that?
comment on: http://stackoverflow.com/q/25307720
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25332756
tagged with: ant
linked to: http://stackoverflow.com/q/17571595
has title: Can't get property values from ${env} in Apache Ant
type: AnsweredQuestion
answer count: 2
score: 1
has comment: http://stackoverflow.com/comment/39493268
tagged with: java
accepted answer: http://stackoverflow.com/a/25332783
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25332783
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25332871
has answer: http://stackoverflow.com/a/25332871
has body: I have the following Ant target to show the value of the JAVA_HOME environment variable: &lt;target name="show-java-home"&gt; &lt;echo message="${env.JAVA_HOME}"/&gt; &lt;/target&gt; However, I get the following result: show-java-home: [echo] ${env.JAVA_HOME} BUILD SUCCESSFUL Total time: 292 milliseconds What am I doing wrong?

http://stackoverflow.com/comment/39316336
has text: not really, it is the whole class decompiled, what you saw was referring to an exception since I did click no the java.lang.Exception class from JDK, and having no source it did show that (better formatted in Eclipse), just try it on any class and you'll see
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25237556

http://stackoverflow.com/comment/39328430
score: 0
type: AnswerComment
has text: You would have to. Look at my code it uses transaction to commit to database. If you do not commit changes, then your procedure would have no data to fill Queue.
comment on: http://stackoverflow.com/a/25244115
type: Comment

http://stackoverflow.com/comment/39584181
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25308253
score: 0
has text: @Audumbar: "So now my problem is how to differentiate between this two devices?" -- I have no idea. If the problem was that the device did not support the `Intent` action, and you got an `ActivityNotFoundException`, there would be approaches to take to handle that. But in your case, the Settings app claims to honor that action, then crashes, and I do not know any reliable way to determine ahead of time that this will be the case.

http://stackoverflow.com/q/25238426
has body: I've just exported my Eclipse project to a runnable jar file. I have no lag issues when I run it in Eclipse, but have extreme lag when running it in the jar. (Running MacOSX 10.9.4) According to my FPS counter, I'm getting over 900 frames a second, and the game is actually running, but nothing is actually being rendered for a while. Not sure what code to show because there is a lot of it, as it is an almost completed game. But let me know what code you might need. Here's my game loop: public void run() { long start = System.nanoTime(); final double numUpdates = 30.0; double ns = 1000000000 / numUpdates; double delta = 0; int updates = 0; int frames = 0; long timer = System.currentTimeMillis(); while(running) { long current = System.nanoTime(); delta += (current - start) / ns; start = current; if(delta &gt;= 1) { update(); updates++; delta--; } render(); frames++; if(System.currentTimeMillis() - timer &gt; 1000) { timer = System.currentTimeMillis(); Window.frame.setTitle("Rage Mage UPS: " + updates + ", FPS: " + frames); updates = 0; frames = 0; } } } render() method: private void render() { statusHandler.render(g); // statusHandler is a class that handles the current state of the game Graphics g2 = getGraphics(); g2.drawImage(image, 0, 0, WIDTH * SCALE, HEIGHT * SCALE, null); } I don't think the game loop is the problem though, because I was getting the same issues before with a different loop, and then I changed to this loop, and nothing has changed. Thanks!
has comment: http://stackoverflow.com/comment/39319768
score: 1
has comment: http://stackoverflow.com/comment/39320606
tagged with: java
has comment: http://stackoverflow.com/comment/39358743
has comment: http://stackoverflow.com/comment/39358906
has comment: http://stackoverflow.com/comment/39319466
has comment: http://stackoverflow.com/comment/39323336
has comment: http://stackoverflow.com/comment/39321081
has comment: http://stackoverflow.com/comment/39320691
has comment: http://stackoverflow.com/comment/39319802
type: Question
tagged with: lag
has comment: http://stackoverflow.com/comment/39353120
answer count: 0
has comment: http://stackoverflow.com/comment/39317374
has comment: http://stackoverflow.com/comment/39320876
has comment: http://stackoverflow.com/comment/39359094
has comment: http://stackoverflow.com/comment/39359043
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39317282
downvote count: 0
has comment: http://stackoverflow.com/comment/39317355
tagged with: jar
upvote count: 1
has comment: http://stackoverflow.com/comment/39320654
has comment: http://stackoverflow.com/comment/39320786
has comment: http://stackoverflow.com/comment/39320473
favorite count: 0
has comment: http://stackoverflow.com/comment/39321048
has title: Jar Rendering Lag
has comment: http://stackoverflow.com/comment/39320528

http://stackoverflow.com/a/25388097
type: Answer
accepted answer of: http://stackoverflow.com/q/25387983
score: 4
answers question: http://stackoverflow.com/q/25387983
has comment: http://stackoverflow.com/comment/39596460
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39596148
upvote count: 4
has body: You need to add listeners to detect when the user enters text. In order to have it register any change (and not just when the user hits Enter) you should attach a DocumentListener to the underlying document of each JTextField. Then, have each listener call a function to do your check and update the JButton's enabled status accordingly. Related
downvote count: 0

http://stackoverflow.com/comment/39356774
has text: `Java` don't have pointers.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25259602
type: Comment

http://stackoverflow.com/comment/39415722
type: QuestionComment
comment on: http://stackoverflow.com/q/25291159
score: 0
has text: yep, remote access is allowed
type: Comment

http://stackoverflow.com/comment/39372342
has text: wouldn't you want to use `contains` here instead of equals? it would never pass that if statement using equals unless the message was the keyword
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25268013

http://stackoverflow.com/q/25269774
has comment: http://stackoverflow.com/comment/39389047
has title: Difference between abstract methods and default methods
has comment: http://stackoverflow.com/comment/39375745
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39375747
has comment: http://stackoverflow.com/comment/39375596
has body: What is the difference between abstract methods and default methods? I know this question has been answered before, but not in the way Aristocrates has. BEFORE KNOWING THE ANSWER FROM "Aristocrates", I thought default methods are different from defender methods, and that - default methods are nothing but the abstract methods(without keyword abstract) inside an interface. These two wrong conceptions led this foolish question to be asked. I never meant to trouble the folks by asking an already "well asked and well answered" question. I wanted to delete this question but I haven't because of two reasons - 1.stackoverflow prevented me, 2.Aristocrates' answer is superb.
has comment: http://stackoverflow.com/comment/39375729
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/19998454
has answer: http://stackoverflow.com/a/25270004
has comment: http://stackoverflow.com/comment/39375558
duplicate of: http://stackoverflow.com/q/19998454
upvote count: 3
score: -4
has comment: http://stackoverflow.com/comment/39375602
answer count: 1
downvote count: 7

http://stackoverflow.com/comment/39383928
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25249651
has text: This is off the top of my head, but I'd create a new queue, size 1, and point your producer and consumer to it. Nothing will go into the old queue now but it might not be empty. Make one call of drainTo() on the old queue, then you should be good. Edit: I see the issue, yeah if you're potentially backed up with blocked puts you'd need to poll until the queue is empty.
score: 0

http://stackoverflow.com/a/25239313
answers question: http://stackoverflow.com/q/25238763
has comment: http://stackoverflow.com/comment/39327542
has comment: http://stackoverflow.com/comment/39319200
has comment: http://stackoverflow.com/comment/39325455
has comment: http://stackoverflow.com/comment/76525543
has comment: http://stackoverflow.com/comment/39326891
has comment: http://stackoverflow.com/comment/39319826
upvote count: 1
has comment: http://stackoverflow.com/comment/39320114
downvote count: 1
has comment: http://stackoverflow.com/comment/39318897
has body: Here is the regex for 128 bytes represented as Hex: ^([0-9|a-f|A-F][0-9|a-f|A-F]){1,64}$ if you want for X-bytes just put the X/2 value in the regex: ^([0-9|a-f|A-F][0-9|a-f|A-F]){1,X/2}$
score: 0
type: Answer

http://stackoverflow.com/q/25239260
tagged with: apache
downvote count: 0
upvote count: 1
tagged with: maven
score: 1
has comment: http://stackoverflow.com/comment/39355788
tagged with: java
has title: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
has body: I'm trying to execute a Maven proyect, but when I do I get this msg: Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more This is my Mojo plugin dependency: <build> org.codehaus.mojo exec-maven-plugin 1.2.1 java HiveClient I don't know if I need more properties or so, could you help me? Thank you

http://stackoverflow.com/q/25382699
has comment: http://stackoverflow.com/comment/39624763
tagged with: java
tagged with: jface
has body: I want to create a Treeview for an Eclipse-Plugin. I generated the Treeview with: _viewer = new TreeViewer(parent,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); _viewer.setContentProvider(new ViewContentProvider()); _viewer.getTree().setHeaderVisible(true); _viewer.getTree().setLinesVisible(true); _viewer.setAutoExpandLevel(1); TreeViewerColumn column = new TreeViewerColumn(_viewer, SWT.NONE); column.getColumn().setText("Package / CCID"); column.getColumn().setWidth(120); column.setLabelProvider(new ColumnLabelProvider(){ @Override public String getText(Object element) { return "test"; } } ); column = new TreeViewerColumn(_viewer, SWT.NONE); column.getColumn().setText("Stage"); column.getColumn().setWidth(100); column.setLabelProvider(new ColumnLabelProvider(){ public String getText(Object element) { return "test"; } }); Now I want to fill the Treeview with Data from DB2. DB2 contains a table with the name "Package" and a table with the name CCID. At first I want to list all packages in the table. Then I want to expand the package and show all CCID´s for each package. For example: + package 1 + package 2 + package 3 and expended: - package 1 ccid 1 ccid 2 ccid 3 - package 2 ccid 54 ccid 34 ccid 23 - package 3 ccid 32 ccid 23 ccid 23 Is there any idea to solve my problem?
has comment: http://stackoverflow.com/comment/39625285
has comment: http://stackoverflow.com/comment/39586516
type: Question
linked to: http://stackoverflow.com/q/25404594
answer count: 0
type: UnansweredQuestion
score: 0
has title: How to create a Treeview Content Provider?
tagged with: swt
tagged with: treeview

static
tags question: http://stackoverflow.com/q/25369521
tags question: http://stackoverflow.com/q/25341037
tags question: http://stackoverflow.com/q/25341916
tags question: http://stackoverflow.com/q/25349741
tags question: http://stackoverflow.com/q/25344959
tags question: http://stackoverflow.com/q/25267086
tags question: http://stackoverflow.com/q/25246357
tag name: static
tags question: http://stackoverflow.com/q/25312648
tags question: http://stackoverflow.com/q/25382143
tags question: http://stackoverflow.com/q/25315912
tags question: http://stackoverflow.com/q/25352037
tags question: http://stackoverflow.com/q/25237982
tags question: http://stackoverflow.com/q/25282244
tags question: http://stackoverflow.com/q/25264278
tags question: http://stackoverflow.com/q/25276626
type: Tag
tags question: http://stackoverflow.com/q/25371014

http://stackoverflow.com/a/25259267
downvote count: 0
answers question: http://stackoverflow.com/q/25259193
has comment: http://stackoverflow.com/comment/39356670
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39356621
upvote count: 4
has body: You first fill a list with the allowed values and then generate a random index in the bounds of this list. List&lt;Integer&gt; allowedValues = Arrays.asList(1,3,4,5,6); Random rd = new Random(); int selected = allowedValues(rd.nextInt(allowedValues.size()));
accepted answer of: http://stackoverflow.com/q/25259193
type: AcceptedAnswer

http://stackoverflow.com/q/25307473
favorite count: 0
possible better answer: http://stackoverflow.com/a/25307728
has body: I get unexpected results in my currency converter. Here is the relevant code: val = Float.parseFloat(values); us=val*0.27f; usa.setText(Float.toString(us)); pk=val=26.95f*val; pak.setText(Float.toString(pk)); u=val*0.16f; uk.setText(Float.toString(u)); om=val*0.10f; oman.setText(Float.toString(om)); ks=val*1.02f; ksa.setText(Float.toString(ks)); e=val*0.20f; eu.setText(Float.toString(e) I get: us=0.27 e=0.2 uk=0.16 ksa=1.02 oman=2.69 pak=26.95 The oman-value is not correct. Why?
type: Question
has answer: http://stackoverflow.com/a/25307787
has comment: http://stackoverflow.com/comment/39445684
has comment: http://stackoverflow.com/comment/39445256
has title: Getting unexpected results when multiply float with the number
has comment: http://stackoverflow.com/comment/39445756
has comment: http://stackoverflow.com/comment/39445512
tagged with: multiplication
tagged with: android
has comment: http://stackoverflow.com/comment/39445541
answer count: 4
tagged with: type-conversion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25307760
has answer: http://stackoverflow.com/a/25307728
has comment: http://stackoverflow.com/comment/39445710
has comment: http://stackoverflow.com/comment/39445238
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25307674
upvote count: 1
tagged with: floating-point
linked to: http://stackoverflow.com/q/3730019
downvote count: 1
has answer: http://stackoverflow.com/a/25307674

http://stackoverflow.com/a/25354388
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25336464
downvote count: 0
upvote count: 1
has body: For some reason, changing the JRE system library from JRE8 to JRE7 works.
type: Answer
accepted answer of: http://stackoverflow.com/q/25336464
score: 1

http://stackoverflow.com/comment/39534978
type: Comment
has text: what exception you are getting?please post full error stack trace.
type: QuestionComment
comment on: http://stackoverflow.com/q/25356493
score: 0

http://stackoverflow.com/comment/39420452
type: Comment
comment on: http://stackoverflow.com/a/25292877
has text: actually i tried with changing the time only in the date and time settings and it didn't work either, i think it has something to do with if(calSet.compareTo(calNow) <= 0){ //Today Set time passed, count to tomorrow calSet.add(Calendar.DATE, 1); } in the code below
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39319355
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25239450
has text: what design issue could be caused by returning null in catch block?

http://stackoverflow.com/a/25290011
has comment: http://stackoverflow.com/comment/39412874
answers question: http://stackoverflow.com/q/25289816
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39413154
score: 3
has comment: http://stackoverflow.com/comment/39414294
has comment: http://stackoverflow.com/comment/39413429
upvote count: 3
has comment: http://stackoverflow.com/comment/39414347
has comment: http://stackoverflow.com/comment/39413582
has comment: http://stackoverflow.com/comment/39413854
has body: The simplest solution would be public LazyValue getLazyValue() { return new LazyValue(state.toString(), 42); } as LazyValue is a trivial object which is not worth to be remembered at all. If an expensive computation is involved you can turn the LazyValue into a true immutable object by declaring its fields final: public static class LazyValue { private final String name; private final int value; // … this way you could publish the instance even through a data race: // with lazyValue even not being volatile public LazyValue getLazyValue() { return lazyValue!=null? lazyValue: (lazyValue=new LazyValue(state.toString(), 42)); } In this case the value might be calculated multiple times in the unlikely case that multiple threads access it concurrently but once a thread sees a non-null value, it will be a correctly initialized value due to the final field initialization guaranty. If the calculation is so expensive that even an unlikely concurrent calculation must be avoided, then simply declare getLazyValue() synchronized as its overhead will be negligible compared to the calculation that will be saved. Finally, if you really encounter a scenario were the computation is so heavy, that overlapping concurrent computation must be avoided at all cost but profiling shows that later-on synchronization is a bottleneck, you might have encountered one of the very rare cases were double-checked locking could be an option (really rare). In this case, there’s still an alternative to your question’s code. Combine the DCL with my suggestion above of declaring all LazyValue’s fields as final and make the lazyValue holder field non-volatile. That way you can even save the volatile read after the lazy value has been constructed. However, I still say, it should be really rarely needed. Maybe that’s the non-technical reason why DCL has so much negative reputation: it’s appearance in discussions (or on StackOverflow) is way out of all proportion to its real need.

http://stackoverflow.com/comment/39415742
has text: isHidden is a variable to determine if the room is accessible by the player outright. If isHidden isn't set by a constructor, it defaults to false
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25291390

http://stackoverflow.com/comment/39353995
comment on: http://stackoverflow.com/a/25237635
score: 0
type: Comment
type: AnswerComment
has text: you mean `InputStreamReader isr=new InputStreamReader(socket.getInputStream) isr.read();` ?

vertical-scrolling
type: Tag
tags question: http://stackoverflow.com/q/25304941
tag name: vertical-scrolling

http://stackoverflow.com/a/25308549
score: 0
type: Answer
has body: Just to be on the safe side, you're can't declare a method within a method. You're can declare an anonymous class within a method, and that anonymous class can be passed your implementation of the methods that it needs to be instantiated. Your original method is missing a }. You can not declare methods inside of methods in this way. Another option here is to look at the command pattern. For example: public interface Command { public void execute(); } You can then create classes, as follows: public class HelloCommand implements Command { public void execute() { System.out.println("Hello!"); } } Now, you can access a class, and it can be invoked like a method. Command hello = new HelloCommand(); hello.execute(); // prints "Hello!"
answers question: http://stackoverflow.com/q/25308474

http://stackoverflow.com/comment/39587827
comment on: http://stackoverflow.com/a/25384066
score: 0
has text: PS: you should note the "reading or updating" change I made. You nee to synchronize every time you use the variable, not just when changing it. That's how you can be sure changes will always be properly seen by all threads.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/69103473
comment on: http://stackoverflow.com/a/25281889
type: Comment
has text: My use case is: Template model having list of definition model in it. So I want to create an object of Template and inside it will be a list of definitions.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39473631
has text: Could you clarify what you mean by state?
comment on: http://stackoverflow.com/a/25322595
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39572864
comment on: http://stackoverflow.com/q/25376254
score: 1
has text: Do you build with C++11 enabled?
type: QuestionComment
type: Comment

logging
tags question: http://stackoverflow.com/q/25376721
tags question: http://stackoverflow.com/q/25325478
tags question: http://stackoverflow.com/q/25379127
tags question: http://stackoverflow.com/q/25316012
tags question: http://stackoverflow.com/q/25303565
tag name: logging
tags question: http://stackoverflow.com/q/25328038
tags question: http://stackoverflow.com/q/25285710
tags question: http://stackoverflow.com/q/25294165
tags question: http://stackoverflow.com/q/25240899
tags question: http://stackoverflow.com/q/25284278
tags question: http://stackoverflow.com/q/25386566
tags question: http://stackoverflow.com/q/25255622
tags question: http://stackoverflow.com/q/25289105
tags question: http://stackoverflow.com/q/25386651
tags question: http://stackoverflow.com/q/25279312
type: Tag
tags question: http://stackoverflow.com/q/25277895

http://stackoverflow.com/comment/39342798
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25251478
has text: what do you think `thread.join();` does, exactly ?

http://stackoverflow.com/comment/39465231
score: 0
comment on: http://stackoverflow.com/q/25316761
type: Comment
type: QuestionComment
has text: @isim I just added the persist code as an edit to the end of my original posting above. Does this help you?

http://stackoverflow.com/a/25374324
has comment: http://stackoverflow.com/comment/39569553
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39569363
type: AcceptedAnswer
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/25374223
has comment: http://stackoverflow.com/comment/39569533
accepted answer of: http://stackoverflow.com/q/25374223
has comment: http://stackoverflow.com/comment/39569417
has comment: http://stackoverflow.com/comment/39592618
has comment: http://stackoverflow.com/comment/39569458
has comment: http://stackoverflow.com/comment/39599105
has comment: http://stackoverflow.com/comment/39571183
has body: If you call Thread.sleep(1000) from inside the doInBackground() method, this will not affect the UI since doInBackground() is called on a background thread.
has comment: http://stackoverflow.com/comment/39569715
has comment: http://stackoverflow.com/comment/39593368

http://stackoverflow.com/comment/39586645
type: Comment
type: AnswerComment
has text: I have made a bit more progress with this. This is only an issue when using the embedded driver connection. I have also noticed that the database appears to be being created but it is being put in the root of the package, should this not be in the "dist" folder?
score: 0
comment on: http://stackoverflow.com/a/25343477

http://stackoverflow.com/a/45007233
upvote count: 3
downvote count: 0
type: Answer
has body: You can change interface name from SomethingMBean to SomethingMXBean,such as HelloMBean to HelloMXBean,from jdk's source code i saw this: public static boolean isMXBeanInterface(Class&lt;?&gt; interfaceClass) { if (!interfaceClass.isInterface()) return false; if (!Modifier.isPublic(interfaceClass.getModifiers()) &amp;&amp; !Introspector.ALLOW_NONPUBLIC_MBEAN) { return false; } MXBean a = interfaceClass.getAnnotation(MXBean.class); if (a != null) return a.value(); return interfaceClass.getName().endsWith("MXBean"); } if not endsWith "MXBean",it will return false,then cause throw IllegalArgumentException jdk version:1.8.0_25 class is "JMX",line 376
answers question: http://stackoverflow.com/q/25308744
score: 3

http://stackoverflow.com/q/25364025
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/25364433
tagged with: sequence
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25364433
tagged with: label
has title: JavaFX, order of commands (seemingly) ignored
has body: I'm programing in JavaFX under java1.7, and everything works with my code except this part. The problem is, only the end result gets written out. While the program runs, I want it to display the "Ping test is running" text in the Label. But it won't do that, but instead waits a couple of seconds (till the ping finishes), than it writes out the result of the ping. Which looks bad, cause for 3-4 secs nothing happens and the user can think that it froze or something... hence the message I want to write out. So, can someone tell me why this is happening and how to fix it? Thank you for your time. PS: yes it needs to wait a few secs, in the PingIp(...), so i can read the needed info correctly, otherwise I'm getting the null pointer error. @FXML private Label Ping; @FXML private void Button(ActionEvent event) throws IOException { String text; Ping.setWrapText(true); Ping.setText("Ping test is running"); text = PingIp.PingWifiAddr(GetIp.retIpWifi()).toString(); text = text.substring(1, (text.length()-1)); TeltonikaPing.setWrapText(true); TeltonikaPing.setText(text); } below is the edited part @FXML private void ciscoButton(ActionEvent event) throws IOException { CiscoPing.setWrapText(true); Task&lt;Void&gt; task1 = new Task&lt;Void&gt;() { @Override public Void call() throws IOException { String text1; text1 = "Ping teszt folyamatban"; Ping.setWrapText(true); Ping.setText(text1); return null; } }; new Thread(task1).start(); Task&lt;Void&gt; task = new Task&lt;Void&gt;() { @Override public Void call() throws IOException { String text2 = PingIp.PingEtherAddr(GetIp.retIpEther()).toString(); text2 = text2.substring(1, (text2.length() - 1)); Ping.setWrapText(true); Ping.setText(text2); return null; } }; new Thread(task).start(); } Above is the edited one, any ideas?
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39465205
comment on: http://stackoverflow.com/q/25317684
type: QuestionComment
score: 0
has text: I'm going to try the second option that you gave. Thanks. @jewelsea
type: Comment

http://stackoverflow.com/comment/39539251
type: Comment
type: QuestionComment
score: 0
has text: Possible duplicate : http://stackoverflow.com/questions/1816673/how-do-i-check-if-a-file-exists-java-on-windows
comment on: http://stackoverflow.com/q/25358836

http://stackoverflow.com/q/25247958
accepted answer: http://stackoverflow.com/a/25248054
possible better answer: http://stackoverflow.com/a/25248157
type: AnsweredQuestion
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25248054
favorite count: 0
has title: How to store into Byte or Byte array
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39335121
tagged with: byte
type: Question
has body: This message is coming from external system and this is coming as bytes, I have to use it in my Java code. I am taking it as a byte and converting to String. Can anyone help me to accept it as byte only instead of taking it to string and converting to byte. Here is the output from that external system till equals to: wcLDxMXGx8jJ0fHy8/T1AHsSNFw= I want to store it either in byte or byte[]. I have tried doing it myself but it says error at =. I have to use it as byte only as taking it as String and then converting to byte will be problematic and not as expected.
has answer: http://stackoverflow.com/a/25248157
tagged with: java
tagged with: tibco

http://stackoverflow.com/q/25262301
tagged with: java
tagged with: jaxb
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
answer count: 1
has body: I have XML which contains XML and i want parse it using JAXB <DATA>qwqweqwe zxc asdasd eee parser public static NotificationRequest parse(String xml) throws ParserConfigurationException, SAXException, JAXBException { xml = makeXMLValid(xml); NotificationRequest ret = new NotificationRequest(); JAXBContext jaxbContext = JAXBContext .newInstance(NotificationRequest.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); ret = (NotificationRequest) jaxbUnmarshaller .unmarshal(new StringReader(xml)); return ret; } NotificationRequest @XmlAnyElement(value = XMLParserDataHandler.class) public String DATA; @XmlAnyElement(value = XMLParserTempmHandler.class) public String TEMPM; XMLPArserDataHandler private static final String PARAMETERS_START_TAG = "<DATA>"; private static final String PARAMETERS_END_TAG = " "; private StringWriter xmlWriter = new StringWriter(); @Override public StreamResult createUnmarshaller(ValidationEventHandler errorHandler) { return new StreamResult(xmlWriter); } @Override public String getElement(StreamResult rt) { String xml = rt.getWriter().toString(); int beginIndex = xml.indexOf(PARAMETERS_START_TAG) + PARAMETERS_START_TAG.length(); int endIndex = xml.indexOf(PARAMETERS_END_TAG); return xml.substring(beginIndex, endIndex); } @Override public Source marshal(String n, ValidationEventHandler errorHandler) { try { String xml = PARAMETERS_START_TAG + n.trim() + PARAMETERS_END_TAG; StringReader xmlReader = new StringReader(xml); return new StreamSource(xmlReader); } catch (Exception e) { throw new RuntimeException(e); } } XMLParserTampmHandler (Similar to DATA handler) ... private static final String PARAMETERS_START_TAG = " "; private static final String PARAMETERS_END_TAG = " "; .... And when I run NotificationRequest request = XMLParser.parse(xml); System.out.println(request.TEMPM); System.out.println(request.DATA); On output I see null qwqweqwe zxc When I change order in XML to asdasd eee <DATA>qwqweqwe zxc I get error Exception…
has title: Tags order when getting XML from XML element (XML contains XML)?
type: Question
has answer: http://stackoverflow.com/a/25269927
has comment: http://stackoverflow.com/comment/39371459
score: 0

http://stackoverflow.com/comment/39380718
type: Comment
comment on: http://stackoverflow.com/q/25272420
score: 0
has text: You asked the same question one hour ago, and it was closed already. Don't ask the same question again and again. Read the answer to the already answered identical question.
type: QuestionComment

http://stackoverflow.com/q/25298319
tagged with: jpanel
has title: Paint on a glass pane without repainting other components
favorite count: 0
type: Question
has body: Let's say I have a JPanel called content with its paintComponent(g) overridden. This panel usually paints very quickly, but sometimes (Clarification: the user generates a graphics object that can have thousands of points, which slows down the rendering. It needs to be this way and it's not part of my question) it may take a whole second to repaint due to all of the graphics stuff going on in it. I want to paint a dot near the location of the mouse, but I want this to update quickly and not have to repaint content every time the mouse is moved. What I tried to do was paint it on a glass pane, like this: class LabelGlassPane extends JComponent { public LabelGlassPane(JApplet frame) { this.frame = frame; } public JApplet frame; public void paintComponent(Graphics g) { if(ell != null){ g2.setColor(Vars.overDot); g2.fill(ell); //this is an ellipse field that was created in the mouesmoved() listener } } } My issue is that even though I now only update this glass pane when the mouse is moved, it's repainting all of the other components in the applet when I call repaint() on it. How can I paint to this glass pane (or have another way of painting) without it painting the components below? Thanks. EDIT: Here is a simple example. jp should not update when the mouse is moved, but it is. public class Glasspanetest extends JApplet implements Runnable{ public void init() { setLayout(new BorderLayout()); GraphicsPanel jp = new GraphicsPanel(); add(jp, BorderLayout.CENTER); glass = new LabelGlassPane(this); this.setGlassPane(glass); glass.setVisible(true); } class GraphicsPanel extends JPanel{ public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.red); g.fillOval(50, 50, 50, 50); System.err.println("Painting bottom panel"); } } public LabelGlassPane glass = null; public Ellipse2D.Double ell = null; class LabelGlassPane extends JComponent { public LabelGlassPane(JApplet frame) { this.frame = frame; this.addMouseMotionListener(new MoveInfoListener()); } pub…
has comment: http://stackoverflow.com/comment/39428698
has comment: http://stackoverflow.com/comment/39428702
has comment: http://stackoverflow.com/comment/39428945
has comment: http://stackoverflow.com/comment/39428783
has comment: http://stackoverflow.com/comment/39431121
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/25304123
has comment: http://stackoverflow.com/comment/39428900
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39430606
has answer: http://stackoverflow.com/a/25304123
linked to: http://stackoverflow.com/q/2064427
score: 1
tagged with: graphics2d
tagged with: java
has comment: http://stackoverflow.com/comment/39428956
answer count: 1
downvote count: 0

persian
tags question: http://stackoverflow.com/q/25381262
tag name: persian
type: Tag

http://stackoverflow.com/comment/39412008
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25289528
has text: Which file did you download? You will need to use `dpkg` to install it, not apt-get.
type: Comment

http://stackoverflow.com/a/25387581
has comment: http://stackoverflow.com/comment/39594136
answers question: http://stackoverflow.com/q/25387515
score: 0
has comment: http://stackoverflow.com/comment/39594168
type: Answer
has body: You need to include the purpose of your code for others to figure out what is the problem with it. The issues I see are: Your while loop would never start because the initial assignment for "number" is out of range. Also, I see you increment "number" by 1, so your "% 1.25" will never execute. If you just need to loop from 6 to 28 using the code similar to yours, should be something like this: int number = 6; while (number &lt; 29) { System.out.println(number); number++; }

http://stackoverflow.com/a/25512206
downvote count: 0
answers question: http://stackoverflow.com/q/25252783
upvote count: 1
has body: I looked through the SOLR source code and it was fairly straight forward to add a pf1 parameter to the edismax query parser - pf2 and pf3 use more general functions that can be called for pf1. However I really didn't want to have to recompile solr from source. I've managed a work around using nested queries. I now have &lt;str name="qf"&gt; name^1 keywords1^2 keywords2^1.2 description^0.2 &lt;/str&gt; And my query now looks like q=(foo bar) AND _query_:"{!edismax qf='name'}foo bar" So I get all the boosting of the first query but I restrict on name.
type: Answer
score: 1

http://stackoverflow.com/q/25383501
tagged with: rpc
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39588428
favorite count: 0
type: Question
has title: GWT RPC specific collection type in method signature - still recommended?
linked to: http://stackoverflow.com/q/6059211
tagged with: gwt-rpc
tagged with: collections
has comment: http://stackoverflow.com/comment/39586783
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39588099
has body: I read some articles saying that in RPC methods a specific collection (like ArrayList instead List) should be used. Is this still valid or is this not necessary anymore in the newer versions of GWT? Because in the RPC article in the official documentation this is not mentioned and I saw several examples that use generic collections like List.
has answer: http://stackoverflow.com/a/25398050
accepted answer: http://stackoverflow.com/a/25398050
downvote count: 0
has comment: http://stackoverflow.com/comment/39585930
linked to: http://stackoverflow.com/q/3059787
upvote count: 1
score: 1

http://stackoverflow.com/comment/39378284
has text: As server is always reading data from browser and is waiting for data from browser.I think you need to write a separate thread that will read data from the socket.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25271130

http://stackoverflow.com/q/25318863
has answer: http://stackoverflow.com/a/25318882
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
tagged with: jax-rs
tagged with: jaxb
score: 1
favorite count: 0
type: Question
has body: There are a million of these JAX-RS serialization snowflakes. Let me add one more. I have a JPA/JAXb annotated class: @Entity @XmlRootElement public class Foo implements Serializable { //.. } I have a service that seeks to return a list of these objects as JSON: @Path("foo") public class FooService { @GET @Produces(MediaType.APPLICATION_JSON) public Response listFoos() { // get hibernate session List&lt;Foo&gt; foos = session.createQuery("from Foo").list(); GenericEntity&lt;List&lt;Foo&gt;&gt; entity = new GenericEntity&lt;List&lt;Foo&gt;&gt;(foos) {}; return Response.ok(entity).build(); } } I have tried a number of variations. The one that looks the best, to me is like @GET @Produces(MediaType.APPLICATION_JSON) public List&lt;Foo&gt; listFoos() { // get session .. return session.createQuery("from Foo").list(); } All give me some slight variation of: SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List&lt;com.bar.baz.Foo&gt;.
tagged with: jersey
downvote count: 0
type: UnansweredQuestion
answer count: 1
has title: Jersey - return list of XmlRootElement/Entities - MessageBodyWriter not found

http://stackoverflow.com/q/25271894
has body: How you do enable Objectify to automatically discover your annotated Entity classes at runtime? I want to register my classes at application start up and not have to hard code them into a class as recommended in the documentation.
type: AnsweredQuestion
answer count: 2
has title: How to automatically register @Entity decorated classes at application start up?
tagged with: java
possible better answer: http://stackoverflow.com/a/38236110
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/38236110
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25271913
tagged with: objectify
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25271913
downvote count: 0

http://stackoverflow.com/a/25348225
answers question: http://stackoverflow.com/q/25344320
score: 19
upvote count: 19
type: Answer
downvote count: 0
has body: This is a common question that arises when learning Rx. TL;DR Your suggestion to put your exception handling logic in the subscriber is preferable over creating a generic observable wrapper. Explanation Remember, that Rx is about pushing events to subscribers. From the observable interface, it's clear there's not really anything an observable can know about it's subscribers other than how long they took to handle an event, or the information contained in any thrown exceptions. A generic wrapper to handle subscriber exceptions and carry on sending events to that subscriber is a bad idea. Why? Well the observable should only really know that the subscriber is now in an unknown failure state. To carry on sending events in this situation is unwise - perhaps, for example, the subscriber is in a condition where every event from this point forward is going to throw an exception and take a while to do it. Once a subscriber has thrown an exception, there are only two viable courses of action for the observable: Re-throw the exception Implement generic handling to log the failure and stop sending it events (of any kind) and clean up any resources due to that subscriber and carry on with any remaining subscriptions. Specific handling of subscriber exceptions would be a poor design choice; it would create inappropriate behavioural coupling between subscriber and observable. So if you want to be resilient to bad subscribers the two choices above are really the sensible limit of responsibility of the observable itself. If you want your subscriber to be resilient and carry on, then you should absolutely wrap it in exception handling logic designed to handle the specific exceptions you know how to recover from (and perhaps to handle transient exceptions, logging, retry logic, circuit breaking etc.). Only the subscriber itself will have the context to understand whether it is fit to receive further events in the face of failure. If your situation warrants developing reusable error h…
accepted answer of: http://stackoverflow.com/q/25344320
type: AcceptedAnswer

http://stackoverflow.com/q/25344759
has body: so I just downloaded eclipse and it came with a basic hello world program, and the auto complete works on this. It will work with the auto trigger "." and by using ctrl+space, and it shows all the suggestions you would expect. When I started my own project though, the auto correct must be called to work and there are not any suggestions in the auto complete drop down box. Does anyone know what could cause this????
score: 0
tagged with: java
answer count: 1
has title: eclipse auto complete malfunction or op. error
tagged with: eclipse
has answer: http://stackoverflow.com/a/25345407
type: Question
has comment: http://stackoverflow.com/comment/39515454
type: UnansweredQuestion

http://stackoverflow.com/comment/39497782
has text: There's nothing wrong with having singletons per say. The singleton accessor is the problem (CC @JBNizet )
score: 0
comment on: http://stackoverflow.com/q/25334943
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25246529
has comment: http://stackoverflow.com/comment/39336350
downvote count: 0
has comment: http://stackoverflow.com/comment/39332723
has comment: http://stackoverflow.com/comment/39332958
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25259753
has comment: http://stackoverflow.com/comment/39334154
has comment: http://stackoverflow.com/comment/39336520
has comment: http://stackoverflow.com/comment/39342184
answer count: 1
has comment: http://stackoverflow.com/comment/39336541
tagged with: struts2
has comment: http://stackoverflow.com/comment/39357647
has comment: http://stackoverflow.com/comment/39342195
type: Question
tagged with: java
has body: I'm getting a 404 on an action and the message: result 'null' not found The mapping for the action is: uploadFile /jsp/main/bip/submssionError.jsp I've tried various combinations - being more explicit - nothing works, latest version: uploadFile /jsp/main/bip/submssionError.jsp I've added a debug line in the action and it looks like it doesn't even get called - as nothing gets output. I upped the debugging on the logs and got: [DEBUG] 2014-08-11 15:49:55,852 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts] [DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts] [DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.DefaultActionProxy - Creating an DefaultActionProxy for namespace [/] and action name [startSubmission] [DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept '//startSubmission' { [DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - applied invocation context locale=en_GB [DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - before Locale=en_GB [DEBUG] 2014-08-11 15:49:55,854 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[rang.ui.actions.submission.StartSubmissionAction@35d2bd5f, com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts] [DEBUG] 2014-08-11 15:49:55,871 org.apache.struts2.interceptor.FileUploadInterceptor - Bypassing //startSubmission [DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.interceptor.StaticParametersInterceptor - Setting static parameters {} [DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting params NONE [DEBUG] 2014-08-11 15:49:5…
has comment: http://stackoverflow.com/comment/39334904
has comment: http://stackoverflow.com/comment/39334250
has comment: http://stackoverflow.com/comment/39334340
has comment: http://stackoverflow.com/comment/39332965
favorite count: 0
has title: Java - Struts 2: result 'null' not found
has answer: http://stackoverflow.com/a/25259753
type: AnsweredQuestion

http://stackoverflow.com/comment/39316510
has text: Why would you want to create objects of ConnectionProvider to get the connection object. Static methods avoid this and hence is more efficient
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25237982

http://stackoverflow.com/comment/39417232
type: Comment
score: 0
has text: Where do you extract the links from a document?
comment on: http://stackoverflow.com/q/25289726
type: QuestionComment

http://stackoverflow.com/comment/39443609
type: QuestionComment
comment on: http://stackoverflow.com/q/25306503
has text: Yes, as Android said, just use a `Service`. The whole idea with `Application`s is that they are visible.
score: 0
type: Comment

http://stackoverflow.com/q/25368339
has comment: http://stackoverflow.com/comment/39558114
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/131428027
has comment: http://stackoverflow.com/comment/39557641
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39558199
favorite count: 0
type: Question
has body: I am quite new to Java. I decided to code tic-tac-toe as practice (from scratch). Anyway, I am trying to have the 'JLabel label' change when I click; going from 1, then 2, etc. Eventually, it will change to something other than numbers. But, for now, it works for a test. The 'System.out.println("Number of clicks: " + mouseIn);' works fine, and produces the output I want. A picture of the console and JFrame/JPanel/JLabel can be seen here: (The little 1 in the JFrame is the JLabel. I want to match what is output in the console. I have googled, and searched, and tried everything I know (which ain't much!) and I can't get the dang thing to work...I'm just asking for some guidance. Main method just includes building of JFrame/Panel. Code below: From the main class, called (namone.java [named it this for my own reasons]): public void run(JPanel p) //Takes panel from main method { for(int i = 0; i < ticList.length; i++){ ticList[i] = new JButton(buttonText); //For every position in //ticList[], create a JButton object p.add(ticList[i]); ticList[i].setPreferredSize(new Dimension(140,140)); ticList[i].addMouseListener(mouse); //Load mouseListner } //Set mouseIn to click value in MouseEvents Class int mouseIn = mouse.getClicks(); //Set text value to text value in MouseEvents class text = mouse.getText(); //Output... System.out.println("Number of clicks: " + mouseIn); //For testing String mouse = Integer.toString(mouseIn); //Convert mouseIn value (from MouseEvents.java) to mouse JLabel label = new JLabel(); //New JLabel p.add(label); //Add label to screen label.setText(mouse); //Set the text of the label to value of mouse System.out.println(mouse); //For testing //So I can see if it's working (clicks wise) } And then the code from my MouseEvents.java class: public class MouseEvents extends namone implements MouseListener { int clicks = 1; String text = "first"; //For testing purposes public namone game = new namone(); public int getClicks(){ return clicks; } public String getT…
accepted answer: http://stackoverflow.com/a/25368743
has comment: http://stackoverflow.com/comment/39558051
has answer: http://stackoverflow.com/a/25368743
has comment: http://stackoverflow.com/comment/39557451
tagged with: swing
has title: How can I solve Java JLabel issues in application?

http://stackoverflow.com/comment/39506665
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25339134
has text: @lukassz: I have updated the code in the [previous link](https://www.dropbox.com/s/bh1vw2vq2quyq3s), to actually adhere to Swing's single thread rule. Do check it out again, this time it will work without any errors of any sort, just run the `JAR` file./database.rar

http://stackoverflow.com/a/25374186
type: Answer
score: 3
answers question: http://stackoverflow.com/q/25374086
upvote count: 3
downvote count: 0
has body: You should double check your shows second column. I'm not sure you can use a column named date. Anyway, you should certainly use a PreparedStatement with something like, String sql = "SELECT eventname, eventdate FROM shows WHERE artist LIKE ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(sql); ps.setString(1, artist); rs = ps.executeQuery(); while (rs.next()) { String eventName = rs.getString("eventname"); Date eventDate = rs.getDate("eventdate"); // Use your columns in your row here. } } catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if (ps != null) { try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/39568995
has comment: http://stackoverflow.com/comment/39569077

http://stackoverflow.com/comment/39382575
type: Comment
has text: Also, just to be really sure - you're sure your device is an x86 device, not an arm one?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25273324

http://stackoverflow.com/a/25317990
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25317934
has comment: http://stackoverflow.com/comment/39465161
downvote count: 1
has comment: http://stackoverflow.com/comment/39465124
upvote count: 0
has body: I think to achieve your goal, you can just use different layout files (&lt;layoutname&gt;.xml) and then you can switch the layout if everything is fine by just doing setContentView(R.layout.&lt;layoutname&gt;) inside your activiy. Of course, you could use different activities but it is not necessarily needed and especially if you have a smaller app, it's enough to just switch layouts. But if you do so, you have to watch out for NullPointerException's because if you are doing findViewById() and you supply an id of a view on a different layout than the current, you will get null back and then receive the NPE when trying to access the view.
has comment: http://stackoverflow.com/comment/39465268

http://stackoverflow.com/q/25234032
possible better answer: http://stackoverflow.com/a/25234201
has comment: http://stackoverflow.com/comment/39308949
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/25234201
has answer: http://stackoverflow.com/a/25234189
tagged with: string
has answer: http://stackoverflow.com/a/25234144
downvote count: 1
has title: Disappearing Arraylist Values
favorite count: 0
accepted answer: http://stackoverflow.com/a/25234081
type: Question
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25234081
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25234220
has comment: http://stackoverflow.com/comment/39309193
has body: I am writing a Java program that will take a sentence (or phrase) and translate it into a group of objects that the computer can easily read. I wanted to make a simple word separating program, and then extend it later on. My code is like this: package Literary; import java.util.ArrayList; public class WordParser { public static String[] getWords(String tempone){ ArrayList&lt;String&gt; temptwo = new ArrayList(); ArrayList&lt;Character&gt; tempthree = new ArrayList(); for (int tempfour = 0; tempfour == tempone.length() - 1; tempfour++){ if (tempone.charAt(tempfour) != ' '){ tempthree.add(tempone.charAt(tempfour)); } else { temptwo.add(getStringRepresentation(tempthree)); tempthree.clear(); } } String[] tempfive = new String[temptwo.size()]; for (int tempfour = 0; tempfour == tempfive.length - 1; tempfour++){ tempfive[tempfour] = temptwo.get(tempfour); } return tempfive; } /** Courtesy of Vineet Reynolds on StackExchange. * * "You can iterate through the list and create the string." * * @param list * @return */ public static String getStringRepresentation(ArrayList&lt;Character&gt; list){ StringBuilder builder = new StringBuilder(list.size()); for(int i = 0; i == list.size() + 1; i++) { builder.append(list.get(i).charValue()); } return builder.toString(); } } It's supposed to receive a string as an input, and return a list of strings that have been separated by spaces. But when I run my main class: import Literary.WordParser; public class Start { public static void main(String[] args) { String x = "There was once a sword in the stone"; String[] tempstring = WordParser.getWords(x); for (int i = 1; i == tempstring.length; i++){ System.out.println("Word " + i + " : " + tempstring[i]); } } } The console tells me nothing except run: and BUILD SUCCESSFUL (total time: 1 second). I'm using Netbeans 8 and Java 1.7 if that helps.
has comment: http://stackoverflow.com/comment/39309015

http://stackoverflow.com/comment/39473541
has text: This time(after modifying as you suggested), I'm getting an IllegalAccessException
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25322599
type: AnswerComment

http://stackoverflow.com/a/59372950
score: 0
has body: You should try to add following line in the Memory ARGS: field in Tomcat setting. -XX:NewSize=700m -XX:MaxNewSize=700m -Xms1024m -Xmx2048m -XX:MaxPermSize=768m You can see in the link. Screenshot
type: Answer
answers question: http://stackoverflow.com/q/25242984

http://stackoverflow.com/comment/39431187
type: AnswerComment
comment on: http://stackoverflow.com/a/25266264
score: 0
type: Comment
has text: You're running into trouble because I guess you're still having your loops try to do more than one thing, so try this to separate the functionality clearly : Split your code into three functions - the main has the controlling loop, a "generateAnAnswer()" that returns an 'answer' less than 30, and an 'isDuplicate()' that returns true/false. 'generateAnAnswer' is NOT to check for duplicates, and 'isDuplicate' is NOT to re-calculate 'answer'. The main function simply loops depending on what isDuplicate() returns.

http://stackoverflow.com/comment/39539580
type: Comment
score: 0
type: AnswerComment
has text: It returns null. I am using a simulator. But, regardless, I need to get valid directories. Thanks for your response, btw.
comment on: http://stackoverflow.com/a/25357536

http://stackoverflow.com/comment/39548513
comment on: http://stackoverflow.com/q/25362255
has text: possible duplicate of [Jena Fuseki Server command not found](http://stackoverflow.com/questions/11141889/jena-fuseki-server-command-not-found)
score: 1
type: Comment
type: QuestionComment

mysql
tags question: http://stackoverflow.com/q/25374086
tags question: http://stackoverflow.com/q/25239938
tags question: http://stackoverflow.com/q/25312861
tags question: http://stackoverflow.com/q/25380453
tags question: http://stackoverflow.com/q/25331920
tags question: http://stackoverflow.com/q/25291159
tags question: http://stackoverflow.com/q/25358141
tags question: http://stackoverflow.com/q/25235466
tags question: http://stackoverflow.com/q/25369123
tags question: http://stackoverflow.com/q/25387105
tags question: http://stackoverflow.com/q/25295695
tags question: http://stackoverflow.com/q/25310030
tags question: http://stackoverflow.com/q/25234860
tags question: http://stackoverflow.com/q/25388086
type: Tag
tags question: http://stackoverflow.com/q/25287619
tags question: http://stackoverflow.com/q/25307825
tags question: http://stackoverflow.com/q/25251577
tags question: http://stackoverflow.com/q/25356600
tags question: http://stackoverflow.com/q/25271333
tags question: http://stackoverflow.com/q/25356989
tags question: http://stackoverflow.com/q/25356260
tags question: http://stackoverflow.com/q/25348604
tags question: http://stackoverflow.com/q/25333102
tag name: mysql
tags question: http://stackoverflow.com/q/25263015
tags question: http://stackoverflow.com/q/25324920
tags question: http://stackoverflow.com/q/25291133
tags question: http://stackoverflow.com/q/25313419
tags question: http://stackoverflow.com/q/25286745
tags question: http://stackoverflow.com/q/25269148
tags question: http://stackoverflow.com/q/25388889
tags question: http://stackoverflow.com/q/25246858
tags question: http://stackoverflow.com/q/25315099
tags question: http://stackoverflow.com/q/25283215
tags question: http://stackoverflow.com/q/25319880
tags question: http://stackoverflow.com/q/25272446
tags question: http://stackoverflow.com/q/25242002
tags question: http://stackoverflow.com/q/25327822
tags question: http://stackoverflow.com/q/25255183
tags question: http://stackoverflow.com/q/25259195
tags question: http://stackoverflow.com/q/25378448
tags question: http://stackoverflow.com/q/25326661
tags question: http://stackoverflow.com/q/25309741
tags question: http://stackoverflow.com/q/25239801
tags question: http://stackoverflow.com/q/25377939
tags question: http://stackoverflow.com/q/25363324
tags question: http://stackoverflow.com/q/25324739
tags question: http://stackoverflow.com/q/25257842
tags question: http://stackoverflow.com/q/25321724
tags question: http://stackoverflow.com/q/25239319
tags question: http://stackoverflow.com/q/25231401
tags question: http://stackoverflow.com/q/25305380
tags question: http://stackoverflow.com/q/25384956
tags question: http://stackoverflow.com/q/25309193
tags question: http://stackoverflow.com/q/25388069
tags question: http://stackoverflow.com/q/25236792
tags question: http://stackoverflow.com/q/25252541
tags question: http://stackoverflow.com/q/25349516
tags question: http://stackoverflow.com/q/25303119
tags question: http://stackoverflow.com/q/25264460
tags question: http://stackoverflow.com/q/25373009
tags question: http://stackoverflow.com/q/25321720
tags question: http://stackoverflow.com/q/25241953
tags question: http://stackoverflow.com/q/25248681
tags question: http://stackoverflow.com/q/25381783
tags question: http://stackoverflow.com/q/25329291
tags question: http://stackoverflow.com/q/25325122
tags question: http://stackoverflow.com/q/25352393
tags question: http://stackoverflow.com/q/25341229
tags question: http://stackoverflow.com/q/25264473
tags question: http://stackoverflow.com/q/25250352
tags question: http://stackoverflow.com/q/25318776
tags question: http://stackoverflow.com/q/25244414
tags question: http://stackoverflow.com/q/25299611
tags question: http://stackoverflow.com/q/25381168
tags question: http://stackoverflow.com/q/25278144
tags question: http://stackoverflow.com/q/25270672
tags question: http://stackoverflow.com/q/25244041
tags question: http://stackoverflow.com/q/25239413

http://stackoverflow.com/q/25287175
favorite count: 0
type: Question
tagged with: android-contentprovider
has title: add new column in default contacts content provider of android
score: 4
has answer: http://stackoverflow.com/a/25287424
accepted answer: http://stackoverflow.com/a/25287424
has body: I have requirement to add new column in default contacts table provided by android so can I do that .I just want to add a new value in that column if it is added from my application.So please tell me if it is possible . Edit:My aim is to add data in defaults contacts table programatically so that it will also be visible when user opens default phonebook.
has comment: http://stackoverflow.com/comment/39407260
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39407308
downvote count: 0
tagged with: android
tagged with: java
answer count: 1
upvote count: 4

http://stackoverflow.com/q/25300335
tagged with: java
has comment: http://stackoverflow.com/comment/39432665
has comment: http://stackoverflow.com/comment/39432261
has comment: http://stackoverflow.com/comment/39432424
has comment: http://stackoverflow.com/comment/39432177
has comment: http://stackoverflow.com/comment/39432221
has comment: http://stackoverflow.com/comment/39432294
type: Question
has title: Error:including packages
has body: I want to run the java code in command prompt.getting error: class interface or enum expected.Where to include packages(class files) in java file when java file need to run in command prompt.. My java code is: import java.io.File; import java.io.IOException; import java.io.OutputStream; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; import java.org.xiph.speex.AudioFileWriter; import org.xiph.speex.OggSpeexWriter; import org.xiph.speex.PcmWaveWriter; import java.org.xiph.speex.RawWriter; import javax.sound.sampled.AudioFileWriter; /** * Java Speex Command Line Encoder. * * Currently this code has been updated to be compatible with release 1.0.3. * * @author Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com) * @version $Revision: 1.5 $ */ public class JSpeexEnc { /** Version of the Speex Encoder */ public static final String VERSION = "Java Speex Command Line Encoder v0.9.7 ($Revision: 1.5 $)"; /** Copyright display String */ public static final String COPYRIGHT = "Copyright (C) 2002-2004 Wimba S.A."; /** Print level for messages : Print debug information */ public static final int DEBUG = 0; /** Print level for messages : Print basic information */ public static final int INFO = 1; /** Print level for messages : Print only warnings and errors */ public static final int WARN = 2; /** Print level for messages : Print only errors */ public static final int ERROR = 3; /** Print level for messages */ protected int printlevel = INFO; /** File format for input or output audio file: Raw */ public static final int FILE_FORMAT_RAW = 0; /** File format for input or output audio file: Ogg */ public static final int FILE_FORMAT_OGG = 1; /** File format for input or output audio file: Wave */ public static final int FILE_FORMAT_WAVE = 2; /** Defines File format for input audio file (Raw, Ogg or Wave). */ protected int srcFormat = FILE_FORMAT_OGG; /** Defines File format for output audio file (Raw or Wave). */ protected int destFormat = FIL…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39432533
has comment: http://stackoverflow.com/comment/39432237
has comment: http://stackoverflow.com/comment/39432326
score: 0

http://stackoverflow.com/comment/39386329
type: QuestionComment
score: 0
has text: You're calling a generic method on a raw type, which causes lots of screwiness. Enable unchecked conversion warnings (`-Xlint:unchecked` in `javac`) and fix your code so there are no more warnings. rgettman's answer shows the issue with the posted code.
comment on: http://stackoverflow.com/q/25275246
type: Comment

http://stackoverflow.com/comment/39484325
type: Comment
comment on: http://stackoverflow.com/q/25327791
score: 1
type: QuestionComment
has text: A ClassNotFoundException always means there is something wrong with your runtime classpath. Either you are missing a JAR, or the JAR(s) don't contain the class.

http://stackoverflow.com/q/25330163
has comment: http://stackoverflow.com/comment/39500550
score: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
tagged with: google-cloud-endpoints
has title: Unable to Save data to Datastore using google appengine cloud endpoint libraries with android
has body: I have created an android project with an appengine backend. Appegine has one API saveTask. This is working if i am directly triggering from the api explorer. While triggering the same from android using cloud endpoint libraries, data is not getting saved to datastore. I am not getting any exception or error while executing the line SaveTask task = taskEndpoint.saveTask(newTask); As there is no error i was not able to figure out whats going wrong. Appengine Code @ApiMethod(name="saveTask",path="task",httpMethod = HttpMethod.POST) public Task saveTask(final User user, TaskForm taskForm ) throws UnauthorizedException{ //String id = "1"; String taskName=taskForm.getTaskName(); String taskDesc=taskForm.getTaskDesc(); String createdUser=taskForm.getCreatedUser(); String assignedUser=taskForm.getAssignedUser(); Task task = null; Long id =taskForm.getId(); if(id!=null){ task = ofy().load().key(Key.create(Task.class,id)).now(); } if(task ==null){ task = new Task(taskName,taskDesc,createdUser,assignedUser); }else{ task.update(taskName,taskDesc,createdUser,assignedUser); } ofy().save().entity(task).now(); return task; } //Android Code public void saveTask(View view){ TaskForm newTask = new TaskForm(); EditText taskName = (EditText) findViewById(R.id.taskName); EditText taskDesc = (EditText) findViewById(R.id.taskDesc); newTask.setTaskName(taskName.getText().toString()); newTask.setTaskDesc(taskDesc.getText().toString()); newTask.setCreatedUser("asdf"); newTask.setAssignedUser("asdfasd"); newTask.setId((long) 12345); TaskApi.Builder endpointBuilder = new TaskApi.Builder(AndroidHttp.newCompatibleTransport(), new JacksonFactory(), null); TaskApi taskEndpoint = endpointBuilder.build(); try { SaveTask task = taskEndpoint.saveTask(newTask); Intent intent = new Intent(this,Task_View.class); startActivity(intent); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
answer count: 0
type: UnansweredQuestion
upvote count: 1

embedded-resource
tags question: http://stackoverflow.com/q/25329175
type: Tag
tags question: http://stackoverflow.com/q/25257513
tag name: embedded-resource
tags question: http://stackoverflow.com/q/25235229

http://stackoverflow.com/q/25354653
score: 0
has answer: http://stackoverflow.com/a/72130509
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39746583
has comment: http://stackoverflow.com/comment/39557745
tagged with: macos
tagged with: menu
type: Question
has comment: http://stackoverflow.com/comment/39558220
has comment: http://stackoverflow.com/comment/39558560
has body: I was trying out example of how to create Menu using SWT. I am using Eclipse on Mac. I was referring to this example. Whenever I run this example, I have two problems: The Menu doesn't show up until I make it full screen. The Menu buttons are unresponsive i.e when I click on Help, it doesn't show up the dropdown containing Get Help. Do I have to make some spwcific changes while creating Menus on Mac?
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/39538106
has title: SWT Menu unresponsive on MAC

http://stackoverflow.com/a/25375584
has comment: http://stackoverflow.com/comment/39571606
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: So, I spent some time playing around with this, using ProcessBuilder. I tried redirecting the IO through the INHERITED and PIPE options, but could not get it to display the output of the remote command (the psexec content was fine) import java.io.File; import java.io.IOException; import java.io.InputStream; public class Test1 { public static void main(String[] args) { ProcessBuilder pb = new ProcessBuilder( "C:\\Users\\shane\\Downloads\\PSTools\\PsExec.exe", "\\\\builder", "-u", "xxx", "-p", "xxx", "cmd", "/c", "dir", "c:\\" ); try { Process p = pb.start(); StreamConsumer.consume(p.getErrorStream()); StreamConsumer.consume(p.getInputStream()); System.out.println("Exited with :" + p.waitFor()); } catch (IOException | InterruptedException exp) { exp.printStackTrace(); } } public static class StreamConsumer implements Runnable { private InputStream is; public StreamConsumer(InputStream is) { this.is = is; } public static void consume(InputStream is) { StreamConsumer consumer = new StreamConsumer(is); new Thread(consumer).start(); } @Override public void run() { try { int in = -1; while ((in = is.read()) != -1) { System.out.print((char)in); } } catch (IOException exp) { exp.printStackTrace(); } } } } I even tried redirecting the InputStreams to File without any success. It would seem that whatever mechanism psexec is using to stream the results from the remote machine don't seem to be picked up by Java. You might try PAExec which did work, but didn't seem to wait to exit after the remote command exited...
type: Answer
accepted answer of: http://stackoverflow.com/q/25374966
answers question: http://stackoverflow.com/q/25374966

http://stackoverflow.com/comment/39397664
type: AnswerComment
comment on: http://stackoverflow.com/a/25281959
has text: Thx but it's not the real problem. When i use this, when keyboard don't take whole screen, editText content is reset on key "Ok" on Keyboard is pressed :/
type: Comment
score: 0

http://stackoverflow.com/a/25315794
has body: While I don't see the declarations, the reader and writer objects (referenced in the readFromSocket() method) look like they might be member variables. I would be concerned about the reader and writer not being thread-safe. I would see about about removing these member variables and see if you still have issues with the writer.
has comment: http://stackoverflow.com/comment/39477185
score: 0
answers question: http://stackoverflow.com/q/25315152
type: Answer

http://stackoverflow.com/comment/39480814
type: Comment
has text: Can you add print out some debug line just before your serverSocket.accept() call, and just after it? And then one just inside the run() method? I see you are catching Exception() - you might try catching Throwable() just in case...
score: 0
comment on: http://stackoverflow.com/q/25325579
type: QuestionComment

http://stackoverflow.com/comment/39591502
score: 0
has text: I want my custom toast class in own class and using this toast class in other
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25386147

http://stackoverflow.com/comment/39465666
has text: "Using an installer is definitely overkill for this goal"
comment on: http://stackoverflow.com/a/25314488
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25322063
has comment: http://stackoverflow.com/comment/39472985
has body: Your current code not even compile Since it is invalid syntax. arraylist &lt;object&gt; objects = new arraylist &lt;object&gt; () //not arraylist and object //it is ArrayList and Object But you can declare ArrayList as follows Arraylist &lt;Object&gt; objects = new Arraylist &lt;Object&gt; (); But why you want to do this. You can declare ArrayList using particular type. Eg: ArrayList&lt;String&gt; stringList=new ArrayList&lt;&gt;(); // ArrayList of String ArrayList&lt;Student&gt; studentList=new ArrayList&lt;&gt;(); // ArrayList of Student
has comment: http://stackoverflow.com/comment/39473075
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25322019
has comment: http://stackoverflow.com/comment/39473312
score: 3
has comment: http://stackoverflow.com/comment/39472917
has comment: http://stackoverflow.com/comment/39473334
has comment: http://stackoverflow.com/comment/39473296
type: Answer
has comment: http://stackoverflow.com/comment/39472588
has comment: http://stackoverflow.com/comment/39472543

http://stackoverflow.com/a/39834419
has comment: http://stackoverflow.com/comment/66959237
score: 0
answers question: http://stackoverflow.com/q/25306049
has comment: http://stackoverflow.com/comment/76308295
has body: As mentioned in the previous answer, you need a mapping - the best source for this is publicsuffix.org which maintains a list of detailed rules for this purpose. There is a range of libraries in many programming languages (a comprehensive list is here) which can determine the TLD (more precisely: the registrable domain part) given a URL. The following is an example of getting a registrable domain from a host using the [whois-server-list] https://github.com/whois-server-list/public-suffix-list! library. The host String variable is the host part of a valid URL (e.g. www.publicsuffix.org). PublicSuffixList and PublicSuffixListFactory are classes of the de.malkusch.whoisServerList.publicSuffixList package. PublicSuffixListFactory factory = new PublicSuffixListFactory(); PublicSuffixList suffixListResolver = factory.build(); String registrableDomain = suffixListResolver.getRegistrableDomain(host);
type: Answer

http://stackoverflow.com/q/25331472
has body: Applet in index.html doesn't load when hosted in IIS but it works fine when index.html is opened directly. Total file is deployed in IIS but it is not loading. Here i am using QZ-Print and here deployed code: function deployQZ() { var attributes = {id: "qz", code:'qz.PrintApplet.class', archive:'qz-print.jar', width:1, height:1}; var parameters = {jnlp_href: 'qz-print_jnlp.jnlp', cache_option:'plugin', disable_logging:'false', initial_focus:'false'}; if (deployJava.versionCheck("1.7+") == true) {} else if (deployJava.versionCheck("1.6+") == true) { delete parameters['jnlp_href']; } deployJava.runApplet(attributes, parameters, '1.5'); }
has comment: http://stackoverflow.com/comment/39532713
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/54241127
tagged with: applet
has comment: http://stackoverflow.com/comment/39494447
type: Question
has comment: http://stackoverflow.com/comment/39494374
has comment: http://stackoverflow.com/comment/39532692
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39494507
has title: Applet in index.html not loading with IIS. Works fine when index.html is opened Directly
tagged with: iis
has comment: http://stackoverflow.com/comment/39493488

http://stackoverflow.com/comment/39566830
type: QuestionComment
has text: Although the OP did mention regular expressions, the primary question is how to validate an email address. More appropriate would probably be: http://stackoverflow.com/questions/624581/what-is-the-best-java-email-address-validation-method
comment on: http://stackoverflow.com/q/25372876
type: Comment
score: 0

http://stackoverflow.com/q/25387227
favorite count: 0
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25387543
has title: Prepared Statement only retrieves the first row
has answer: http://stackoverflow.com/a/25387504
possible better answer: http://stackoverflow.com/a/25387504
has comment: http://stackoverflow.com/comment/39593736
upvote count: 1
has body: I'm developing a web application in which users can insert a number of "products". These products will be inserted in a MySQL database. I have a problem when I try to retrieve data from a table of my database. Here is my method: public ArrayList&lt;Product&gt; getProductByAppId(int appId) { ArrayList&lt;Product&gt; list = new ArrayList&lt;Product&gt;(); String query = "select prodId from app_prod where appId = ?"; try { preparedStatement = connection.prepareStatement(query); preparedStatement.setInt(1, appId); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Product item = getProductById(resultSet.getInt("prodId")); list.add(item); } return list; } catch (Exception e) { e.printStackTrace(); } return null; } This method simply gets an int as a parameter and retrieves from the table app_prod all the objects I have stored. The method getProductById it's an helper method and it works properly. When I try to debug my code, I see that I enter in the while cycle only once! So all I see is the very first element in my DB, but I have more than a single product in my DB. To make things shorter, I've omitted methods to open and close connection because they work properly. I think the error is something very obvious, but I can't really see it.
has comment: http://stackoverflow.com/comment/39593250
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25387543
has comment: http://stackoverflow.com/comment/39593501
score: 1
tagged with: java
tagged with: jdbc
downvote count: 0
has comment: http://stackoverflow.com/comment/39593333
tagged with: mysql
has comment: http://stackoverflow.com/comment/39593660

http://stackoverflow.com/comment/39547956
type: AnswerComment
comment on: http://stackoverflow.com/a/25363362
type: Comment
has text: No, but the names must be equal. So you have to change the name of the root element within the xml to ResponseBlockType or change the name of the bean class.
score: 0

http://stackoverflow.com/a/25286787
score: 2
has comment: http://stackoverflow.com/comment/39406575
downvote count: 0
type: Answer
has body: By default Scanner#next delimits input using a whitespace. You can use nextLine to read from the Scanner without using this delimiter pattern parse = sc.nextLine(); The previous points mentioned in the comments are still valid while (!parse.equals("#stop") &amp;&amp; !parse.isEmpty()) { parse = sc.nextLine(); String[] line = parse.split("\\s"); System.out.println(Arrays.toString(line)); }
accepted answer of: http://stackoverflow.com/q/25286755
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25286755
upvote count: 2

http://stackoverflow.com/comment/39404076
type: QuestionComment
comment on: http://stackoverflow.com/q/25281370
has text: Hey, i tried that now and it isnt working. i tried an alternate host with only an IP and no oauth token and it worked to connect. why im not able to connect to the twitch irc? My Other bots doing the same auth method and codings lik ethis one and the others work^^ its strange :c
score: 0
type: Comment

http://stackoverflow.com/comment/39348297
has text: I think I would like to follow this approach. I had just started reading about Dager, but the whole concept is new to me. Could you possibly show what you think the Module class for this example might look like? I think it would help me a lot.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25254582

http://stackoverflow.com/q/25329275
possible better answer: http://stackoverflow.com/a/25329294
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25329294
tagged with: parse-platform
tagged with: android
has answer: http://stackoverflow.com/a/60305815
has answer: http://stackoverflow.com/a/25329322
score: 22
has body: I am getting the following errors: The method getApplicationContext() is undefined The method findViewById(int) is undefined for the type Fragment1 These errors seem to be eliminated when my class is extended to an Activity as oppose to a fragment, but it is important that this activity remains as a fragment, so I am not too sure how to work this out. Any help would be greatly appreciated. Thanks in advance. Below is the code public class Fragment1 extends Fragment { private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ListView usersListView; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub if (container == null){ return null; } return (LinearLayout)inflater.inflate(R.layout.fragment1_layout, container,false); logoutButton = (Button) findViewById(R.id.logoutButton); logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ParseUser.logOut(); Intent intent = new Intent(getApplicationContext(), LoginActivity.class); startActivity(intent); } }); setConversationsList(); } private void setConversationsList() { currentUserId = ParseUser.getCurrentUser().getObjectId(); names = new ArrayList&lt;String&gt;(); // String userActivitySelectionName = null; ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); // query.whereEq…
type: AnsweredQuestion
upvote count: 22
answer count: 3
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/25329322
downvote count: 0
has title: The method getApplicationContext() is undefined - fragment issues
tagged with: android-activity

http://stackoverflow.com/a/25343012
accepted answer of: http://stackoverflow.com/q/25342919
has body: Why are you using for loop here??? for(int x=0; x&lt;email.size(); x++) { ContatosEmailModel mContatosEmailModel = email.get(x); holder.emailView.setText(mContatosEmailModel.getEmail()); } Just do same as you are doing for headline view and reportedDateView Change your this code : holder.emailView.setText(this.email.get(position).getEmail()); for(int x=0; x&lt;email.size(); x++) { ContatosEmailModel mContatosEmailModel = email.get(x); holder.emailView.setText(mContatosEmailModel.getEmail()); } to this : holder.emailView.setText(mContatosEmailModel.getEmail());
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39533103
answers question: http://stackoverflow.com/q/25342919
has comment: http://stackoverflow.com/comment/39535136
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39544686

http://stackoverflow.com/comment/39493639
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25332871
has text: Thanks for helping, but `JAVA_HOME` is defined. And, as Alécio Carvalho answered, I forgot `<property environment="env"/>`.

http://stackoverflow.com/comment/39420084
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25292753
type: AnswerComment
has text: thank you for the answer, i still find it a bit confusing, any links you can link me too to read up on it ? thanks

http://stackoverflow.com/a/25268010
accepted answer of: http://stackoverflow.com/q/25246078
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25246078
has body: My Eclipse installation was the ADT Bundle. Therefore web-editors where not included by default. Following this post, I installed the missing plugins. Works now.

http://stackoverflow.com/comment/40231127
comment on: http://stackoverflow.com/q/25316691
type: Comment
has text: http://wiki.zimbra.com/wiki/ZCS_6.0:Zimlet_Developers_Guide:Examples:SOAP_API_Basics would be a good place to start...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/75672958
has text: as improbable as it may sound, but I am the occurrence of that improbable chance, this post was the solution to my problem!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25369217

http://stackoverflow.com/q/25342085
has body: I just installed local javadocumentation and can now view javadoc for elements like JPanel,JSlider and others. The javadoc for specific methods however are missing. It would be very handy for me to view these. example function drawArc(int,int,int,int,int,int) if I could view some kind of (local) documention for the paremeters this would be super helpfull.. here is an image do display what I mean as you can see I get an notice that The javadoc for this element could not be found ... I'm looking for a description on the parameters and their order I hope my question is clear
tagged with: eclipse
favorite count: 0
has answer: http://stackoverflow.com/a/25342194
type: Question
has title: Find method description in eclipse ide
downvote count: 0
possible better answer: http://stackoverflow.com/a/25342194
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25342214
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/25342214
tagged with: java
tagged with: javadoc
upvote count: 1
tagged with: methods

http://stackoverflow.com/q/25255337
has comment: http://stackoverflow.com/comment/39349509
tagged with: multithreading
downvote count: 0
linked to: http://stackoverflow.com/q/21143996
has title: Ideas on concurrent datastructure
upvote count: 1
has comment: http://stackoverflow.com/comment/39349431
has comment: http://stackoverflow.com/comment/39422727
has comment: http://stackoverflow.com/comment/39349637
tagged with: spring-batch
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25324353
has comment: http://stackoverflow.com/comment/39479217
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39349341
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39349399
has body: I am not sure if i can put my question in the clearest fashion but i will try my best. Lets say i am retrieving some information from a third party api. The retrieved information will be huge in size. To have a performance gain, instead of retrieving all the info in one go, i will be retrieving the info in a paged fashion (the api gives me that facility, basically an iterator). The return type is basically a list of objects. My aim here is to process the information i have in hand(that includes comparing and storing in db and many other operations) while i get paged response on the request. My question here to the expert community is , what data structure do you prefer in such case. Also does a framework like spring batch help you in getting performance gains in such cases. I know the question is a bit vague, but i am looking for general ideas,tips and pointers.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39416674
accepted answer: http://stackoverflow.com/a/25324353
answer count: 2
has answer: http://stackoverflow.com/a/25255499
possible better answer: http://stackoverflow.com/a/25255499

http://stackoverflow.com/comment/39429595
score: 0
comment on: http://stackoverflow.com/q/25298537
type: QuestionComment
has text: Thanks. I really appreciate you trying to help out.
type: Comment

http://stackoverflow.com/a/25358631
has body: Ok I managed to solve this on my own. This is the code I wrote in my inputproccessor class. You need to declare hitBody at the top of class as a body btw which isn't shown below. Vector3 testPoint = new Vector3(); QueryCallback callback = new QueryCallback() { @Override public boolean reportFixture(Fixture fixture) { if(fixture.testPoint(testPoint.x,testPoint.y)){ hitBody = fixture.getBody(); return false; }else{ return true; } } }; @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { GameRender.cam.unproject(testPoint.set(screenX,screenY,0)); hitBody = null; GameWorld.physicsWorld.QueryAABB(callback, testPoint.x - 0.0001f, testPoint.y - 0.0001f, testPoint.x + 0.0001f, testPoint.y + 0.0001f); for(DynamicBox b:GameWorld.BoxList){ if(hitBody == b.boxerino){ System.out.println("click detected"); b.shouldRemove = true; } } return false; } There is a boolean which I turn to true if the body is clicked.(b.shouldRemove=true) After that I go to my update loop and remove the body and also the body factory class from the arrayList. public void update(float delta){ physicsWorld.step(delta, 2, 2); for(int i=0;i&lt;BoxList.size();i++){ DynamicBox b = BoxList.get(i); if(b.shouldRemove==true){ physicsWorld.destroyBody(b.boxerino); BoxList.remove(i); } } }
answers question: http://stackoverflow.com/q/25350756
upvote count: 2
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25350756
type: AcceptedAnswer

http://stackoverflow.com/comment/39359195
comment on: http://stackoverflow.com/q/25260942
has text: In your edit you used a primitive boolean, this can never be null. It has a default value of 'false'. You can just do if(shareConnection.getConnection()) {...} without comparing it to Boolean.TRUE. If you still have a NPE, it's probably caused somewhere else in the related code.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39342306
score: 0
type: Comment
type: QuestionComment
has text: what line is `177` is it GPSToolMap.addPolyline? If so what happens in there?
comment on: http://stackoverflow.com/q/25251645

http://stackoverflow.com/comment/39518653
has text: @ComFreek we did consider Phantom.js but we actually output the above data within our app so we only want a small subset of the rendered page.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25282873

http://stackoverflow.com/q/25353602
tagged with: spring-loaded
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25353718
tagged with: intellij-idea
has body: I'm running my java application with an "Application" configuration in Intellij and I'm using these vm options for using springloaded: -javaagent:.../springloaded-1.2.0.RELEASE.jar -noverify The class reloading with springloaded works fine. But the debugger won't stop any more at the breakpoints in the reloaded classes. Breakpoints in other classes still work.
has title: Breakpoints does not work after reloading classes with springloaded in Intellij
accepted answer: http://stackoverflow.com/a/25353718
tagged with: hotdeploy
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: java
downvote count: 0

http://stackoverflow.com/a/25284819
answers question: http://stackoverflow.com/q/25282804
has body: I think the messages are getting displayed multiple times because they carry older values whenever convert view is non-null. And since your incoming and outgoing messages are both getting filled it is giving the illusion of multiple items getting selected. So you should change visibility of unused views to View.GONE.
type: Answer
score: 0

http://stackoverflow.com/a/25245786
has comment: http://stackoverflow.com/comment/39430266
has comment: http://stackoverflow.com/comment/97014186
has comment: http://stackoverflow.com/comment/39392282
type: Answer
has comment: http://stackoverflow.com/comment/39390783
has comment: http://stackoverflow.com/comment/39394588
upvote count: 3
score: 3
has body: If on java ee 7, try using the javax.enterprise.concurrent.ManagedScheduledExecutorService Then you can do a resource injection and start the task with code similiar to below. @Resource ManagedScheduledExecutorService mses; public void startTask() { mses.scheduleAtFixedRate(runnable, 10, 10, SECONDS); } In Java EE 6 you could have a servlet create/remove using the timerservice API
downvote count: 0
answers question: http://stackoverflow.com/q/25237111

http://stackoverflow.com/comment/39561659
type: Comment
comment on: http://stackoverflow.com/q/25370429
type: QuestionComment
has text: sorry i dint noticed it was a link
score: 0

http://stackoverflow.com/a/37772288
type: Answer
answers question: http://stackoverflow.com/q/25360672
score: 2
upvote count: 2
has body: Please make sure, that opencv-macosx-x86_64.jar is in your classpath.
downvote count: 0

http://stackoverflow.com/q/25244214
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39332668
tagged with: java
downvote count: 0
has title: Inserting/Retrieving a file from Sybase
tagged with: sap-ase
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39330836
answer count: 1
has comment: http://stackoverflow.com/comment/39328669
favorite count: 0
has comment: http://stackoverflow.com/comment/39329393
has comment: http://stackoverflow.com/comment/39330897
type: Question
has comment: http://stackoverflow.com/comment/39330093
has comment: http://stackoverflow.com/comment/39329126
accepted answer: http://stackoverflow.com/a/25251604
has answer: http://stackoverflow.com/a/25251604
has body: I am trying to insert a file containing into a Sybase database. I am using JConnect-7.0.7 Here is my table: CREATE TABLE blob_test ( blobVar IMAGE ) I am inserting the image using: String sql = "INSERT INTO blob_test VALUES (convert(binary,?))"; PreparedStatement stmt = conn.prepareStatement(sql); File image = new File(filePath); InputStream fis = new FileInputStream(image); int ilen=(int) image.length(); stmt.setBinaryStream(1, fis, ilen); stmt.execute(); And trying to retrieve the image using: JdbcTemplate jdbcTemplate= new JdbcTemplate(dataSource); List&lt;Blob&gt; result = jdbcTemplate.query( "SELECT blobVar FROM blob_test", new Object[] {}, new RowMapper() { @Override public Blob mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getBlob(1); } }); for(int i=0;i&lt;result.size();i++){ Blob b = result.get(i); BufferedOutputStream os; os = new BufferedOutputStream(new FileOutputStream(new File("output"+i+".zip"))); os.write(b.getBytes(1, (int) b.length())); os.flush(); os.close(); } However, when I execute my code it outputs 1kb zip files that are corrupted. My code works exactly as it should for an oracle database. Alternatively, I have also tried this code to retrieve the file: JdbcTemplate jdbcTemplate= new JdbcTemplate(dataSource); List&lt;InputStream&gt; result = jdbcTemplate.query( "SELECT * FROM blob_test", new Object[] {}, new RowMapper() { @Override public InputStream mapRow(ResultSet rs, int rowNum) throws SQLException { return lobHandler.getBlobAsBinaryStream(rs, 1); } }); for(int i=0;i&lt;result.size();i++){ InputStream in = result.get(i); OutputStream out = new FileOutputStream(new File("outputTest"+i+".zip")); byte[] buff = new byte[4096]; int len = 0; while ((len = in.read(buff)) != -1) { out.write(buff, 0, len); } out.flush(); out.close(); } However, when I run this code I get an exception: java.io.IOException: JZ0I9: This InputStream was closed. at com.sybase.jdbc4.jdbc.ErrorMessage.raiseIOException(Unknown Source) at com.sybase.jdbc…

http://stackoverflow.com/comment/39527520
has text: i have an entry for it...@lal
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25352185

http://stackoverflow.com/comment/39432365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25300103
score: 0
has text: Because you don't seem to understand what thread safety is. You should also read up about what HTTP is and how the transport layer of a network works.

http://stackoverflow.com/a/25269445
score: 1
upvote count: 1
has body: What you're getting above is: row.setName(((String) customers)[0]+" "+((String) customers)[1]); Cast has precedence over array indexing. The clue is the message [Ljava.lang.Object; cannot be cast to java.lang.String The leading [ indicates that the class is an array class.
type: Answer
answers question: http://stackoverflow.com/q/25269382
downvote count: 0

http://stackoverflow.com/q/25284162
type: Question
has title: JBoss EAP 6.2 JMX Server and Registry Bindings
type: UnansweredQuestion
tagged with: jmx
score: 6
has body: I am currently trying to configure JMX Susbsystem on JBoss EAP 6.2 to help monitor my web application. Having setup the console I have been unable to figure out what should go in the Server/Registry binding fields as per the following screenshot: I have tried putting in 127.0.0.1:9999 for local host but I get the error: Could anyone suggest what these values should be?
tagged with: jboss
upvote count: 6
tagged with: java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27714177
favorite count: 0

http://stackoverflow.com/a/25306585
has body: You cannot define a variable in java and call a method on it without initializing it beforehand. In the first line: HttpServletRequest urlrequest; you are just defining a variable. Since it is not initialized it is null and you cannot use it. Remove this line and use the argument passed to the doGet (or doPost) method in your Servlet. For example if your servlet is like this: public class MyServlet extends HttpServlet { ... public void doGet(HttpServletRequest request, HttpServletResponse response) throws Exception { ... } Instead of your code just add below line in the body of the doGet method: public void doGet(HttpServletRequest request, HttpServletResponse response) throws Exception { ... StringBuffer url = request.getRequestURL(); ... } After this line you should be able to use the url variable.
has comment: http://stackoverflow.com/comment/39443945
answers question: http://stackoverflow.com/q/25306093
has comment: http://stackoverflow.com/comment/41535654
score: 0
has comment: http://stackoverflow.com/comment/39444017
type: Answer
has comment: http://stackoverflow.com/comment/41492156

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25342403
tag name: google-oauth

http://stackoverflow.com/comment/39581262
score: 0
comment on: http://stackoverflow.com/q/25380963
type: QuestionComment
has text: can you clarify more or post few code segments to make it clear.
type: Comment

windows
tags question: http://stackoverflow.com/q/25271644
tags question: http://stackoverflow.com/q/25294533
tags question: http://stackoverflow.com/q/25388990
tags question: http://stackoverflow.com/q/25373224
tags question: http://stackoverflow.com/q/25332951
tags question: http://stackoverflow.com/q/25299489
tags question: http://stackoverflow.com/q/25238110
type: Tag
tags question: http://stackoverflow.com/q/25311938
tags question: http://stackoverflow.com/q/25261658
tags question: http://stackoverflow.com/q/25386143
tags question: http://stackoverflow.com/q/25372414
tags question: http://stackoverflow.com/q/25320625
tags question: http://stackoverflow.com/q/25271501
tags question: http://stackoverflow.com/q/25304103
tags question: http://stackoverflow.com/q/25237881
tag name: windows
tags question: http://stackoverflow.com/q/25250808
tags question: http://stackoverflow.com/q/25348997
tags question: http://stackoverflow.com/q/25246435
tags question: http://stackoverflow.com/q/25373578
tags question: http://stackoverflow.com/q/25313749

http://stackoverflow.com/q/25315719
tagged with: winapi
tagged with: java
has body: I'm currently working on a C# program to manage some configuration files. One of the things I feel I need to do is modify the size and/or position of an open window. The window already has a fullscreen function but not a maximize. What I'm trying to do is to hook to that window (which always runs off a java process and has one of 2 names no matter the situation) and change it's size to the size of the screen and remove the border from it. I've searched extensively and the best answer I've found so far is How do I change another program's window's size? but that doesn't affect the border of the program and I can't seem to get any variation of WindowFromPoint to work correctly in C#, not something I've ever come across. As I've said so far the program always is running inside java so the "javaw" process, but it has it's own jar, though it always has the same window title. I'm using: [DllImport("User32.Dll")] public static extern int FindWindow(string lpClassName, string lpWindowName); [DllImport("User32.Dll")] public static extern int GetClassName(int hwnd, StringBuilder lpClassName, int nMaxCount); int nWinHandle = FindWindow("Name", null); But no matter what combination of class and windowname, with & without extention I use I always return a 0. Without that I feel I can use any other code. For those who didn't wanna read the whole thing... I'm looking for a way to hook to an existing window, remove it's border and set it's size to the user's primary screen size. Edit: So by referencing FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName) I'm able to get the window name into a IntPtr and then use MoveWindow(); Though I'm still not able to strip the border of it.
answer count: 1
linked to: http://stackoverflow.com/q/8443502
type: Question
tagged with: winforms
tagged with: c#
score: 0
accepted answer: http://stackoverflow.com/a/25315922
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25315922
has title: Change Existing Window Size & Position

http://stackoverflow.com/q/25373902
has comment: http://stackoverflow.com/comment/39568795
has comment: http://stackoverflow.com/comment/39569098
tagged with: random
type: UnansweredQuestion
tagged with: javascript
has comment: http://stackoverflow.com/comment/39568820
has body: I've ported an LCG algorithm from JavaScript (by kotarou3) to Java. The original code states that if no parameters are passed to the function, it should return a real number in [0, 1), just like Math.random(). However, my implementation occasionally returns negative numbers between -1 and 0. Code: private int[] startingSeed = new int[]{(int) Math.floor(Math.random() * 0x10000), (int) Math.floor(Math.random() * 0x10000), (int) Math.floor(Math.random() * 0x10000), (int) Math.floor(Math.random() * 0x10000)}; private int[] seed = new int[4]; public double random() { this.seed = this.nextFrame(); double result = (this.seed[0] &lt;&lt; 16 &gt;&gt;&gt; 0) + this.seed[1]; result = result / 0x100000000L; return result; } public int[] nextFrame() { int[] seed = this.seed; int n = 1; for(int frame = 0; frame &lt; n; ++frame) { int[] a = new int[]{0x5D58, 0x8B65, 0x6C07, 0x8965}; int[] c = new int[]{0, 0, 0x26, 0x9EC3}; int[] nextSeed = new int[]{0, 0, 0, 0}; int carry = 0; for (int cN = seed.length - 1; cN &gt;= 0; --cN) { nextSeed[cN] = carry; carry = 0; int aN = seed.length - 1; int seedN = cN; for(; seedN &lt; seed.length; --aN, ++seedN) { int nextWord = a[aN] * seed[seedN]; carry += nextWord &gt;&gt;&gt; 16; nextSeed[cN] += nextWord &amp; 0xFFFF; } nextSeed[cN] += c[cN]; carry += nextSeed[cN] &gt;&gt;&gt; 16; nextSeed[cN] &amp;= 0xFFFF; } seed = nextSeed; } return seed; } The original code is nearly identical, only the data types int and double are vars, but the algorithm remains the same.
type: Question
score: 0
has title: LCG returning negative values in Java
tagged with: java
answer count: 0
has comment: http://stackoverflow.com/comment/39568881
linked to: http://stackoverflow.com/q/1822350
has comment: http://stackoverflow.com/comment/39568731

business-intelligence
tags question: http://stackoverflow.com/q/25275427
tag name: business-intelligence
type: Tag

http://stackoverflow.com/q/25268406
type: Question
has answer: http://stackoverflow.com/a/37591102
possible better answer: http://stackoverflow.com/a/25268661
accepted answer: http://stackoverflow.com/a/25271363
score: 5
has answer: http://stackoverflow.com/a/25268661
has answer: http://stackoverflow.com/a/25271363
has comment: http://stackoverflow.com/comment/39373067
upvote count: 5
tagged with: firewall
has title: How to check if URL is blocked by my firewall
has comment: http://stackoverflow.com/comment/39373192
type: AnsweredQuestion
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39373774
downvote count: 0
has body: I am trying to check if the URL is accessible or not. I am using HttpURLConnection for it. This is now I am implementing it. public static boolean isUrlAccessible(final String urlToValidate) throws WAGException { URL url = null; HttpURLConnection huc = null; int responseCode = -1; try { url = new URL(urlToValidate); huc = (HttpURLConnection) url.openConnection(); huc.setRequestMethod("HEAD"); huc.connect(); responseCode = huc.getResponseCode(); } catch (final UnknownHostException e) { e.printStackTrace(); System.out.println(e.getMessage()+" "+e.getLocalizedMessage()); return false; } catch (final MalformedURLException e){ e.printStackTrace(); System.out.println(e.getMessage()+" "+e.getLocalizedMessage()); return false; } catch (ProtocolException e) { e.printStackTrace(); System.out.println(e.getMessage()+" "+e.getLocalizedMessage()); return false; } catch (IOException e) { e.printStackTrace(); System.out.println(e.getMessage()+" "+e.getLocalizedMessage()); return false; } finally { if (huc != null) { huc.disconnect(); } } return responseCode == 200; } When the Internet is down it throws an UnknownHostException, I wanted to know how do I check if a fire wall is blocking a URL and thats why I get an exception and not because that the URL is not accessible. Also, I am just checking for response code 200 to make sure that the URL is accessible. Are there any other checks I need to perform?
tagged with: url
tagged with: httpconnection
has comment: http://stackoverflow.com/comment/39373022
has comment: http://stackoverflow.com/comment/39373335
favorite count: 0

http://stackoverflow.com/comment/39593469
has text: also I am not sure, if you only want this double number rounded to 2 decimal places and just want to use it as double for further calculations and don't want to print it, then how does it matter 0.20 or 0.2 both are same in mathematics right ? for at the time of printing it you can use System.out.printf() or String.format().
score: 0
comment on: http://stackoverflow.com/q/25385905
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25381568
score: 1
tagged with: java
tagged with: regex
has answer: http://stackoverflow.com/a/25381746
type: AnsweredQuestion
has body: I have a situation where I need to parser the below content Some Text Some Text SUB-TOTAL : $0.90 Some Text : $0.79- SUB-TOTAL : $0.11 TAX : $0.05 TOTAL $0.16 I need to parse till last 'SUB-TOTAL' if Tax does not exist, else it has to parse till TAX I am not sure where I did wrong in the regex * .?(?=(TAX|(SUB-TOTAL.?SUB-TOTAL))) * Since have less experience on regex. Can some one please help me out. Thanks in advance.
has comment: http://stackoverflow.com/comment/39588170
answer count: 1
downvote count: 0
tagged with: javascript
upvote count: 1
accepted answer: http://stackoverflow.com/a/25381746
has comment: http://stackoverflow.com/comment/39583406
has title: Regex to match second word or the first occurance of the another word
favorite count: 0
type: Question

http://stackoverflow.com/a/25310036
has body: As the exception indicates, it's trying to parse it as a Regex instead of plain text. If you just want to replace a certain string with another one, use replace() instead of replaceAll(). As to why you get this particular exception: the { } characters have a specific meaning and are used to indicate a repitition (aka: the amount of times a certain regex appears). In an actual regex this is supposed to take an integer value which you don't provide in your string.
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25309979
downvote count: 0
score: 4

http://stackoverflow.com/comment/39399020
comment on: http://stackoverflow.com/a/25239202
type: Comment
score: 0
type: AnswerComment
has text: I tried it but nothing happens. I debugged it and it seems the handler is not running the code yet. Why is that?

http://stackoverflow.com/comment/39400360
has text: As said, you need to adapt formatting according your values, and wanted output. If it work, please accept the answer.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25275965
score: 0

http://stackoverflow.com/comment/80079948
type: Comment
has text: @DidierA. A `Date` is similar to an `Instant`, which are both UNIX timestamps. Also, it is common practice to say that UNIX timestamps are UTC time zone.
type: AnswerComment
comment on: http://stackoverflow.com/a/25376733
score: 3

http://stackoverflow.com/comment/39445263
type: AnswerComment
has text: I don't see anything about empty fields there.
comment on: http://stackoverflow.com/a/25301693
type: Comment
score: 0

http://stackoverflow.com/comment/39311410
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25235229
has text: Yeah, I guess that's about it
type: Comment

printers
tag name: printers
tags question: http://stackoverflow.com/q/25278808
type: Tag

http://stackoverflow.com/q/25256988
has comment: http://stackoverflow.com/comment/39352307
has answer: http://stackoverflow.com/a/25257054
score: 0
tagged with: java
tagged with: paintcomponent
tagged with: swing
answer count: 1
tagged with: repaint
tagged with: timer
type: Question
has body: public class Ova extends JPanel implements ActionListener{ int x=0; Timer timer=new Timer(100,this); int y=0,x1=5,y1=5; public static void main(String[] ds) { Ova ss=new Ova(); ss.nn(); } private void nn() { JFrame frame=new JFrame("fram"); frame.setSize(1000,600); JPanel as=new JPanel(); frame.add(as); frame.add(new Ova()); frame.setVisible(true); timer.start(); } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawOval(x, y, 50, 50); } public void actionPerformed(ActionEvent e) { if (x&lt;0 || x&gt;950){ x1=-x1; } if (y&lt;0 || y&gt;530) { y1=-y1; } x=x+x1; y=y+y1; repaint(); } } Whenever I put timer.start() inside paintComponent() the repaint() method works but if I start the timer outside the paint component method the repaint method does not work.Please explain the reasons. Thank you.
type: UnansweredQuestion
has title: Why the repaint() method not working here?

http://stackoverflow.com/a/25253763
type: Answer
has body: Here's a variant to Peter Petrov's solution: public static String group(String in) { // Get the length of the first group int i = (in.length() - 1) % 3 + 1; // Add the first group String out = in.substring(0, i); // Add the other groups, each prefixed with a space for (int k = i; k &lt; in.length(); k += 3){ out += " " + in.substring(k, k + 3); } return out; } We get the length of the first group, we initialize the output with that first group and then we go over the remainder of the input to append one group of 3 digits at a time. That's really all there is to it. The tricky bit is in the first line. Just using in.length() % 3 doesn't work correctly, since that prevents the first group from ever having 3 digits. For example, an input of "123456" would lead to i == 0 and an output of " 123 456" (note the unwanted space at the start). Peter uses an if check to deal with this case, but it turns out you can also handle it by changing i a bit. We want the relation between in.length() and i to be like this: in.length() | i | (in.length() - 1) % 3 ------------------------------------------ 0 | 0 | -1 1 | 1 | 0 2 | 2 | 1 3 | 3 | 2 4 | 1 | 0 5 | 2 | 1 ... | ... | ... Subtracting one before the modulo and adding it back afterwards gives us this relation (the partial result after the modulo is in the third column). It even handles the special case where in is the empty string! :-P
score: 0
answers question: http://stackoverflow.com/q/25253121

performance
tags question: http://stackoverflow.com/q/25282581
tags question: http://stackoverflow.com/q/25306967
tags question: http://stackoverflow.com/q/25378053
tags question: http://stackoverflow.com/q/25303565
tags question: http://stackoverflow.com/q/25351490
tags question: http://stackoverflow.com/q/25273903
tags question: http://stackoverflow.com/q/25374587
tags question: http://stackoverflow.com/q/25239301
tags question: http://stackoverflow.com/q/25259305
tags question: http://stackoverflow.com/q/25251388
tags question: http://stackoverflow.com/q/25321867
tags question: http://stackoverflow.com/q/25306077
tags question: http://stackoverflow.com/q/25351168
tags question: http://stackoverflow.com/q/25322679
tags question: http://stackoverflow.com/q/25321807
tag name: performance
tags question: http://stackoverflow.com/q/25294647
tags question: http://stackoverflow.com/q/25382192
tags question: http://stackoverflow.com/q/25327504
tags question: http://stackoverflow.com/q/25344924
tags question: http://stackoverflow.com/q/25359818
tags question: http://stackoverflow.com/q/25270710
tags question: http://stackoverflow.com/q/25237716
tags question: http://stackoverflow.com/q/25377281
tags question: http://stackoverflow.com/q/25235135
tags question: http://stackoverflow.com/q/25275090
tags question: http://stackoverflow.com/q/25380538
tags question: http://stackoverflow.com/q/25314123
type: Tag
tags question: http://stackoverflow.com/q/25251936
tags question: http://stackoverflow.com/q/25256861
tags question: http://stackoverflow.com/q/25388989
tags question: http://stackoverflow.com/q/25330065
tags question: http://stackoverflow.com/q/25235950
tags question: http://stackoverflow.com/q/25265303
tags question: http://stackoverflow.com/q/25313085
tags question: http://stackoverflow.com/q/25339746
tags question: http://stackoverflow.com/q/25341001
tags question: http://stackoverflow.com/q/25352037
tags question: http://stackoverflow.com/q/25306105
tags question: http://stackoverflow.com/q/25325801

http://stackoverflow.com/comment/39446748
type: AnswerComment
has text: so what is the difference between loading the actual java.lang.ArayList` into the JVM vs. directly use ArrayList ? I am a bit new, so perhaps you can provide more detail ?
score: 0
comment on: http://stackoverflow.com/a/25308115
type: Comment

http://stackoverflow.com/q/25309275
tagged with: charts
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/25316703
has comment: http://stackoverflow.com/comment/39455295
possible better answer: http://stackoverflow.com/a/37239995
linked to: http://stackoverflow.com/q/24121580
favorite count: 0
has comment: http://stackoverflow.com/comment/39448857
type: Question
tagged with: fxml
answer count: 2
upvote count: 2
tagged with: pie-chart
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39448782
has title: Javafx Donut Chart in FXML
has answer: http://stackoverflow.com/a/25316703
has comment: http://stackoverflow.com/comment/39458887
has answer: http://stackoverflow.com/a/37239995
has body: I want to do a Doughnut/Donut chart on JavaFX and searching I came to this example: Can PieChart from JavaFX be displayed as a doughnut? I Works really nice, but since I'm using FXML to make my GUI, I can't use this example. First, I tried to add the DoughtnutChart.java class as a @FXML var in the controller class of the panel where I want to insert it, but launched errors. Then, searched in Google to make the DoughnutChart a custom component, but all the examples are based on Panes. Also, If I try to import my donu.jar to SceneBuilder, the window to select a component is empty. So, my question is: How do I implement this Doughnut Chart on JavaFX when my GUI is made on FXML? Thanks a lot.
type: AnsweredQuestion

http://stackoverflow.com/a/25334366
downvote count: 0
type: AcceptedAnswer
score: 3
answers question: http://stackoverflow.com/q/25330713
type: Answer
accepted answer of: http://stackoverflow.com/q/25330713
has body: Spring needs to know the profile when the application context is being constructed - i.e. during web application startup. The Web parameter method refers to context parameter set via web.xml: spring.profiles.active development
upvote count: 3

http://stackoverflow.com/comment/39508914
score: 1
comment on: http://stackoverflow.com/q/25340834
type: Comment
type: QuestionComment
has text: Have you tried finding the catch clauses as part of the try statement?

http://stackoverflow.com/a/25386634
type: Answer
answers question: http://stackoverflow.com/q/25367688
score: 0
upvote count: 1
downvote count: 1
has body: Should I be using a different layout? No, stick with MigLayout. You have chosen the right layout manager. I advice you to invest some time into learning this manager; create couple of smaller practical examples, learn the numerous constraints that this manager provides. It also puts my above buttons out of place and I'm not too sure why. MigLayout is a grid-based layout manager. (Its most important mode is.) The gap between the New and Open buttons is created because the highlighted components and the New button form a column. The column width is determined by the width of the largest cell. To bypass this, we can use the split constraint. (Often used in combination with span constraint.) In my example I use this technique to center two buttons above the currently visible label. If we are not sure about something in the layout, we can use the debug layout constraint which paints the lines of the grid and bounds of the components. frame.getContentPane().setLayout(new MigLayout("", "[53px,grow][57px][grow]", "[23px][][][]")); Do not set bounds in pixels. You are not utilizing of one of the most important advantages of this manager -- independence of resolution and DPI. Bounds in pixels are not portable. A 3px gap between buttons looks OK on a smaller screen but is not acceptable on a larger one. MigLayout provides several options to choose from including related and unrelated gaps, logical pixels, points, or centimeters. itemTitle.setMinimumSize(new Dimension(50, 50)); Setting a minimum size of a component is usually not necessary. But if we need to do it, we have the wmin and wmax constraints. This should be done by the layout manager, not by code outside of it. The set(Minimum|Maximum|Preferred)size methods should be avoided. (With poorer managers, one cannot do without them, however.) And again, setting dimensions in pixels is not optimal. Now we get to the solution. MigLayout has hidemode constraint to deal with your requirement. There are four hide modes. I assume…

http://stackoverflow.com/q/25301217
possible better answer: http://stackoverflow.com/a/25301313
has answer: http://stackoverflow.com/a/25302159
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25301313
answer count: 2
has comment: http://stackoverflow.com/comment/39433932
upvote count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/25302159
has body: I tried looking up what an Android key hash on Google. But all I got was how to generate it, not what actually what it is. Can anybody give a simple explanation of what this key hash actually is and why Facebook needs you to generate one to run samples and your own application?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39434302
score: 3
tagged with: android
tagged with: java
tagged with: facebook
has title: What is an Android key hash?

http://stackoverflow.com/q/25356989
type: Question
tagged with: redis
has body: I was looking into using caching for improving website performance recently and thought of implementing it in my application. I have a scenario where I am executing a large query to get list of orders based on order status and customer/supplier. There can be other filters selected at runtime by the user. The query is also complex with a lot of joins amongst tables. Can we implement caching memcached/Redis in anyway to improve performance in this area by storing the orders object in cache with order id as key and order object as value when they get created and write some logic to fetch the list or orders with runtime filters applied or do i need to run the query itself for fetching orders? Also there are simple queries like get orders object by orderNumber. Can we cache these to avoid DB query? Please let me know of any possible solution for improving site performance. Thanks in advance :)
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39698853
has comment: http://stackoverflow.com/comment/39726102
tagged with: grails
has title: Improving application performance with large queries
has comment: http://stackoverflow.com/comment/39726040
score: 0
tagged with: java
tagged with: mysql
tagged with: memcached

http://stackoverflow.com/a/25307787
has body: Float, Double, float, double are not accurate in java. For example: double number1 = 0.58 * 100; System.out.println("" + number1); and the output is 57.99999999999999 not 58 as expected. BigDecimal class can be used instead for accurate performance.
upvote count: 1
has comment: http://stackoverflow.com/comment/39446011
downvote count: 1
has comment: http://stackoverflow.com/comment/39446262
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39446400
answers question: http://stackoverflow.com/q/25307473

http://stackoverflow.com/a/25252997
answers question: http://stackoverflow.com/q/25252951
has comment: http://stackoverflow.com/comment/39345516
downvote count: 0
upvote count: 1
has body: if (query.whereEqualTo("Looking_Gender","Female") &amp;&amp; (query.whereEqualTo("Gender","Female") != null) This checks to see what query.whereEqualTo("Looking_Gender","Female") is first. What is it? Is it a boolean? If not, it needs to be compared to something to yield a boolean. I believe it's a ParseQuery&lt;ParseUser&gt; although you haven't told us. Overall you need this syntax: if (boolean_expression &amp;&amp; boolean_expression) and the left side of &amp;&amp; in the line of code above is not a boolean expression. You have the mistake twice. You probably want to compare it to null, either == or !=.
score: 1
type: Answer

http://stackoverflow.com/comment/39430303
type: AnswerComment
has text: Thanks so much. I was assuming that the AST's equals() method only check whether two instances are exactly the same. Stupid me.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25259589

http://stackoverflow.com/comment/39445864
comment on: http://stackoverflow.com/a/25307805
type: Comment
has text: and make sure to mark it as `volatile` or use `AtomicBoolean`
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39532133
has text: I am using the webservice to get values from the server. I am really confused.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25354738
type: Comment

http://stackoverflow.com/comment/39445307
type: QuestionComment
has text: Ok. I verified that `~(';')+` _is_ valid in a parser rule and seems to match any token except (';').
comment on: http://stackoverflow.com/q/25305717
score: 0
type: Comment

http://stackoverflow.com/q/25294075
accepted answer: http://stackoverflow.com/a/25295981
type: Question
has title: Exponential values vs double ( big decimal conversion already used)
has answer: http://stackoverflow.com/a/25295981
tagged with: exponential
upvote count: 0
tagged with: double
score: -3
has comment: http://stackoverflow.com/comment/39420553
favorite count: 0
has body: i am using following function to format the double value to x.xx , but after that the result value started to end up with exponential value ( i have already read the answers which are advising to use the DecimalFormat or to plain text () methods but every where the system is giving error to change the types ...return types i am lost a bit now can some one please help me in following method tweaks so that the returning values can be displayed as normal number instead of 3.343E32 Please note that the following function FD is used many times in code so i want to change it here only so i dont have to apply the formatting each and every results / variable.. public double fd(double x) { BigDecimal bd_tax = new BigDecimal(x); BigDecimal formated = bd_tax.setScale(2, BigDecimal.ROUND_UP); x = Double.valueOf(formated.doubleValue()); return x; }
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 3

http://stackoverflow.com/q/25262728
has comment: http://stackoverflow.com/comment/39364227
has comment: http://stackoverflow.com/comment/39362794
upvote count: 0
tagged with: java
tagged with: multithreading
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25263029
favorite count: 0
type: Question
has body: This is a simple multithreaded chat program I'm doing. Everything works fine except the output formattting. AFter the client connects to the server, then the chat initiates. But on both the consoles, the message is prefixed with "Server: " instead of "Server: " for Client console and "Client: " for Server console (as per code) SERVER CODE import java.net.*; import java.io.*; class Server { public static void main(String args[]) throws Exception { ServerSocket ss = new ServerSocket(1234); Socket comsocket = ss.accept(); BufferedReader fromClientConsole = new BufferedReader(new InputStreamReader(comsocket.getInputStream())); DataOutputStream outStream = new DataOutputStream(comsocket.getOutputStream()); BufferedReader fromThisConsole = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Starting Chat session... Type 'endchat' to end the chat"); Thread read = new Thread(new Read(fromClientConsole)); Thread write = new Thread(new Write(fromThisConsole, outStream)); read.start(); write.start(); while( read.isAlive() || write.isAlive() ) ; comsocket.close(); ss.close(); } } class Read implements Runnable { BufferedReader fromClientConsole = null; String message = ""; Read(BufferedReader fromClientConsole) { this.fromClientConsole = fromClientConsole; } public void run() { try{ while(true) { message = fromClientConsole.readLine(); System.out.println(message); if(message.equalsIgnoreCase("endchat")) break; } } catch(IOException e) { } } } class Write implements Runnable { BufferedReader fromThisConsole=null; DataOutputStream outStream = null; String message = " "; Write(BufferedReader fromThisConsole, DataOutputStream outStream) { this.fromThisConsole = fromThisConsole; this.outStream = outStream; } public void run() { try { while(true) { message = fromThisConsole.readLine(); message = "Server: "+ message; outStream.writeBytes(message + "\n"); if(message.equalsIgnoreCase("endchat")) break; } } catch(IOException e) { } } } CLIENT CODE import java.net.*;…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39363649
score: -1
has title: Java: Consoled Multithreaded chat program

http://stackoverflow.com/q/25312455
has answer: http://stackoverflow.com/a/25312684
tagged with: java
has body: I need to run gradle build for one specific with JDK7 on windows in cygwin. In system properties JDK6 is set. And it should be used for building other projects. I've tried to set in gradle.properties org.gradle.java.home=/d/Java/jdk1.7.0_67/bin /cygpath is mapped on / but I get Java home supplied via 'org.gradle.java.home' is invalid. Invalid directory: /d/Java/jdk1.7.0_67/bin Also I've tried d:\\Java\\jdk1.7.0_67\\bin\\ but get almost the same error
answer count: 1
tagged with: gradle
type: Question
accepted answer: http://stackoverflow.com/a/25312684
tagged with: cygwin
has title: How to set JDK version in gradle.properties in cygwin
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25368677
favorite count: 0
type: Question
score: 1
tagged with: java
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39558528
tagged with: derby
has title: Delete from JDBC Derby Database using the auto-generated key (INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1))
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25368783
has answer: http://stackoverflow.com/a/25368783
answer count: 1
downvote count: 0
upvote count: 1
has body: Just wondering what I am doing wrong here and how to work around it. I've got a simple table that is created as so: String createTableSQL = ( "CREATE TABLE ITEM_OBJECT_TABLE (" + "ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1)," + "Item_Object blob)"); PreparedStatement ps = connection.prepareStatement(createTableSQL); ps.execute(); The table stores a blob of an "item" object Anyway. My delete method is as so: public void deleteItem(int i) { Debug.write("Attempting to delete item ID: "+i); try { PreparedStatement deleteStatement = databaseConnector.prepareStatement("DELETE FROM Item_Object_Table WHERE ID=?"); deleteStatement.setInt(1, i); deleteStatement.execute(); } catch (SQLException ex) { Logger.getLogger(DatabaseControl.class.getName()).log(Level.SEVERE, null, ex); } } This DOES delete the item but it does not update the integer ID not null always generated etc. For example if my database looked like this: ID 1 | Blob Data ID 2 | Blob Data And I called the deleteItem(int ID) method and parsed in the int 1 (i.e. delete ID 1) the database would look like this: ID 2 | Blob Data The question basically is, how do I 'update' the keys?

http://stackoverflow.com/comment/39345648
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25253350
type: QuestionComment
has text: take a look on this http://acs.lbl.gov/ACSSoftware/colt/

httphandler
tag name: httphandler
type: Tag
tags question: http://stackoverflow.com/q/25271886

http://stackoverflow.com/a/25306506
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25306170
has comment: http://stackoverflow.com/comment/39502162
score: 1
has body: you will not get fdata by request.getParameter("fdata"). but you will get all form field values by request.getParameter("your form field name given for fields"). at client side : to send form data to servlet $.ajax({ url:'servlet', data: $("#form1").serialize(), success: function (data) { } }); at servlet : request.getParameter("your form field name given for form fields").
downvote count: 0
has comment: http://stackoverflow.com/comment/39808863

http-status-code-301
tags question: http://stackoverflow.com/q/25263726
tag name: http-status-code-301
type: Tag

http://stackoverflow.com/comment/39358573
score: 0
type: QuestionComment
has text: What if I made 2 constructors with one parameter each?
type: Comment
comment on: http://stackoverflow.com/q/25260546

http://stackoverflow.com/comment/39647443
comment on: http://stackoverflow.com/a/25415945
type: AnswerComment
has text: Thanks for replying on four of my questions! I haven't tried it just yet but I will and I'll let you know how it goes.
score: 0
type: Comment

string
tags question: http://stackoverflow.com/q/25233593
tags question: http://stackoverflow.com/q/25333658
tags question: http://stackoverflow.com/q/25349464
tags question: http://stackoverflow.com/q/25377175
tags question: http://stackoverflow.com/q/25326643
tags question: http://stackoverflow.com/q/25236560
tags question: http://stackoverflow.com/q/25282945
type: Tag
tags question: http://stackoverflow.com/q/25250181
tags question: http://stackoverflow.com/q/25253451
tags question: http://stackoverflow.com/q/25357785
tags question: http://stackoverflow.com/q/25375094
tags question: http://stackoverflow.com/q/25385180
tags question: http://stackoverflow.com/q/25250553
tags question: http://stackoverflow.com/q/25381703
tags question: http://stackoverflow.com/q/25232220
tags question: http://stackoverflow.com/q/25355420
tags question: http://stackoverflow.com/q/25326199
tags question: http://stackoverflow.com/q/25286755
tags question: http://stackoverflow.com/q/25297414
tags question: http://stackoverflow.com/q/25374005
tags question: http://stackoverflow.com/q/25247156
tags question: http://stackoverflow.com/q/25327393
tags question: http://stackoverflow.com/q/25370380
tags question: http://stackoverflow.com/q/25375272
tags question: http://stackoverflow.com/q/25354967
tags question: http://stackoverflow.com/q/25305933
tags question: http://stackoverflow.com/q/25381262
tags question: http://stackoverflow.com/q/25282581
tags question: http://stackoverflow.com/q/25230297
tags question: http://stackoverflow.com/q/25336361
tags question: http://stackoverflow.com/q/25337621
tags question: http://stackoverflow.com/q/25306009
tags question: http://stackoverflow.com/q/25278920
tags question: http://stackoverflow.com/q/25371453
tags question: http://stackoverflow.com/q/25385343
tags question: http://stackoverflow.com/q/25316609
tags question: http://stackoverflow.com/q/25293099
tags question: http://stackoverflow.com/q/25336620
tags question: http://stackoverflow.com/q/25381511
tags question: http://stackoverflow.com/q/25357853
tags question: http://stackoverflow.com/q/25354468
tags question: http://stackoverflow.com/q/25312505
tags question: http://stackoverflow.com/q/25351490
tags question: http://stackoverflow.com/q/25354944
tags question: http://stackoverflow.com/q/25346062
tags question: http://stackoverflow.com/q/25301474
tags question: http://stackoverflow.com/q/25375102
tags question: http://stackoverflow.com/q/25251023
tags question: http://stackoverflow.com/q/25290036
tags question: http://stackoverflow.com/q/25235552
tags question: http://stackoverflow.com/q/25278216
tags question: http://stackoverflow.com/q/25265573
tags question: http://stackoverflow.com/q/25234032
tags question: http://stackoverflow.com/q/25235004
tags question: http://stackoverflow.com/q/25307945
tags question: http://stackoverflow.com/q/25346555
tags question: http://stackoverflow.com/q/25315405
tags question: http://stackoverflow.com/q/25350514
tags question: http://stackoverflow.com/q/25337233
tags question: http://stackoverflow.com/q/25276828
tags question: http://stackoverflow.com/q/25245725
tags question: http://stackoverflow.com/q/25258235
tags question: http://stackoverflow.com/q/25342485
tags question: http://stackoverflow.com/q/25313275
tags question: http://stackoverflow.com/q/25253418
tags question: http://stackoverflow.com/q/25354465
tags question: http://stackoverflow.com/q/25294836
tags question: http://stackoverflow.com/q/25293961
tags question: http://stackoverflow.com/q/25365667
tags question: http://stackoverflow.com/q/25232789
tag name: string
tags question: http://stackoverflow.com/q/25274046
tags question: http://stackoverflow.com/q/25351421
tags question: http://stackoverflow.com/q/25378743
tags question: http://stackoverflow.com/q/25330769
tags question: http://stackoverflow.com/q/25384010
tags question: http://stackoverflow.com/q/25245892
tags question: http://stackoverflow.com/q/25377521
tags question: http://stackoverflow.com/q/25317640

http://stackoverflow.com/comment/39550677
comment on: http://stackoverflow.com/q/25341787
type: QuestionComment
score: 1
has text: @sandhu Thanks for the link. I followed it to find a fix and wrote the details below.
type: Comment

http://stackoverflow.com/q/25239158
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39318754
has body: Consider the following snippet of the applicationContext.xml: &lt;task:scheduler id="xfsXmlProducer" pool-size="1" /&gt; &lt;task:scheduler id="xfsXmlConsumer" pool-size="${transactionqueue.consumerThreadsCount}" /&gt; &lt;task:scheduled-tasks scheduler="xfsXmlProducer"&gt; &lt;task:scheduled ref="xmlFileProducerJob" method="run" fixed-delay="3000"/&gt; &lt;/task:scheduled-tasks&gt; &lt;task:scheduled-tasks scheduler="xfsXmlConsumer"&gt; &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; &lt;/task:scheduled-tasks&gt; &lt;bean id="xmlFileConsumerJob" class="xxxx.parser.job.XmlFileConsumerJob" lazy-init="true" scope="prototype"/&gt; &lt;bean id="xmlFileProducerJob" class="xxxx.parser.job.XmlFileProducerJob" lazy-init="true"&gt; &lt;property name="transactionBulkSize" value="${transactionqueue.bulkSize}" /&gt; &lt;/bean&gt; Is there any way to avoid duplicating &lt;task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/&gt; ? I'd like just to specify number of workers.
score: 1
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39319636
type: UnansweredQuestion
has title: How do I avoid duplicating spring <task:scheduled ...>?
has comment: http://stackoverflow.com/comment/39322499
tagged with: spring
has comment: http://stackoverflow.com/comment/39320793
has comment: http://stackoverflow.com/comment/39322815
answer count: 0

http://stackoverflow.com/comment/39509014
type: Comment
type: QuestionComment
score: 0
has text: @MarkBramnik users.hbm.xml file is at the same folder with the hibernate.cfg.xml(that has the mapping resource property) so I assume that it is read. This is my only mapping. What do you mean configuration code?
comment on: http://stackoverflow.com/q/25341229

http://stackoverflow.com/a/25279550
upvote count: 6
has comment: http://stackoverflow.com/comment/39393109
has body: Why cant you go with comparator in collection. As you are new to java, you can learn the feature provided by java too. Check the below example for that. import java.util.Comparator; public class MyIntComparator implements Comparator&lt;Integer&gt;{ @Override public int compare(Integer o1, Integer o2) { return (o1&gt;o2 ? -1 : (o1==o2 ? 0 : 1)); } } -------------------------------------------------------- import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Simple2 { public static void main(String[] args) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); list.add(5); list.add(4); list.add(3); list.add(7); list.add(2); list.add(1); Collections.sort(list, new MyIntComparable()); for (Integer integer : list) { System.out.println(integer); } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/39400604
has comment: http://stackoverflow.com/comment/39393168
answers question: http://stackoverflow.com/q/25279412
score: 6
type: Answer

http://stackoverflow.com/comment/124545171
has text: The `TimeZone` class is part of the legacy date-time classes that were years ago supplanted by the modern *java.time* classes defined in JSR 310. Specifically, replaced by `ZoneId` & `ZoneOffset`.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/70455822

http://stackoverflow.com/q/25262449
type: Question
has comment: http://stackoverflow.com/comment/39457073
type: UnansweredQuestion
score: 10
upvote count: 10
tagged with: rabbitmq
has body: Here's what I know so far (please correct me): In the RabbitMQ Java client, operations on a channel throw IOException when there is a general network failure (malformed data from broker, authentication failures, missed heartbeats). Operations on a channel can also throw the ShutdownSignalException unchecked exception, typically an AlreadyClosedException when we tried to perform an action on the channel/connection after it has been shut down. The shutting down process happens in the event of "network failure, internal failure or explicit local shutdown" (e.g. via channel.close() or connection.close()). The shutdown event propagates down the "topology", from Connection -> Channel -> Consumer, and when the Channel it calls the Consumer's handleShutdown() method gets called. A user can also add a shutdown listener which is called after the shutdown process completes. Here is what I'm missing: Since an IOException indicates a network failure, does it also initiate a shutdown request? How does using auto-recovery mode affect shutdown requests? Does it cause channel operations to block while it tries to reconnect to the channel, or will the ShutdownSignalException still be thrown? Here is how I'm handling exceptions at the moment, is this a sensible approach? My setup is that I'm polling a QueueingConsumer and dispatching tasks to a worker pool. The rabbitmq client is encapsulated in MyRabbitMQWrapper here. When an exception occurs polling the queue I just gracefully shutdown everything and restart the client. When an exception occurs in the worker I also just log it and finish the worker. My biggest worry (related to Question 1): Suppose an IOException occurs in the worker, then the task doesn't get acked. If the shutdown does not then occur, I now have an un-acked task that will be in limbo forever. Pseudo-code: class Main { public static void main(String[] args) { while(true) { run(); //Easy way to restart the client, the connection has been //closed so RabbitMQ will re…
has comment: http://stackoverflow.com/comment/39457988
downvote count: 0
answer count: 0
tagged with: amqp
tagged with: java
has title: RabbitMQ Java client - How to sensibly handle exceptions and shutdowns?
has comment: http://stackoverflow.com/comment/72439548
favorite count: 0

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/25340608
tags question: http://stackoverflow.com/q/25239428
tags question: http://stackoverflow.com/q/25250971
tags question: http://stackoverflow.com/q/25287150

deployment
tags question: http://stackoverflow.com/q/25259802
tag name: deployment
tags question: http://stackoverflow.com/q/25379758
type: Tag
tags question: http://stackoverflow.com/q/25282983
tags question: http://stackoverflow.com/q/25271501
tags question: http://stackoverflow.com/q/25240664

http://stackoverflow.com/comment/39450053
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25309741
has text: Please include your stack trace. We can use that to help determine what your problem is. You've only just told us its a `NullPointerException`. Before that, you only said it was a runtime error. Stack traces are a must-have for Java questions which are about errors.
type: Comment

http://stackoverflow.com/a/25350394
accepted answer of: http://stackoverflow.com/q/25350328
has body: "How to set Listener when pressed color from JColorChooser" When in doubt, refer to the tutorial. It states: A color chooser uses an instance of ColorSelectionModel to contain and manage the current selection. The color selection model fires a change event whenever the user changes the color in the color chooser. Example code from tutorial tcc.getSelectionModel().addChangeListener(this); . . . public void stateChanged(ChangeEvent e) { Color newColor = tcc.getColor(); banner.setForeground(newColor); } UPDATE The color chooser tutorial has a ColorChooserDemo program that should be fairly easy to follow, but here's an even simpler program that should be even easier to follow. import java.awt.Color; import javax.swing.JColorChooser; import javax.swing.JDialog; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class DemoColorChooser { public static void main(String[] args) { final JColorChooser chooser = new JColorChooser(); chooser.setColor(Color.BLUE); chooser.getSelectionModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { Color color = chooser.getColor(); System.out.println(color); } }); JDialog dialog = JColorChooser.createDialog(null, "Color Chooser", true, chooser, null, null); dialog.setVisible(true); System.exit(0); } } You should keep in mind that a JColorChooser is just a normal component, it is a not a dialog window. It may seem that way because you may be used to using JColorChooser.showDialog() which automatically wraps it in in a dialog. But as you can see in the code above, I wrap it myself. Knowing this allows you to add other viewing components to the dialog, as you say you "want to present some kind of preview", you can do so in the dialog
has comment: http://stackoverflow.com/comment/39524395
type: Answer
answers question: http://stackoverflow.com/q/25350328
upvote count: 6
has comment: http://stackoverflow.com/comment/39524330
has comment: http://stackoverflow.com/comment/39524501
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/39524278
has comment: http://stackoverflow.com/comment/39524457

http://stackoverflow.com/comment/39392377
has text: What is the value of `useLegacy`? Problem might be inside `readStringLegacy()`.
score: 0
comment on: http://stackoverflow.com/q/25279137
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25261224
has answer: http://stackoverflow.com/a/25261440
tagged with: sockets
has comment: http://stackoverflow.com/comment/39359978
has comment: http://stackoverflow.com/comment/39359669
tagged with: microcontroller
has comment: http://stackoverflow.com/comment/39360033
type: AnsweredQuestion
score: 0
tagged with: tcp
tagged with: java
has body: I try to communicate with a java application to a µController in wifi (Flyport). I have a problem with the java application : It first create a socket to communicate with the Flyport server, then send a message and receive the Flyport answer. Everything work fine until the read part. I'm polling the read() function of the BufferedReader until it return -1, but it doesn't. The first read works fine, all the answer are red, but the application stay stuck when it tries to read again. My code is very simple : Java application : try ( Socket clientSocket = new Socket(hostName, portNumber); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); ) { ...//Connection and sending message works fine } char[] buffer = new char[500]; while ((in.read(buffer)) != -1) { // first read() works fine, second read() stay stuck... System.out.println(buffer); // display all answer sent by flyport } The code in the flyport : while(isClientConnected){ //check if client is still connected ... //read client message while((RxLen=TCPRxLen(sock))&gt;0) { TCPRead(sock,bff,RxLen); strcat(msg,bff); } //write back to the client that the order is received TCPWrite(sock, msg, strlen(msg)); //process the client order ... //Write to the client that the process is done TCPWrite(sock, msg2, strlen(msg2)); } The java application read msg and msg2 with the first read(). msg and msg2 have "\r\n" at the end. Doesn't somebody can tell me where I am wrong ? Is there a function from BufferedReading that tells how much data there is left to read ? Thanks and regards. NB : I try with a small buffer in the java application, the problem is the same, read() is stuck when there is nothing left to read...
answer count: 1
tagged with: socket.io
type: Question
has title: Java communication with TCP socket and PIC stuck in read()
accepted answer: http://stackoverflow.com/a/25261440
has comment: http://stackoverflow.com/comment/39360073

http://stackoverflow.com/comment/39517019
has text: @Eran true2x, just pointing out what it might happen. If there is no constructor that will instantiate it.
type: AnswerComment
comment on: http://stackoverflow.com/a/25346304
score: 0
type: Comment

http://stackoverflow.com/comment/48620443
type: AnswerComment
has text: I think your answer might be an over-simplification - note that the start indices of the loops differ by one and the step is 4, so each thread does not interact with the same member of the array as any other (i.e. they're operating on distinct subsets of the array).
score: 0
comment on: http://stackoverflow.com/a/30258029
type: Comment

http://stackoverflow.com/comment/39488378
has text: @stefan so I cannot use ResourceBundle and specify absolute path?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25268843

http://stackoverflow.com/comment/39376696
comment on: http://stackoverflow.com/a/25270384
type: Comment
score: 0
type: AnswerComment
has text: This iterates twice of the list, which might be/is suboptimal.

http://stackoverflow.com/comment/39515943
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25345620
has text: Not just the speed. It simplifies compiler code and increases its reliability. Also, there are must be cases that are virtually impossible to interpret with absolute certainty.
type: Comment

http://stackoverflow.com/comment/39686083
type: AnswerComment
has text: @Chad: Oh my, just how do you even keep track of what versions you need? Anyway, no, there's no mechanism in git for this. You could whip up a script to do the switching for you though (git is easy to script, since it works on the command line). You could even check this in with each version or the main project, so you check out the main project, run the checkout script, and you're good to go.
comment on: http://stackoverflow.com/a/25400214
score: 0
type: Comment

http://stackoverflow.com/comment/127955914
score: 2
has text: This is actually a Java bug (https://bugs.openjdk.java.net/browse/JDK-4724038) and there does not seem to be a proper workaround. All the answers provided here so far are considered dangerous by the JDK team.
type: QuestionComment
comment on: http://stackoverflow.com/q/25238110
type: Comment

http://stackoverflow.com/comment/39337427
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25249105
type: Comment
has text: You need to specify the problem more clearly. Show some examples of actual input ***and*** the expected output and explain how the replacement values are mapped to the tags they replace.

http://stackoverflow.com/q/25271262
tagged with: java
downvote count: 0
tagged with: mysql
tagged with: character-encoding
tagged with: utf-8
has comment: http://stackoverflow.com/comment/39380305
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39390973
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25283701
has title: Generate Malformed Strings for Testing
type: UnansweredQuestion
tagged with: php
has body: I'm using and contributing to a library (https://github.com/neitanod/forceutf8) to fix encoding issues in our system, and to guarantee that any encoding issues will be transparently fixed before they are displayed to the user. I need some test cases, and what I would like is a function that takes a UTF-8 string and converts it into a malformed string. Then I can run it through my library to make sure it fixes it properly: // psuedocode strings = [ '공', '人', '', 'passé' ]; foreach ( string in strings ) malformed = garble( string ) print( string + " =&gt; " + malformed + "\n" ) Here are some examples of malformed strings: "äºº" --&gt; 人 "ð´ " --&gt; (a red ball—works in Safari) Here's the raw hex data: &lt;?php $strings = array( "äºº", "人", "ê³µ", "공", "ð´", "" ); foreach ( $strings as $string ) echo " '$string' \t =&gt; '" . unpack( "H*", $string )[1] ."'\n"; ?&gt; Output: 'äºº' =&gt; 'c3a4c2bac2ba' '人' =&gt; 'e4baba' 'ê³µ' =&gt; 'c3aac2b3c2b5' '공' =&gt; 'eab3b5' 'ð´' =&gt; 'c3b0c29fc294c2b4' '' =&gt; 'f09f94b4' You can see that 人 is e4 ba ba and its characters can be found in the malformed string in between a few c2's like so: c3a 4 c2 ba c2 ba I hope this is clear enough. One way that strings can be generated is to insert them into MySQL and then take them back out.
has comment: http://stackoverflow.com/comment/39383727
score: 2

http://stackoverflow.com/q/25272715
has title: How to deny direct url access to files on Jetty
tagged with: block
has body: I'm running webapps on Jetty. I have set "dirAllowed" to "false" to disable the directory browsing on the defined contextpath by webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"). But, users can still access other files (not located on the contextpath) through url (eg. http://somehost.yahoo.com:8081/abc.xml) and abc.xml is located under the root directory of the Jetty server. Is there a way to block/deny direct url access to files located on Jetty? Thanks!
score: 0
tagged with: java
answer count: 1
tagged with: file
tagged with: web-applications
type: Question
type: UnansweredQuestion
tagged with: jetty
has answer: http://stackoverflow.com/a/25272969

http://stackoverflow.com/comment/39481737
score: 0
has text: Could you install wireshark on your windows machine, and set it to monitor port 4444? This way we could at least tell if anything at all gets in on port 4444... maybe it's the outbound leg that's causing the issue.
comment on: http://stackoverflow.com/q/25325579
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39453515
score: 1
type: Comment
type: QuestionComment
has text: You mean, acknowledge it to the Server? In the rest-ful world, you will have to expose another endpoint on the server that would 'accept' acknowledgements. Upon receiving the information from the server, the client would make another call to the 'acknowledgement' endpoint - is what I think. `Request -> Response -> Accept_Acknowledgement_Request -> Optional_Response`
comment on: http://stackoverflow.com/q/25271569

http://stackoverflow.com/comment/39510666
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25342362
has text: I removed and I tried with all 3 modes you have mentioned. But it is not working. One good thing I saw is for STREAM_TRANSFER_MODE server accepts the mode type. Still I got the exception I gave above in java application. For other 2 modes you mentioned it says unimplemented mode in server log.
type: Comment

http://stackoverflow.com/q/25361776
tagged with: java
has body: I have a function in Java. It normally returns a value after it completes its task. However, in some conditions it returns nothing. I create a runnable and run this function as a thread. However, because of its not returning a value, it does not finish although it does its task. The process stays alive because it waits a returning value. Is there a way to kill this thread after it is triggered or after a timeout? Stop() or Destroy() did not work. During debug, the thread is seen as alive and I want it to bi deleted/removed Runnable runnable = new Runnable() { @Override public void run() { int stat = RunMyFunction(); } }; Thread thread = new Thread(runnable); thread.start();
has answer: http://stackoverflow.com/a/25362198
tagged with: runnable
has title: Kill or stop a endless/not-returning-value thread in Java
has answer: http://stackoverflow.com/a/25366202
has comment: http://stackoverflow.com/comment/39544671
has answer: http://stackoverflow.com/a/25362377
type: Question
linked to: http://stackoverflow.com/q/636367
has comment: http://stackoverflow.com/comment/39544620
has answer: http://stackoverflow.com/a/25362128
type: UnansweredQuestion
tagged with: kill
tagged with: multithreading
answer count: 4
has comment: http://stackoverflow.com/comment/39544764
has comment: http://stackoverflow.com/comment/39544722
score: 0

http://stackoverflow.com/a/25398050
has body: It's still valid, given it's a consequence of RPC design (and GWT generator design). If you use List then you could in theory use any class implementing the interface, so the generator has to take it into account. And generators run before any optimisation happens so they can't tell a specific is/will actually be used by the app (not to mention that it can't tell what the server will return)
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25383501
answers question: http://stackoverflow.com/q/25383501

http://stackoverflow.com/comment/39504036
score: 0
has text: i did but no use.......
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25338592

http://stackoverflow.com/comment/39376966
has text: @user3808021 you should add an `else` statement as well...
comment on: http://stackoverflow.com/q/25270399
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39391602
has text: I've added full stacktrace to post.
score: 0
comment on: http://stackoverflow.com/q/25264143
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39401596
score: 0
comment on: http://stackoverflow.com/q/25283716
type: Comment
has text: You've put me on the right tack again! Thank you so much!
type: QuestionComment

http://stackoverflow.com/a/25381631
has comment: http://stackoverflow.com/comment/39583388
has body: It seems that double hourlyWage = Double.parseDouble( wageTextField.getText() ); double hoursWorked = Double.parseDouble( hourTextField.getText() ); wageTextField or hourTextField is empty string when click button. Check it. SOLUTION When click on calculate button is performed (actionPerformed method) you should check if wageTextField and hourTextField are not empty. If one of them is empty, two lines above shouldn't be executed.
answers question: http://stackoverflow.com/q/25381511
type: Answer
score: 0

http://stackoverflow.com/comment/39588498
has text: Does anyplace inside of your try block LOG ? Or does your catch block LOG instead ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25384741

http://stackoverflow.com/a/41183869
has body: Bear in mind that post() may be called from background threads at the same time as mAttachInfo is updated on the UI thread. The code that was used up to Android 2.3.3 could throw an NPE if mAttachInfo was set to null after the if (mAttachInfo != null) check and before mAttachInfo.mHandler was accessed. The current code avoids the NPE by taking a snapshot of mAttachInfo that doesn't change for the lifetime of the method. The local variable doesn't strictly need to be final, but declaring it final makes it extra clear that it won't become null after the if (attachInfo != null) check.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25340219
upvote count: 1
type: Answer

http://stackoverflow.com/a/25378411
has comment: http://stackoverflow.com/comment/39576965
answers question: http://stackoverflow.com/q/25378347
score: 0
has comment: http://stackoverflow.com/comment/39576805
has comment: http://stackoverflow.com/comment/39577438
has comment: http://stackoverflow.com/comment/39576897
has comment: http://stackoverflow.com/comment/39655920
has body: Try Java Reflection - Fields with #getFields(); In your scenario, you can try: public String getSetting(String strKey){ Class tmp = setting.class; try { Field field = tmp.getField(strKey); return value; // depend on your class instance or field type. } catch (NoSuchFieldException e) { // get data from database and return } }
type: Answer
has comment: http://stackoverflow.com/comment/39579381
has comment: http://stackoverflow.com/comment/39660497
has comment: http://stackoverflow.com/comment/39576960

http://stackoverflow.com/a/25333395
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25332525
has body: I figured out the issue: I had apply plugin: 'android' when I should have had apply plugin: 'android-library' I must have made copy-paste error when editing the gradle file of projectutils.

http://stackoverflow.com/q/25265692
has body: I'm creating a custom annotation named @Skip as shown below. @Retention (RetentionPolicy.RUNTIME) @Target ({ElementType.TYPE, ElementType.METHOD}) @Inherited public @interface Skip { public String comment() default ""; public String bug() default ""; } Is it possible to set conditional default value on the comment and bug? What I'm trying to achieve is, if comment is provided, bug must be optional, if bug is provided comment is optional. I can do this check at run-time, but I want to find out if we can do it at compile time. This way, eclipse will show a compilation error if at least one of these is not provided by the developer.
accepted answer: http://stackoverflow.com/a/25265803
tagged with: java
has answer: http://stackoverflow.com/a/25265803
type: AnsweredQuestion
score: 0
tagged with: annotations
answer count: 1
has title: Annotation with multiple parameters with conditional default value
type: Question

http://stackoverflow.com/q/25257441
type: UnansweredQuestion
has title: Force exit task that requires authentication when user returns from lock screen
has comment: http://stackoverflow.com/comment/39354197
has comment: http://stackoverflow.com/comment/39371180
has comment: http://stackoverflow.com/comment/39353814
type: Question
score: 0
tagged with: android
tagged with: java
tagged with: client
tagged with: android-activity
has body: Scenario From activity A: User presses button that directs them to a pin authentication dialog. If the user enters a valid pin, they are put into activity B. If invalid, they remain in activity A. From activity B: User navigates to activity C in another application. User locks the device. User unlocks the device. What happens User is back in activity C. Desired behavior User is thrown back into activity A. Question How is it possible to launch activity C in such a way that the user is kicked out when they try to return to it from lock screen? The difficult part here is that I have no control over activity C other than how I send the intent from my application.
has comment: http://stackoverflow.com/comment/39353370
answer count: 0

http://stackoverflow.com/q/25362516
has comment: http://stackoverflow.com/comment/39546007
has comment: http://stackoverflow.com/comment/39546403
has comment: http://stackoverflow.com/comment/39546839
has comment: http://stackoverflow.com/comment/39545961
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39546086
has comment: http://stackoverflow.com/comment/39546081
has comment: http://stackoverflow.com/comment/39546149
score: 0
has comment: http://stackoverflow.com/comment/39546390
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/39546181
tagged with: java
has answer: http://stackoverflow.com/a/25363702
answer count: 1
has comment: http://stackoverflow.com/comment/39546026
has title: Android throwing null pointer exception when accessing a keyboard from another fragment
has body: So I have a Fragment Activity that uses another fragments keyboard to add a marker to a map and I kep getting a null pointer exception. I'm also accessing the keyboard in its host fragment to add data to a list.To be clear the keyboard is being used by two fragments at the same time. My code(This is the fragment where i access the keyboard from another fragment): @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final EditText textLat = (EditText)findViewById(R.id.textLat); final EditText textLong = (EditText)findViewById(R.id.textLong); EditText PO = (EditText)findViewById(R.id.POdata); setContentView(R.layout.activity_maps); setUpMapIfNeeded(); mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker")); mMap.setMyLocationEnabled(true); /*this line throws the error*/PO.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER &amp;&amp; event.getAction() == KeyEvent.ACTION_DOWN) { int Latitudei = Integer.parseInt(textLat.getText().toString()); int Logitudei = Integer.parseInt(textLong.getText().toString()); mMap.addMarker(new MarkerOptions().position(new LatLng(Latitudei, Logitudei))); } return false; } }); } this is keyboard's fragment @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { final EditText PO = (EditText)getActivity().findViewById(R.id.POdata); EditText textLat = (EditText)getActivity().findViewById(R.id.textLat); EditText textLong = (EditText)getActivity().findViewById(R.id.textLong); ListView data = (ListView)getActivity().findViewById(R.id.listView); mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;( getActivity(), android.R.layout.simple_list_item_1, POin); data.setAdapter(arrayAdapter); PO.setOnKey…
tagged with: keyboard
type: Question

http://stackoverflow.com/comment/39437682
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25286613
type: AnswerComment
has text: Creating a third `interface` extending two others is not the same as specifying the requirement of implementing the two interfaces via Generics. Think of `<T extends CharSequence&Serializable>`, here, `String` will fulfill the requirement while it won’t implement your custom interface `X extends CharSequence, Serializable`. In this scenario, using Generics is clearly the right thing to do.

http://stackoverflow.com/q/25230861
answer count: 2
tagged with: jhipster
accepted answer: http://stackoverflow.com/a/25280897
has answer: http://stackoverflow.com/a/25280897
downvote count: 0
score: 18
tagged with: authentication
possible better answer: http://stackoverflow.com/a/56468396
tagged with: spring
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/56468396
type: Question
type: AnsweredQuestion
tagged with: java
has body: I have a spring rest service, I want to use it for authenticated and not authenticated users. And I want to get user information from SecurityContextHolder.getContext().getAuthentication() if user is authenticated. If I use .antMatchers("/app/rest/question/useroperation/list/**").permitAll() in ouath2 configuration like below, then I can get user info for authenticated user, but 401 error for not authenticated users. If I .antMatchers("/app/rest/question/useroperation/list/**").permitAll() and ignore the url in WebSecurity by web.ignoring()..antMatchers("/app/rest/question/useroperation/list/**") in SecurityConfiguration like below, then all users can call the service, but I cant get user information from SecurityContext. How can configure my spring security to call a url for authenticated and not authenticated users and get user info from SecurityContext if user logged in. @Configuration @EnableResourceServer protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { @Inject private Http401UnauthorizedEntryPoint authenticationEntryPoint; @Inject private AjaxLogoutSuccessHandler ajaxLogoutSuccessHandler; @Override public void configure(HttpSecurity http) throws Exception { http .exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint) .and() .logout() .logoutUrl("/app/logout") .logoutSuccessHandler(ajaxLogoutSuccessHandler) .and() .csrf() .requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize")) .disable() .headers() .frameOptions().disable() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers("/views/**").permitAll() .antMatchers("/app/rest/authenticate").permitAll() .antMatchers("/app/rest/register").permitAll() .antMatchers("/app/rest/question/useroperation/list/**").permitAll() .antMatchers("/app/rest/question/useroperation/comment/**").authenticated() .antMatchers("/app/rest/question/useroperation/answer/**").authenticated() .ant…
upvote count: 18
has title: Spring Security get user info in rest service, for authenticated and not authenticated users

http://stackoverflow.com/q/25249138
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25249814
tagged with: github
favorite count: 0
type: Question
tagged with: mylyn
has title: Where is 'time spent' shown in Eclipse Mylyn?
has body: I cannot find where time spent is in Eclipse Luna with Mylyn. According to http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.mylyn.help.ui%2FMylyn%2FFAQ%2FTask-List.html, it is in the "Personal Planning" tab when looking at an item in Mylyn. However, I see no such tab: (screenshot of an open Mylyn item for me: http://cl.ly/image/2v0t2e0i2k3P) I thought maybe it was related to my use of the GitHub Mylyn connector but creating a local task also does not display this information. To be clear: I can activate/de-activate a task and I can set the estimated number of hours, but I cannot figure out how to simply view what time has been spent so far.
tagged with: eclipse
type: AnsweredQuestion
tagged with: eclipse-luna
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25249814
answer count: 1

http://stackoverflow.com/comment/39517021
type: Comment
has text: I guess answering here would help several other users.
comment on: http://stackoverflow.com/a/25346257
type: AnswerComment
score: 1

app-engine-modules
type: Tag
tags question: http://stackoverflow.com/q/25263894
tag name: app-engine-modules

http://stackoverflow.com/comment/39436461
type: Comment
has text: I am really sorry to say this is not working for me.
comment on: http://stackoverflow.com/a/25302463
score: 0
type: AnswerComment

http://stackoverflow.com/a/25258770
has body: This is called either the fully qualified name or the canonical name of the class (both are the same in this case since it is a top level class). See the Java Language Specification If you want to pass exactly this name to a String parameter, you should do so using TestClass.class.getName()
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25258653

http://stackoverflow.com/comment/39519423
score: 0
type: AnswerComment
has text: @Antony If you need to write all the logs to console except Debug, please add the same filter to console appender but with a small change. Instead of on match accept you replace it with delay and onmissmatch replace it with accept
type: Comment
comment on: http://stackoverflow.com/a/25339612

http://stackoverflow.com/q/25348925
has body: How can I implement Google Search bar in custom application? I found some sources, but that's very difficult to implement (too much variables and values). I want implement search bar, when I can search via text and voice like original search bar in Google Now Launcher. Link to image: https://i.sstatic.net/HHHOL.jpg
type: UnansweredQuestion
tagged with: android
tagged with: search
answer count: 0
upvote count: 3
tagged with: java
downvote count: 0
has title: How to implement Google Search bar in custom app?
favorite count: 0
type: Question
score: 3

http://stackoverflow.com/q/25248703
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/25248811
type: Question
tagged with: spring-mvc
tagged with: controller
has title: Controller not firing on .jsp page hit MVC Spring JAVA
score: 1
has body: Trying to get a Spring MVC controller to fire when a .jsp page in my web project is hit directly. Web XML for the dispatcher servlet: MYAPP org.springframework.web.servlet.DispatcherServlet 1 MYAPP /* In the dispatcher configuration I have the following bean defined: /WEB-INF/ .jsp Controller Class: package com.mydomain.controllers; import javax.servlet.http.HttpServletRequest; 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; import com.mydomain.security.Authorization; @Controller public class CustomerController { @RequestMapping("/customer") public String customer(HttpServletRequest request) { if (Authorization.SessionCheck(request)) return "../customer/customer"; else return "redirect:http://elsewhere.com"; } } Off the root, I have a jsp page in /WebContent/customer/customer.jsp If, in a browser, I hit http://myhost.com/MYAPP/customer, the controller processes the customer method above just fine. However, if I hit http://myhost.com/MYAPP/customer/customer.jsp, then the controller never fires and just the customer.jsp page is rendered. How do I get the controller to process when the .jsp page is hit?
tagged with: java
favorite count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25248806
type: UnansweredQuestion
downvote count: 0
tagged with: jsp

http://stackoverflow.com/q/25257415
has comment: http://stackoverflow.com/comment/39354162
score: 0
has comment: http://stackoverflow.com/comment/39353274
has body: I am still new to android app develop and right now i am stumble with this crashes and unable to fix Manifest file Details <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.outsource.ecg.ECG_MANAGER_MANAGE" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.outsource.ecg.ECG_NEW_USER" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.outsource.ecg.VIEW_HISTORY_RECORDS" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.MEDIA_MOUNTED" /> <action android:name="android.intent.action.MEDIA_UNMOUNTED" /> <action android:name="android.intent.action.MEDIA_SCANNER_STARTED" /> <action android:name="android.intent.action.MEDIA_REMOVED" /> <action android:name="android.intent.action.MEDIA_BAD_REMOVAL" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> Can anyone PLEASE help me with this. it is so frustrated since i can not see where can go wrong. the point of the app is to get the ecg signal to the app, draw it and store it ***edit : add appEntryAdapter public static class AppEntryAdapter extends BaseAdapter { private LayoutInflater mInflater; private Context mContext; private ArrayList<AppEntry> mAppEntries; public AppEntryAdapter(Context context, ArrayList<AppEntry> entries) { mContext = context; mAppEntries = entries; mInflater = LayoutInflater.from(context); } and this is line 137 and 138 in mainActivity final AppEntry entry = mAppEntries.get(arg0); appButton.setText(mContext.getString(entry.displayNameResID())); _------------------------------------------------------- R.string : public s…
has comment: http://stackoverflow.com/comment/39353967
has comment: http://stackoverflow.com/comment/39353039
has comment: http://stackoverflow.com/comment/39353999
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39354100
has comment: http://stackoverflow.com/comment/39353735
has answer: http://stackoverflow.com/a/25257755
has answer: http://stackoverflow.com/a/25258219
has title: How to fix App Crashes on launch on Android
type: Question
has comment: http://stackoverflow.com/comment/39353003
tagged with: crash
answer count: 2
has comment: http://stackoverflow.com/comment/39354262
type: UnansweredQuestion

http://stackoverflow.com/q/25231185
accepted answer: http://stackoverflow.com/a/25231563
has answer: http://stackoverflow.com/a/25231563
type: AnsweredQuestion
has title: How to format a string of days-of-the-week using Java?
score: 0
has body: Using Java 6, and with an input string (from an array of such entries) that comprises any combination of the days-of-the-week in the order that follows MTWThF how can one format the string such that one gets M,T,W,Th,F (i.e. a comma after each day except the last day) The string represents the working days for an employee. Once again, here's the 'catch' (no Java pun intended) -- any employee can work any combination of days. So, the input at times could be MW and so the output should be M,W I have used the replaceAll() method and I have come close but I've had to call the method several times on the string to do this. So I thought maybe someone had done this -- or something like it -- before and found an simpler way. Thank you
has comment: http://stackoverflow.com/comment/39302988
tagged with: java
answer count: 1
type: Question

http://stackoverflow.com/a/25288666
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25283535
accepted answer of: http://stackoverflow.com/q/25283535
score: 3
has comment: http://stackoverflow.com/comment/39500611
type: Answer
has body: I am little confuse on what you tried increasing the size of heap in MemoryAnalyzer.ini to 80% of the file size Solution 1: I know you already tried but 80% is little confusing 1.open the MemoryAnalyzer.ini file ； 2.change the default -Xmx1024m to a larger size. Solution 2: If you have local setup of your code, add some debug points and take heap dumps at runtime on every debug break point (which will divide your big size heap dump file into smaller size file. You will solve size issue and it will be easy to get to root cause faster)
upvote count: 3

http://stackoverflow.com/comment/39473612
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25322599
type: Comment
has text: If you are not practicing reflection then @Smith_61 is valid. Regarding the exception make the constructor public and it should fix it

http://stackoverflow.com/q/25341576
tagged with: java
tagged with: size
has answer: http://stackoverflow.com/a/25341711
tagged with: insets
has comment: http://stackoverflow.com/comment/39509352
type: Question
tagged with: contentpane
has body: When I set the size of the JFrame its set the size of the frame itself including the borders. I tried creating a new content Panel and set that size instead of setting the size of the frame itself but it isn't working here is the code: frame = new JFrame(); JPanel jp = new JPanel(); frame.setTitle(title); //frame.setSize(width, height); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //insets = frame.getInsets(); //frame.setSize(new Dimension(insets.left + width + insets.right, insets.top + height + insets.bottom)); jp.setPreferredSize(new Dimension(width, height)); frame.setContentPane(jp); frame.pack(); frame.setVisible(true); So using insets isn't working and using a new ContentPane is also not working I hope it is clear enough. EDIT: It's working now I extended the class with Canvas set it's size to width and height and then added it to the JFrame then packed it. This works! But why I think caused it was not the sizing but the way I rendered it, I got the bufferStrategy from the JFrame instead of the canvas which is not the way it should be.
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/39509482
tagged with: jframe
answer count: 1
downvote count: 0
has title: JFrame not sizing correctly
upvote count: 1
score: 1
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7196889
accepted answer: http://stackoverflow.com/a/25341711

http://stackoverflow.com/a/25375032
has body: You could use subclassing with an automatic serialisation framework. For example using JAXB (which supports both JSON and XML): class DetailSummary { public @XmlElement String name; public @XmlElement String description; public @XmlElement String owner; } class Detail extends DetailSummary { public @XmlElement List&lt;Task&gt; tasks; ... } This approach allows multiple levels of detail but forces you to use your classes as simple records.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25374788
type: Answer

http://stackoverflow.com/q/25379127
has comment: http://stackoverflow.com/comment/39578014
has answer: http://stackoverflow.com/a/25380782
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/25541125
tagged with: log4j
favorite count: 0
type: Question
answer count: 2
tagged with: log4jdbc
type: UnansweredQuestion
has body: I am trying to use the new log4j2 release in my application and it is not working. It was working when i used log4j-api-2.0-beta9.jar and log4j-core-2.0-beta9 but its not working after i replaced it with the new release: log4j-api-2.0.1.jar and log4j-core-2.0.1.jar My application is developed using spring MVC and struts 2. Is there any extra reconfiguration that needed before running?
downvote count: 0
has title: Replacing log4j-api-2.0-beta9.jar,log4j-core-2.0-beta9 with log4j-api-2.0.1.jar and log4j-core-2.0.1.jar not working
has comment: http://stackoverflow.com/comment/39578112
tagged with: log4j2
tagged with: logging
tagged with: java

http://stackoverflow.com/a/25236368
has comment: http://stackoverflow.com/comment/39313635
has comment: http://stackoverflow.com/comment/39314110
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25236281
has comment: http://stackoverflow.com/comment/39413985
has body: Call your Java program by passing a command line parameter: echo exec ('java PROG "' . $image . '"');
score: 2
answers question: http://stackoverflow.com/q/25236281
has comment: http://stackoverflow.com/comment/39313742
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39314238

http://stackoverflow.com/comment/39521796
comment on: http://stackoverflow.com/q/25349181
has text: Try to log if the onKeyDown event works first.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25359385
answers question: http://stackoverflow.com/q/25359128
score: 0
has comment: http://stackoverflow.com/comment/39540675
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25359128
type: Answer
has body: Try to set extra variable and then set score int x = score++; TextView score1 = (TextView) findViewById(R.id.score); score1.setText(Integer.toString(score)); If it still do not work - you're sure, that your code is going into if or else? another thing - (I'm not sure with views) you should use in 'if' method "equals" instead of '=='

http://stackoverflow.com/comment/74093577
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25266052
type: AnswerComment
has text: @GersonSosa same issue here. I can create a HikariConfig, the jndi datasource and the entitymanager but cant find how to put them all together. In HikariCPConnectionProvider there is a DataSource property but cannot be accessed with spring. when we instanciate the provider it only accepts String from jpaProperties map

http://stackoverflow.com/comment/39535170
comment on: http://stackoverflow.com/a/25288186
type: Comment
score: 0
type: AnswerComment
has text: Above code not works for me... There is no such link text exist in Inspecting Element

http://stackoverflow.com/comment/39450262
type: Comment
comment on: http://stackoverflow.com/a/25290895
type: AnswerComment
has text: In retrospect it hasn't actually done an update, it does nothing, but the syntax error is gone. Why would you have me move ID to the 8th position?
score: 0

http://stackoverflow.com/comment/39544807
score: 0
comment on: http://stackoverflow.com/a/25279954
has text: yeah I did thanks thanks mad programmer , i am warming up with this things sorry for too many questions ! obj.jTable1.setDefaultRenderer(BigDecimal.class, new CurrencyRenderer(nf) { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setOpaque(isSelected); return this; } });
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25371200
has comment: http://stackoverflow.com/comment/39567582
tagged with: spring
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39564165
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39563189
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39567117
has comment: http://stackoverflow.com/comment/39570735
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25378874
accepted answer: http://stackoverflow.com/a/25378874
has comment: http://stackoverflow.com/comment/39563415
has comment: http://stackoverflow.com/comment/39563399
tagged with: eclipse
has body: I have been looking for 2 days to find solutions to this issue but not been abel to fix it. URL: (/HelloSpring/WEB-INF/hello.jsp) Edited to (/HelloSpring/hello.jsp) import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/hello") public class HelloController{ @RequestMapping(method = RequestMethod.GET) public String printHello(ModelMap model) { model.addAttribute("message", "Hello Spring MVC Framework!"); return "hello"; } } hellospring-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.smithak.hellospring" /> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/" /> <property name="suffix" value=".jsp" /> </beans> web.xml <?xml version="1.0" encoding="UTF-8"?> Spring MVC Application hellospring org.springframework.web.servlet.DispatcherServlet 1 hellospring *.jsp when I deploy and run it on tomcat I get the following error HTTP Status 404 - The requested resource () is not available. Stack trace type Exception report message Servlet.init() for servlet hellospring threw exception description The server encountered an internal error (Servlet.init() for servlet hellospring threw exception) that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet hellospring threw exception org.apache.catalina.authent…
has comment: http://stackoverflow.com/comment/39566680
favorite count: 0
type: Question
upvote count: 2
has title: Running a SpringMVC app in tomcat 7.0 gives me error 500 as shown in StackTrace
has comment: http://stackoverflow.com/comment/39569475
answer count: 1

http://stackoverflow.com/comment/39566694
has text: thanks azurefrog and Arvy
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25373062

http://stackoverflow.com/comment/39585261
type: Comment
has text: @SubirKumarSao -- He is using a JSON library. Just not correctly. (And streaming JSON is very difficult to use correctly, so he would indeed be well-advised to choose a different kit.)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25382394

http://stackoverflow.com/q/25351750
has answer: http://stackoverflow.com/a/25351803
has answer: http://stackoverflow.com/a/25352112
has title: What are the differences between Maven Jar Plugin and Maven Assembly Plugin?
score: 59
has comment: http://stackoverflow.com/comment/84419668
tagged with: java
upvote count: 59
has body: Could somebody explain me the exactly differences between these two Maven plugins and when it is useful to work with one of these plugins?
tagged with: packaging
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/38548271
answer count: 2
type: UnansweredQuestion
downvote count: 0
tagged with: maven

http://stackoverflow.com/comment/39364609
type: AnswerComment
comment on: http://stackoverflow.com/a/25263942
type: Comment
has text: @stealthjong I have to say, this is an answer. As it addresses the problem of not being able to see log messages in Logcat. And informs the OP that he is using the wrong api. An example would be nice though.
score: 0

http://stackoverflow.com/comment/39550189
score: 0
comment on: http://stackoverflow.com/q/25364468
has text: ankur-singhal, could you clarify your point? I use HibernateTemplate from org.springframework.orm.hibernate4, it still there, as you could see in stack trace
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25279224
has body: I am trying to create at least two independent objects using the same class. Meaning that I want each of them to use the same class but use the variables in it independently. I am not sure if this is possible but that is why I am here. The two skeletons (skeleton1 and skeleton2) are the two objects that I want to be independent of each other. @Override public void render(GameContainer gc, StateBasedGame gm, Graphics g) throws SlickException { background.draw(0, 0, Constants.WIN_WIDTH, Constants.WIN_HEIGHT); g.drawImage(ccb, mkX, mkY); Skeleton skeleton1 = new Skeleton(g, gm); Skeleton skeleton2 = new Skeleton(g, gm); score = new DeathScreenButton(scoreCounter, (Constants.WIN_WIDTH / 2) / 2, 0, g, Color.transparent); } More specifically, I want their x and y axis to be independent shown here (they are sX and sY): public class Skeleton { private Graphics g; private StateBasedGame gm; private int mkX = InGame.getmkX(); private int mkY = InGame.getmkY(); // This makes them spawn on each other :( // "static" prevents them from popping around the screen private static int sX = (int)(Math.random() * Constants.WIN_WIDTH) + 1; private static int sY = (int)(Math.random() * Constants.WIN_HEIGHT) + 1; private Image skele; public Skeleton (Graphics g, StateBasedGame gm) { this.g = g; this.gm = gm; try { init(); } catch (SlickException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } render(); try { update(); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/25279463
answer count: 2
has comment: http://stackoverflow.com/comment/39392668
possible better answer: http://stackoverflow.com/a/25279463
accepted answer: http://stackoverflow.com/a/25279462
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25279462
tagged with: java
tagged with: slick2d
has comment: http://stackoverflow.com/comment/39395341
has title: How to create two of the same objects but in different states
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39392498
type: Question

http://stackoverflow.com/comment/39337744
type: AnswerComment
comment on: http://stackoverflow.com/a/25247978
has text: No, your Vector is NOT null. If it was, the exception would be thrown at line `for(int i=0; i<con.retrievePersonalVector().size(); i++)` when calling `size()`. If you cant ensure that your Vector does not contains null values, try to check nullity of the element before using it: `PersonalRecord pr = (PersonalRecord)con.retrievePersonalVector().get(i);` then `if(pr != null) model.addElement(pr.getLoginName());`
type: Comment
score: 0

http://stackoverflow.com/comment/39444370
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25306418
type: Comment
has text: Please post your code.

http://stackoverflow.com/q/25370643
has answer: http://stackoverflow.com/a/25370728
type: UnansweredQuestion
has body: When register other users in my local server I get the following errors: 08-18 14:53:28.510: W/System.err(1223): org.json.JSONException: No value for success 08-18 14:53:28.560: W/System.err(1223): at org.json.JSONObject.get(JSONObject.java:355) 08-18 14:53:28.590: W/System.err(1223): at org.json.JSONObject.getString(JSONObject.java:515) 08-18 14:53:28.590: W/System.err(1223): at com.example.skelotong.RegularUsercreation$ruc.doInBackground(RegularUsercreation.java:134) 08-18 14:53:28.600: W/System.err(1223): at com.example.skelotong.RegularUsercreation$ruc.doInBackground(RegularUsercreation.java:1) 08-18 14:53:28.600: W/System.err(1223): at android.os.AsyncTask$2.call(AsyncTask.java:288) 08-18 14:53:28.630: W/System.err(1223): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 08-18 14:53:28.630: W/System.err(1223): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 08-18 14:53:28.640: W/System.err(1223): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 08-18 14:53:28.640: W/System.err(1223): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 08-18 14:53:28.650: W/System.err(1223): at java.lang.Thread.run(Thread.java:841) I don't know what is wrong. Here is my code in java to register users: @SuppressLint("NewApi") private class ruc extends AsyncTask&lt;String, Integer, Boolean&gt; { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); final ProgressDialog pd = new ProgressDialog(RegularUsercreation.this); @SuppressLint("NewApi") @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pd.setMessage("Please wait"); pd.setProgressStyle(ProgressDialog.STYLE_SPINNER); pd.setCanceledOnTouchOutside(false); pd.setCancelable(false); pd.setIndeterminate(true); pd.show(); System.out.println("1"); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThrea…
upvote count: 1
tagged with: jsonexception
tagged with: php
downvote count: 1
score: 0
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has comment: http://stackoverflow.com/comment/39562137
has comment: http://stackoverflow.com/comment/39562234
favorite count: 0
has title: JSON Exception when attempting to connect to Local server
type: Question

http://stackoverflow.com/comment/39453778
has text: What is pc? What is supposed to be in the starts? What is test.java?
comment on: http://stackoverflow.com/q/25312021
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25308524
tagged with: unit-testing
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25309179
has comment: http://stackoverflow.com/comment/39447771
tagged with: java
accepted answer: http://stackoverflow.com/a/25353336
has comment: http://stackoverflow.com/comment/39448436
has comment: http://stackoverflow.com/comment/39447937
has title: How would I either mock java.net.URL or programatically set a spring bean to accept a constructor parameter?
type: Question
answer count: 2
tagged with: mocking
has body: Background I am working on an application suite in Java where I am making calls into different subsystems via HTTP post / get. In my drive to have everything unit tested I have run into a problem where I could not use Mockito to mock directly since the URL class is final. Where I am at Since the URL class cannot be mocked I decided to create a wrapper class and only expose the methods of the URL class that I was using. You can find that class below. This seemed to work well until I began to try to set my beans in the test context. UrlWrapper import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; public class UrlWrapper { URL url; public UrlWrapper(String spec) throws MalformedURLException{ url = new URL(spec); } public URLConnection openConnection() throws IOException{ return url.openConnection(); } } Unit Test Method @Test public final void testToMockConstructorInjectedBean() throws IOException { GenericApplicationContext mockContext = new GenericApplicationContext(); // Create our mock controller UrlWrapper mockUrl = mock(UrlWrapper.class); // Set the mock object in the context mockContext.refresh(); mockContext.getBeanFactory().registerSingleton("url", mockUrl); UrlWrapper mock = null; mock = (UrlWrapper)mockContext.getBean("url"); // &lt;-- Works mock = (UrlWrapper)mockContext.getBean("url", "http://google.com/"); // &lt;-- Fails. } The question What I would really love is to figure how how to get the line that "fails" in the unit test to work properly. This would impact the rest of the code the least and would be ideal. Another option I could take, but to me feels like a code smell, is to modify my wrapper to have a set method that accepts a String and creates a new URL object internally. What is the 'normal' proper way to unit test code that either uses URL? Also, how would you mock a context for unit testing that accepts a constructor parameter during injection? Edit 1 Context Provider import org…
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25309179
downvote count: 0
has comment: http://stackoverflow.com/comment/39447518
tagged with: spring
has comment: http://stackoverflow.com/comment/39447632
has answer: http://stackoverflow.com/a/25353336

akka-persistence
tags question: http://stackoverflow.com/q/25235194
type: Tag
tags question: http://stackoverflow.com/q/25250104
tag name: akka-persistence

http://stackoverflow.com/comment/42064599
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25353718
type: Comment
has text: There's an open Github issue on this, but I found this post first and it worked for me. https://github.com/spring-projects/spring-loaded/issues/67

http://stackoverflow.com/comment/39588313
score: 0
type: AnswerComment
has text: My apologies, I stupidly left out that start line of code when pasting. I was confused when reading your answer as the thread was running before! The doInBackground() method is definitely completing to the best of my knowledge. My apologies for the stupid mistake, please do not let it deter you.
comment on: http://stackoverflow.com/a/25381281
type: Comment

hive
tags question: http://stackoverflow.com/q/25263028
tags question: http://stackoverflow.com/q/25281697
type: Tag
tag name: hive

http://stackoverflow.com/comment/39429333
type: Comment
has text: Here is your answer http://stackoverflow.com/a/19309163/1031312. In future please do a little search before making a duplicate question.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25298582

http://stackoverflow.com/q/25334109
type: Question
tagged with: java
tagged with: hibernate
score: 0
type: UnansweredQuestion
has body: In Hibernate documentation, under section 5.1.4.2. Property mapping with hbm.xml, it is mentioned that : unique (optional): enables the DDL generation of a unique constraint for the columns. Also, allow this to be the target of a property-ref. What is the purpose of porperty-ref attribute in Hibernate and when we need to use this? please explain.
answer count: 1
has title: What is the use of property-ref in Hibernate
has answer: http://stackoverflow.com/a/25334376

http://stackoverflow.com/q/25275850
tagged with: jar
has answer: http://stackoverflow.com/a/25275942
has title: java - accessing .jar API functions - error: Cannot make a static reference to the non-static method
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25275949
possible better answer: http://stackoverflow.com/a/25275949
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25275942
linked to: http://stackoverflow.com/q/2042813
type: Question
duplicate of: http://stackoverflow.com/q/2042813
answer count: 2
tagged with: api
has body: I'm developing a PhoneGap application using Javascript to communicate with Java. I'm trying to access a class called RcpApi2 within a JAR file called A100_AL1001-23_AndroidLibrary.jar, but when I try to access the functions within I get this error: Cannot make a static reference to the non-static method startReadTagsWithRssi(int, int, int) from the type RcpApi2 The errors occur when I try to access these methods: RcpApi2.open(); RcpApi2.isopen; RcpApi2.startReadTagsWithRssi(...); Does anyone know why this is happening/how to fix this? Project Directories: Java Code: import com.phychips.rcp.*; public class HelloPlugin extends Plugin implements iRcpEvent2 { public static final String KEY_ENCODING = "my_encoding"; public static final String KEY_SAVELOG = "my_saveLog"; public static final String NATIVE_ACTION_STRING="nativeAction"; public static final String SUCCESS_PARAMETER="success"; ... public PluginResult execute(String action, JSONArray dataArray, String callbackId) { if (NATIVE_ACTION_STRING.equals(action)) { String resultType = null; try { resultType = dataArray.getString(0); } catch (Exception ex) { Log.d("HelloPlugin", ex.toString()); } if (resultType.equals(SUCCESS_PARAMETER)) { RcpApi2.getInstance().setOnRcpEventListener(this); try { RcpApi2.open(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (RcpApi2.isOpen) { try { boolean k = RcpApi2.startReadTagsWithRssi(maxTags, maxTime, repeatCycle); return new PluginResult(PluginResult.Status.OK, "Yay, Success!!!"); } catch (RcpException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Jar File Code: public class RcpApi2 extends BroadcastReceiver { private boolean isOpen = false; public boolean open() throws Exception { init(mIoType); readerIo.open(); isOpen = true; } public boolean isOpen() { return this.isOpen; } public boolean startReadTagsWithRssi(int maxTags, int maxTime, int repeatCycle) { RcpPacket rcpPacket = RcpPacket.getInstance(); if (!this.mIRcp.star…

http://stackoverflow.com/a/25259779
score: 5
upvote count: 5
type: Answer
downvote count: 0
has body: You are trying to serialize LinearLayouts? That's very bad practice. You should serialize the data you need in those LinearLayouts and recreate the LinearLayout when the data is deserialized.
answers question: http://stackoverflow.com/q/25252240

http://stackoverflow.com/q/25252609
tagged with: java
has answer: http://stackoverflow.com/a/25255938
has answer: http://stackoverflow.com/a/25255823
accepted answer: http://stackoverflow.com/a/25255938
favorite count: 0
type: Question
tagged with: jpa
has title: @ManyToMany collections in JPA - foreign key constraint fails - (simulate likes and dislikes buttons)
has body: I'm trying to render like/dislike buttons using JPA and JSF @Entity public class APost implements Serializable { ... @ManyToMany(fetch = FetchType.EAGER) protected Collection&lt;User&gt; likes; @ManyToMany(fetch = FetchType.EAGER) protected Collection&lt;User&gt; dislikes; @Transient public Integer getLikesNumber() { if (likes == null) { return 0; } return likes.size(); } public Collection&lt;User&gt; getLikes() { return likes; } public void setLikes(Collection&lt;User&gt; likes) { this.likes = likes; } public void addLikes(User user) { if (likes == null) { likes = new HashSet&lt;&gt;(); } likes.add(user); } public void removeLikes(User user) { if (likes != null) { likes.remove(user); } } @Transient public Integer getDislikesNumber() { if (dislikes == null) { return 0; } return dislikes.size(); } public Collection&lt;User&gt; getDislikes() { return dislikes; } public void setDislikes(Collection&lt;User&gt; dislikes) { this.dislikes = dislikes; } public void addDislikes(User user) { if (dislikes == null) { dislikes = new HashSet&lt;&gt;(); } dislikes.add(user); } public void removeDislikes(User user) { if (dislikes != null) { dislikes.remove(user); } } } The User Class : @Entity public class User implements Serializable { ... @Id private String email; @ManyToMany(fetch = FetchType.EAGER, mappedBy = "likes") protected Collection&lt;APost&gt; likes; @ManyToMany(fetch = FetchType.EAGER, mappedBy = "dislikes") protected Collection&lt;APost&gt; dislikes; public Collection&lt;APost&gt; getLikes() { return likes; } public void addLikes(APost post) { if (likes == null) { likes = new HashSet&lt;&gt;(); } likes.add(post); } public void removeLikes(APost post) { if (likes != null) { likes.remove(post); } } public Collection&lt;APost&gt; getDislikes() { return dislikes; } public void addDislikes(APost post) { if (dislikes == null) { dislikes = new HashSet&lt;&gt;(); } dislikes.add(post); } public void removeDislikes(APost post) { if (dislikes != null) { dislikes.remove(post); } …
type: AnsweredQuestion
answer count: 2
tagged with: jsf
downvote count: 0
score: 1
upvote count: 1
possible better answer: http://stackoverflow.com/a/25255823

http://stackoverflow.com/q/25342084
has comment: http://stackoverflow.com/comment/39510127
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25342821
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25342102
has title: whats the return type of .getClass() method...is it class name or object of class?
has comment: http://stackoverflow.com/comment/39511350
answer count: 2
downvote count: 0
has body: whats the return type of .getClass() method...is it class name or object of class?? and whats the return type of .forName().. and whats the difference between .forName("Myclasss") return type and Myclass have browsed about it and got really confused Thanks in Advance
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39510686

http://stackoverflow.com/a/25368848
has body: By calling rdr.read() you read one byte. If you want to read one character of text instead of it's numeric representation, you could cast it to a character like this: int numericChar; InputStreamReader rdr = new InputStreamReader(new FileInputStream("/Users/rr/Documents/workspace/EBCDIC_TO_ASCII/ebcdic.txt"), java.nio.charset.Charset.forName("ibm500")); while((numericChar = rdr.read()) != -1) { System.out.println((char) numericChar); } If you'd write each numericChar to a file as one byte, the both files would look the same. But you are writing to the console and not to a file so it represents the content as numbers instead of interpreting them as character. If you want to output the content line by line you could do it like this: int numericChar; InputStreamReader rdr = new InputStreamReader(new FileInputStream("/Users/rr/Documents/workspace/EBCDIC_TO_ASCII/ebcdic.txt"), java.nio.charset.Charset.forName("ibm500")); while((numericChar = rdr.read()) != -1) { System.out.print((char) numericChar); } This will not start a new line after each character. The difference between System.out.println() and System.out.print() is that println will start a new line after printing the value by appending the newline character \n.
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39558460
has comment: http://stackoverflow.com/comment/39558903
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25368740
answers question: http://stackoverflow.com/q/25368740

http://stackoverflow.com/comment/39369658
type: QuestionComment
has text: @yogeshprajapati: Yeah I need a little technical help, I can show you my code and explain you the logic involved. Please drop your email id, my email id is: mayank.placid@gmail.com
comment on: http://stackoverflow.com/q/25238306
score: 0
type: Comment

http://stackoverflow.com/a/25340418
has body: Change this.width = image.getWidth(); this.width = image.getHeight(); To this.width = image.getWidth(); this.height = image.getHeight(); // set height properly Change for (int i = 0; i &lt; 8; i++) { To for (int i = 0; i &lt; pixels.length; i++) {
type: Answer
has comment: http://stackoverflow.com/comment/39507441
accepted answer of: http://stackoverflow.com/q/25340391
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25340391
upvote count: 1
has comment: http://stackoverflow.com/comment/39507432

http://stackoverflow.com/a/25381479
score: 0
answers question: http://stackoverflow.com/q/25381307
has comment: http://stackoverflow.com/comment/39582481
has comment: http://stackoverflow.com/comment/39583095
has body: You have to specify in your xml where the hibernate config can be found spring config: file:src/hibernate.cfg.xml // your hibernate.cfg.xml location You could take this approach in java : public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { sessionFactory = new AnnotationConfiguration() .configure().buildSessionFactory(); } catch (Throwable ex) { // Log exception! throw new ExceptionInInitializerError(ex); } } public static Session getSession() throws HibernateException { return sessionFactory.openSession(); } } since with the latter approach you have the sessionfactory you can then configure it like so: SessionFactory sessionFactory = new Configuration() .configure("/persistence/hibernate.cfg.xml") .buildSessionFactory();
type: Answer

http://stackoverflow.com/comment/39480547
comment on: http://stackoverflow.com/a/25323548
type: Comment
has text: @RLH I posted a follow-up question at http://stackoverflow.com/questions/25326377/jit-not-optimizing-loop-that-involves-integer-max-value
score: 5
type: AnswerComment

http://stackoverflow.com/a/25327986
answers question: http://stackoverflow.com/q/25327807
type: Answer
has body: You can use Wireshark. It's pretty easy. If you don't know how to use it just type "wireshark soap" in Google.
score: 0

http://stackoverflow.com/comment/39560470
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25369281
has text: Please remember to format code (and *code only*) properly as code by using either 4 spaces in the beginning (question/answer/full line) or between the `` (part of a line) symbols. It provides more readability and makes a post look better ;) (As for this answer, I just editted for that, just remember in the future)

http://stackoverflow.com/q/25280495
has answer: http://stackoverflow.com/a/25280629
tagged with: swing
accepted answer: http://stackoverflow.com/a/25280629
tagged with: sorting
score: 4
upvote count: 4
type: AnsweredQuestion
tagged with: jtable
tagged with: java
answer count: 1
has body: I have made table with freezed first column, I mean - first column is not scrollable, works the same as in MS Excel. Problem is, I don't know how to use row sorter, to sort both tables in the same time. Now sorting works for every column except first, frozen one. Can someone give me some clue or solution? Many thanks in advance My code is based on this example: import java.awt.Dimension; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JViewport; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; public class TestClass extends javax.swing.JFrame { private DefaultTableModel tableModel; private javax.swing.JScrollPane jScrollPane; private javax.swing.JTable jTable; private javax.swing.JTable freezeTable; private int fixedColumns = 1;//number of colums to be freezed public TestClass() { jScrollPane = new javax.swing.JScrollPane(); jTable = new javax.swing.JTable(); jScrollPane.setViewportView(jTable); getContentPane().add(jScrollPane); setPreferredSize(new Dimension(300,200)); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); Object[][] data = {{"Item1", "Papaya", "Letus", "Cashew", "Pine"}, {"Item2", "Orange", "Carrot", "Pine nut", "Oak"}, {"Item3", "Apple", "Pepper", "Pistacho", "Cypress"}}; Object[] headers = {"Item", "Fruit", "Vegetable", "Nuts", "Tree"}; tableModel = new DefaultTableModel(data, headers); jTable.setModel(tableModel); jTable.setAutoCreateColumnsFromModel( false ); for (int i=0; i&lt;jTable.getColumnCount(); i++){ jTable.getColumnModel().getColumn(i).setMinWidth(100); } jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTable.setRowSorter(new TableRowSorter&lt;DefaultTableModel&gt;(tableModel)); jTable.addPropertyChangeListener(new PropertyChangeListener() { public void pro…
downvote count: 0
favorite count: 0
type: Question
has title: Sorting JTable with freezed first column, based on other table

http://stackoverflow.com/q/25332855
has comment: http://stackoverflow.com/comment/39493792
has comment: http://stackoverflow.com/comment/39494557
has comment: http://stackoverflow.com/comment/39493669
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39493630
has comment: http://stackoverflow.com/comment/39511898
has comment: http://stackoverflow.com/comment/39494275
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25332897
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/25332897
tagged with: sqlite
has body: I'm trying to read and execute an SQL script from a file. CREATE commands work but my first INSERT command results in a Logcat error with tag "SQLiteLog" and text "(1) near "INSERT": syntax error". The error is thrown on the database.execSQL() line. String[] createScript = outputStream.toString().split(";"); for (int i = 0; i &lt; createScript.length; i++) { String sqlStatement = createScript[i].trim(); // TODO You may want to parse out comments here if (sqlStatement.length() &gt; 0) { database.execSQL(sqlStatement + ";"); } } The SQL line is as follows INSERT INTO [EntityAttributeSet] ([Id],[Code]) VALUES (1,NULL); The CREATE statement is as follows CREATE TABLE [EntityAttributeSet] ([Id] int IDENTITY (636,1) NOT NULL, [Code]nvarchar(50) NULL); Hex dump of a few INSERT statements: 0000-0c00: 20 4e 4f 54-20 4e 55 4c-4c 0d 0a 29-3b 0d 0a 49 .NOT.NUL L..);..I 0000-0c10: 4e 53 45 52-54 20 49 4e-54 4f 20 5b-45 6e 74 69 NSERT.IN TO.[Enti 0000-0c20: 74 79 41 74-74 72 69 62-75 74 65 53-65 74 5d 20 tyAttrib uteSet]. 0000-0c30: 28 5b 49 64-5d 2c 5b 43-6f 64 65 5d-29 20 56 41 ([Id],[C ode]).VA 0000-0c40: 4c 55 45 53-20 28 31 2c-4e 55 4c 4c-29 3b 0d 0a LUES.(1, NULL);.. 0000-0c50: 0d 0a 49 4e-53 45 52 54-20 49 4e 54-4f 20 5b 45 ..INSERT .INTO.[E 0000-0c60: 6e 74 69 74-79 41 74 74-72 69 62 75-74 65 53 65 ntityAtt ributeSe 0000-0c70: 74 5d 20 28-5b 49 64 5d-2c 5b 43 6f-64 65 5d 29 t].([Id] ,[Code]) 0000-0c80: 20 56 41 4c-55 45 53 20-28 32 2c 4e-55 4c 4c 29 .VALUES. (2,NULL) 0000-0c90: 3b 0d 0a 0d-0a 49 4e 53-45 52 54 20-49 4e 54 4f ;....INS ERT.INTO
accepted answer: http://stackoverflow.com/a/25354278
has answer: http://stackoverflow.com/a/25354278
has comment: http://stackoverflow.com/comment/39493980
has title: SQLiteLog Error (1) near "INSERT": syntax error
type: Question
has comment: http://stackoverflow.com/comment/39494421

http://stackoverflow.com/comment/39301212
type: AnswerComment
has text: It crashes? So, show me the error. BTW, your default block should be empty. What are you trying to achieve inside this block ?
comment on: http://stackoverflow.com/a/25230322
score: 0
type: Comment

http://stackoverflow.com/q/25296475
has body: I'm developing a small Java web app on Glassfish 4. Since I need to use it for some time, I need it online so I went for OpenShift. I have set up rhc and I have cloned my git repo successfully, but it still shows default page. http://professionalorientation-puskice.rhcloud.com/ This is jBoss 7, so, should I maybe use Tomcat instead? I don't see Glassfish 4 offered. Thanks for any heads up
tagged with: java
answer count: 1
tagged with: git
type: Question
accepted answer: http://stackoverflow.com/a/25313917
has title: OpenShift app showing default page
tagged with: openshift
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25313917

http://stackoverflow.com/q/25332362
has comment: http://stackoverflow.com/comment/39492594
has comment: http://stackoverflow.com/comment/39492473
has title: Cannot match my regular expression
type: Question
answer count: 5
has answer: http://stackoverflow.com/a/25332411
has comment: http://stackoverflow.com/comment/39493085
has answer: http://stackoverflow.com/a/25332387
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25332417
has comment: http://stackoverflow.com/comment/39492487
has answer: http://stackoverflow.com/a/25332386
accepted answer: http://stackoverflow.com/a/25332386
tagged with: java
possible better answer: http://stackoverflow.com/a/25332387
has answer: http://stackoverflow.com/a/25332396
has body: I am trying to match a string that looks like "WIFLYMODULE-xxxx" where the x can be any digit. For example, I want to be able to find the following... WIFLYMODULE-3253 WIFLYMODULE-1585 WIFLYMODULE-1632 I am currently using final Pattern q = Pattern.compile("[WIFLYMODULE]-[0-9]{3}"); but I am not picking up the string that I want. So my question is, why is my regular expression not working? Am i going about it in the wrong way?
tagged with: regex

http://stackoverflow.com/a/25355553
type: AcceptedAnswer
upvote count: 7
has body: Problem is you have to put this line textArea.setEditable(false); in the method body, so either you can put in constructor or method: public void init(){ JLabel ltextBox = new JLabel("TextBox: "); textBox = new JTextField(10); JPanel leftPanel = new JPanel(); leftPanel.add(ltextBox); leftPanel.add(textBox); JPanel rightPanel = new JPanel(); rightPanel.add(textArea); textArea.setEditable(false); //&lt;-- put it here }
downvote count: 0
answers question: http://stackoverflow.com/q/25355377
type: Answer
accepted answer of: http://stackoverflow.com/q/25355377
score: 7

http://stackoverflow.com/a/25297107
answers question: http://stackoverflow.com/q/25297022
has body: When you get an error, you need to read it carefully because often every word matters. For example, when you get an OOME, you will see some words as a message. This is important because there is many reasons you can get an OOME and two of the most common ones are; a lack of heap spaces (object instances) which is controlled by -Xmx a lack of perm gen (code) which is controlled by -XX:MaxPermSpace= Note: Java 8 doesn't have a "Perm Gen" it has a "Metaspace" which does the same thing, but works rather differently and I suspect they renamed it to avoid confusion. There are other reasons for this error such as using too much direct memory, or being unable to create a new thread but these are relatively rare. If you take away one point for this answer is to read the entire message, not just the error itself, and if you don't know what it means, often Google does ;) I say this because often a question is posted on StackOverflow regarding an "error occurred" and the first comment is "what error occurred" because as soon at it is posted the problem is obvious (to someone who knows what it means) what the problem is most of the time. So when you read an error message you need to assume its trying to tell you something, but you don't know what it means and yes I see new error messages which I don't know what they mean quite often
type: Answer
has comment: http://stackoverflow.com/comment/39426697
has comment: http://stackoverflow.com/comment/39426806
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25297022
has comment: http://stackoverflow.com/comment/39426741
score: 3

http://stackoverflow.com/comment/39597092
type: Comment
has text: I need a listener which invokes at the presence of such element. Put a method to catch error message after every action is not practical
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25355364

http://stackoverflow.com/comment/70708174
type: AnswerComment
comment on: http://stackoverflow.com/a/25232720
has text: @ScottC. is correct .both application.yml and application-{profile}.properties are getting merged.
score: 0
type: Comment

http://stackoverflow.com/q/25381791
type: AnsweredQuestion
has title: Not deserialize value if it is not in Json
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
accepted answer: http://stackoverflow.com/a/25381917
type: Question
has answer: http://stackoverflow.com/a/25381917
has body: i define this class public class PostServerActionsRequest { private ChangePassword changePassword; private Reboot reboot; private Rebuild rebuild; private Resize resize; private String confirmResize; private String revertResize; private CreateImage createImage; //constructor + getter &amp; setter } that i used to parse multiple json requests using jackson json processor. The situation is the following: i receive a json with this structure: //Json A { "reboot": { "type": "SOFT" } } where i define class Reboot with a private String attribute whose name is type. Obviously the attributes that haven't the relative equivalent in json are set to null by jackson during deserialization. So serializing i obtain this json: //Json B { "changePassword": null, "reboot": { "type": "SOFT" }, "rebuild": null, "resize": null, "confirmResize": null, "revertResize": null, "createImage": null } Now i know how tell jackson to ignore null or empty values during serialization, for example with the annotation @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) above the class PostServerActionsRequest, but my question is, it's possible to tell jackson to don't set to null values that are not in json request (json A) during deserialization? This because i want to obtain a class has only the values present in the json request. I hope i was clear to explain my issue and thanks you in advance for your help.
tagged with: jersey
tagged with: deserialization
tagged with: jackson

google-app-engine
tags question: http://stackoverflow.com/q/25374524
tag name: google-app-engine
tags question: http://stackoverflow.com/q/25250458
tags question: http://stackoverflow.com/q/25386069
tags question: http://stackoverflow.com/q/25294237
tags question: http://stackoverflow.com/q/25244539
tags question: http://stackoverflow.com/q/25254514
type: Tag
tags question: http://stackoverflow.com/q/25271894
tags question: http://stackoverflow.com/q/25339465
tags question: http://stackoverflow.com/q/25355179
tags question: http://stackoverflow.com/q/25242089
tags question: http://stackoverflow.com/q/25385951
tags question: http://stackoverflow.com/q/25298409
tags question: http://stackoverflow.com/q/25299396
tags question: http://stackoverflow.com/q/25323987
tags question: http://stackoverflow.com/q/25255667
tags question: http://stackoverflow.com/q/25276970
tags question: http://stackoverflow.com/q/25290515
tags question: http://stackoverflow.com/q/25264296
tags question: http://stackoverflow.com/q/25246078
tags question: http://stackoverflow.com/q/25238132
tags question: http://stackoverflow.com/q/25360188
tags question: http://stackoverflow.com/q/25319414
tags question: http://stackoverflow.com/q/25377894
tags question: http://stackoverflow.com/q/25339148
tags question: http://stackoverflow.com/q/25388573
tags question: http://stackoverflow.com/q/25299288
tags question: http://stackoverflow.com/q/25259272
tags question: http://stackoverflow.com/q/25347100
tags question: http://stackoverflow.com/q/25344092
tags question: http://stackoverflow.com/q/25318989
tags question: http://stackoverflow.com/q/25359099
tags question: http://stackoverflow.com/q/25312425
tags question: http://stackoverflow.com/q/25368935
tags question: http://stackoverflow.com/q/25350732
tags question: http://stackoverflow.com/q/25309464
tags question: http://stackoverflow.com/q/25238691
tags question: http://stackoverflow.com/q/25345894
tags question: http://stackoverflow.com/q/25301520
tags question: http://stackoverflow.com/q/25378346
tags question: http://stackoverflow.com/q/25234213
tags question: http://stackoverflow.com/q/25263894
tags question: http://stackoverflow.com/q/25290904
tags question: http://stackoverflow.com/q/25341934
tags question: http://stackoverflow.com/q/25240911
tags question: http://stackoverflow.com/q/25257117

http://stackoverflow.com/q/25388611
tagged with: ejb-jar.xml
has comment: http://stackoverflow.com/comment/44025604
tagged with: java
tagged with: jboss7.x
type: Question
has title: ActivationConfigProperty userName will be ignored since it is not allowed by resource adapter: hornetq-ra
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30532597
answer count: 1
has body: This is my ejb-jar.xml: myMDB <activation-config-property> <activation-config-property-name>destinationType </activation-config-property-name> <activation-config-property-value>javax.jms.Queue </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>destination </activation-config-property-name> <activation-config-property-value>queue/test </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>connectionParameters </activation-config-property-name> <activation-config-property-value>host=localhost;port=5445 </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>username </activation-config-property-name> <activation-config-property-value>xxx </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>password </activation-config-property-name> <activation-config-property-value>yyy </activation-config-property-value> </activation-config-property> I don't understand why I get this warning : ActivationConfigProperty username will be ignored since it is not allowed by resource adapter: hornetq-ra I tried also userName and UserName but I always get the same warning. Should I configure any ra.xml file? Thank you for your help guys. Remark : I use JBoss AS 7.2

http://stackoverflow.com/comment/39484623
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25320105
score: 1
has text: @Nemin Would you please unmark this question as answered? As a JUnit user, I would really like to figure out the answer of using `null` in `DataPoints`. Until we get an answer for that, I think this issue is still open.

http://stackoverflow.com/q/25262996
has comment: http://stackoverflow.com/comment/39363601
has comment: http://stackoverflow.com/comment/39365001
type: AnsweredQuestion
tagged with: java-native-interface
tagged with: java
tagged with: eclipse
type: Question
has body: Hi everybody: I'm making practice with JNI on my Windows 7. My goal is to print at the Eclipse console a "Hello world" message using C's API. I keep getting Exception in thread "main" java.lang.UnsatisfiedLinkError: nativeStuff.HelloJNI.sayHello()V at nativeStuff.HelloJNI.sayHello(Native Method) at main.Init.main(Init.java:17) On my project's Properties -> Libraries -> jre8 -> Native Library Location -> Edit -> Workspace I set nativeStuff as selected folder, since the library hello.dll is in there, but I keep getting the same error about UnsatisfiedLinkError. Here's the source tree: src(folder): main(package): Init.java nativeStuff(package): HelloJNI.java hello.dll HelloJNI.c nativeStuff_HelloJNI.h Init.java: public class Init { public static void main(String[] args) { System.out.println("Begin"); new HelloJNI().sayHello(); // from the exception above } } HelloJNI.java: public class HelloJNI { static { try { System.loadLibrary("hello"); } catch(UnsatisfiedLinkError u) { // always from the exception above u.printStackTrace(); } catch(SecurityException s) { s.printStackTrace(); } } public native void sayHello(); } nativeStuff_HelloJNI.h: /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class nativeStuff_HelloJNI */ #ifndef _Included_nativeStuff_HelloJNI #define _Included_nativeStuff_HelloJNI #ifdef __cplusplus extern "C" { #endif /* * Class: nativeStuff_HelloJNI * Method: sayHello * Signature: ()V */ JNIEXPORT void JNICALL Java_nativeStuff_HelloJNI_sayHello (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif and HelloJNI.c: #include "jni.h" #include &lt;stdio.h&gt; #include "nativeStuff_HelloJNI.h" // Implementation of native method sayHello() of HelloJNI class JNIEXPORT void JNICALL Java_HelloJNI_sayHello(JNIEnv *env, jobject thisObj) { printf("Hello World!\n"); return; } [Edit]: these are the commands I typed to get the files... javac HelloJNI.java javah -jni nativeStuff.HelloJNI gcc -Wl,--add-stdcall-alias -I"%JAVA_HOME…
accepted answer: http://stackoverflow.com/a/25263570
score: 0
has answer: http://stackoverflow.com/a/25263570
has comment: http://stackoverflow.com/comment/39364823
has title: ECLIPSE - java.lang.UnsatisfiedLinkError while working with JNI
answer count: 1
has comment: http://stackoverflow.com/comment/39364432

http://stackoverflow.com/a/25275661
type: Answer
has comment: http://stackoverflow.com/comment/39386665
has body: By "output directory", I assume you mean the "target" directory with all of your built artifacts and generated code. ${buildDirectory}
has comment: http://stackoverflow.com/comment/39386577
has comment: http://stackoverflow.com/comment/39386633
answers question: http://stackoverflow.com/q/25275625
score: 0
has comment: http://stackoverflow.com/comment/39386616
has comment: http://stackoverflow.com/comment/39386648

join
type: Tag
tag name: join
tags question: http://stackoverflow.com/q/25241953
tags question: http://stackoverflow.com/q/25270668

http://stackoverflow.com/a/28140093
upvote count: 4
answers question: http://stackoverflow.com/q/25318989
type: Answer
score: 4
has body: This is what worked for me To upload, use curl -F file=@"picture.jpg" http://myAppEngineProj.appspot.com/myServlet And the servlet looks like import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.nio.channels.Channels; import java.util.Enumeration; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItemIterator; import org.apache.commons.fileupload.FileItemStream; import org.apache.commons.fileupload.servlet.ServletFileUpload; import com.google.appengine.tools.cloudstorage.GcsFileOptions; import com.google.appengine.tools.cloudstorage.GcsFilename; import com.google.appengine.tools.cloudstorage.GcsOutputChannel; import com.google.appengine.tools.cloudstorage.GcsService; import com.google.appengine.tools.cloudstorage.GcsServiceFactory; import com.google.appengine.tools.cloudstorage.RetryParams; public class UploadServlet extends HttpServlet { private static final Logger log = Logger.getLogger(UploadServlet.class.getName()); private final GcsService gcsService = GcsServiceFactory.createGcsService(new RetryParams.Builder() .initialRetryDelayMillis(10) .retryMaxAttempts(10) .totalRetryPeriodMillis(15000) .build()); private String bucketName = "myBucketNameOnGoogleCloudStorage"; /**Used below to determine the size of chucks to read in. Should be &gt; 1kb and &lt; 10MB */ private static final int BUFFER_SIZE = 2 * 1024 * 1024; @SuppressWarnings("unchecked") @Override public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String sctype = null, sfieldname, sname = null; ServletFileUpload upload; FileItemIterator iterator; FileItemStream item; InputStream stream = null; try { upload = new ServletFileUpload(); res.setContentType("text/plain"); iterator = upload.getI…
downvote count: 0

http://stackoverflow.com/comment/39512416
type: Comment
has text: Yes - I am using the Netbeans IDE to create the application
type: AnswerComment
comment on: http://stackoverflow.com/a/25343477
score: 0

http://stackoverflow.com/q/25341439
tagged with: java
has answer: http://stackoverflow.com/a/25341799
answer count: 1
has comment: http://stackoverflow.com/comment/39509488
has body: some may think I'm making a double post because I already asked a question on this subject here : JButton alpha background change with mouseover But I have some problems, not concerning button with alpha background using transparency color but with button using transparent icons (.png). I already tried lot's of things but I still have artefacts and I really don't understand why. Here is my code : public class PanelPosition extends JPanel { private JButton leftArrow, rightArrow; public PanelPosition (int width, int height) { this.setPreferredSize(new Dimension(width,height)); this.setBackground(new Color(0,0,0,0)); JLabel position = new JLabel("support", JLabel.CENTER); position.setForeground(Color.white); leftArrow = new JButton(new AlphaImageIcon(new ImageIcon("pictures\\left arrow.png"),1)); rightArrow = new JButton(new AlphaImageIcon(new ImageIcon("pictures\\right arrow.png"),1)); leftArrow.setBackground(new Color (0,0,0,0)); rightArrow.setBackground(new Color (0,0,0,0)); leftArrow.setPreferredSize(new Dimension(leftArrow.getIcon().getIconWidth(), leftArrow.getIcon().getIconHeight())); rightArrow.setPreferredSize(new Dimension(rightArrow.getIcon().getIconWidth(), rightArrow.getIcon().getIconHeight())); leftArrow.setOpaque(false); leftArrow.setFocusPainted(false); leftArrow.setBorderPainted(false); leftArrow.setContentAreaFilled(false); leftArrow.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { leftArrow.setIcon(new AlphaImageIcon(new ImageIcon("pictures\\left arrow.png"), (float)0.7)); } @Override public void mouseExited(MouseEvent evt) { leftArrow.setIcon(new AlphaImageIcon(new ImageIcon("pictures\\left arrow.png"), (float)0.3)); } }); rightArrow.setOpaque(false); rightArrow.setFocusPainted(false); rightArrow.setBorderPainted(false); rightArrow.setContentAreaFilled(false); rightArrow.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { rightArrow.setIcon(new AlphaImageIcon(new ImageI…
type: Question
has title: JButton icon transparent artefacts
tagged with: jbutton
tagged with: alpha
linked to: http://stackoverflow.com/q/25162510
tagged with: icons
tagged with: http://stackoverflow.com/tag/png
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25292728
tagged with: mirth
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25292762
has comment: http://stackoverflow.com/comment/39417713
has answer: http://stackoverflow.com/a/25292762
type: Question
has comment: http://stackoverflow.com/comment/39417823
has body: Is it possible to pass objects created in Javascript to java? for example I have a POJO called myPojo with propertys name and address The object is created in Javascript: var myPojo = new Packages.CreatePOJO(); myPojo.setName("Alpha"); Then I pass it to a java function var replacer = new Packages.VelocityReplace(); replacer.replace("a template", myPojo); The replacer class is this. public class VelocityReplace { public static String replace(String templateStr, Object in) throws Exception { ... } The exception generated is: Wrapped java.lang.ClassCastException: org.mozilla.javascript.NativeObject cannot be cast to CreatePOJO I am using Mirth Connect which is a real time interfacing engine that is providing &amp; pushing the data to the myPojo object. It uses javascript for scripting, this is why I need to push the data from javascript to java.
score: 0
has title: pass java object from javascript to java
answer count: 1
tagged with: javascript

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

http://stackoverflow.com/comment/39533212
type: AnswerComment
type: Comment
has text: @EdwardBezzant: Ah. Consider suggesting to your instructors to move on up to the 1990's, because that is when AWT became out of date.
score: 0
comment on: http://stackoverflow.com/a/25355447

http://stackoverflow.com/q/25348631
has comment: http://stackoverflow.com/comment/39522329
has comment: http://stackoverflow.com/comment/39520939
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39520958
answer count: 1
has title: Screen tearing JPanel game and double buffering
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/32114865
tagged with: double-buffering
favorite count: 0
tagged with: buffer
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/3256269
tagged with: doublebuffered
type: Question
has body: I am currently using a JPanel to draw the elements from my game, however, there is occasional stuttering with the graphics, after some research I learnt about screen tearing and double buffering, which I believe is the solution to my problem, however, currently with my code I am finding it extremely difficult to implement without tearing out a lot of code. I am wondering if anyone could possibly provide either a simpler way to fix my screen tearing on a small 2D tile based game, or how to do double buffering with my current code, thank you very much! Frame.java public class Frame extends JPanel implements KeyListener { public static Game game; public static boolean[] mouseDown = new boolean[4]; public static int width, height; public static Font font = new Font("Arial", Font.BOLD, 16); public static JFrame frame; public Frame() { setFocusable(true); requestFocus(); setOpaque(true); addKeyListener((KeyListener) this); addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); addMouseMotionListener(new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { } @Override public void mouseDragged(MouseEvent e) { } }); } @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setBackground(Color.BLACK); g2d.setFont(font); super.setBackground(Color.BLACK); super.paintComponent(g2d); //This is where I use g2d to draw onto the JPanel } public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { frame = new JFrame("Game"); frame.add(new Frame()); frame.setSize(1000, 750); frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }}); } Game.java public void gameStart() { Thread gameThread = new Thread() { // Override run() to provide the running behavior of this thread. @Override public void run() { gameLo…

http://stackoverflow.com/comment/39487889
comment on: http://stackoverflow.com/a/25329322
type: AnswerComment
score: 0
type: Comment
has text: usermatch.java is the activity class that calls the fragment. In the sense that when the activity launches it direct itself to usermatch and where users swipe left and right between different fragments like the fragment I included here (fragment 1). I have included the usermatch activity code under the update section of my initial post. Thanks

http://stackoverflow.com/q/25374798
favorite count: 0
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/25377842
upvote count: 4
has title: How to resolve MongoDB client error "Timeout waiting for a pooled item after 120000 MILLISECONDS"
score: 4
tagged with: connection-pooling
tagged with: mongodb-java
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
answer count: 1
downvote count: 0
has body: I have a Java class (not Java Spring or server) which inserts documents to one table, reads documents from other table, insert documents to another table and delete documents from another table. All above 4 operations happens with 3 tables. I get the following error. Exception in thread "pool-1-thread-240" com.mongodb.MongoTimeoutException: Timeout waiting for a pooled item after 120000 MILLISECONDS at com.mongodb.ConcurrentPool.get(ConcurrentPool.java:113) at com.mongodb.PooledConnectionProvider.get(PooledConnectionProvider.java:75) at com.mongodb.DefaultServer.getConnection(DefaultServer.java:73) at com.mongodb.BaseCluster$WrappedServer.getConnection(BaseCluster.java:221) at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:508) at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:456) at com.mongodb.DBTCPConnector.getPrimaryPort(DBTCPConnector.java:414) at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:176) at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:159) at com.mongodb.DBCollection.insert(DBCollection.java:93) at com.mongodb.DBCollection.insert(DBCollection.java:78) at com.mongodb.DBCollection.insert(DBCollection.java:120) at MyProgram$MyClass.run(MyProgram.java:149) 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:695) How can I fix it? I am using mongod 2.6.3 in Mac OS System. Should I increase the mongodb pool in my client side. If yes, how should I do it? What is the maximum number to which I can set it? I get this problem for the line in my java code where I do insert operation.

http://stackoverflow.com/comment/39303072
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25231154
has text: So wait. If I understand you correctly, you want to extract the *key* of the map given a specific *value*, right?

http://stackoverflow.com/q/25238703
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39332836
tagged with: excel
type: Question
has title: How to Avoid non printable characters in excel using Java?
has body: I am using attached code to convert .XLSX files into .CSV files. It is working fine except in one scenario. The code cannot handle non-printable excel characters. If it finds any such characters in excel it's creating one extra row in CSV file. I cannot tell what character it is because it's not visible in excel and it's disappearing when I apply the excel Clean() formula. How can I handle this in Java? Thanks Madhu. import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; class XlsxtoCSV { static void xlsx(File inputFile, File outputFile) { // For storing data into CSV files //System.out.println("Calling ::::::::::::::::::: method"); StringBuffer data = new StringBuffer(); try { FileOutputStream fos = new FileOutputStream(outputFile); // Get the workbook object for XLSX file XSSFWorkbook wBook = new XSSFWorkbook(new FileInputStream(inputFile)); // Get first sheet from the workbook XSSFSheet sheet = wBook.getSheetAt(0); Row row; Cell cell = null; Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: data.append(cell.getBooleanCellValue() + ","); break; case Cell.CELL_TYPE_NUMERIC: data.append(cell.getNumericCellValue() + ","); break; case Cell.CELL_TYPE_STRING: String st=cell.getStringCellValue(); if(st.contains("\"")) { st=st.replaceAll("\"", ""); } if(st.contains(",")) { st="\"" + st + "\""; } if(st.contains("\n")) { st=st.replaceAll("\n", " "); } data.append(st + ","); break; case Cell.CELL_TYPE_BLANK: data.append("" + ","); break; default: data.append(cell + ","); } } data.app…
tagged with: http://stackoverflow.com/tag/csv
score: 1
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/39428115
type: Comment
score: 0
type: QuestionComment
has text: On point: code has to be maintained in both Python and Java.
comment on: http://stackoverflow.com/q/25297907

http://stackoverflow.com/comment/39352801
type: QuestionComment
has text: Why have you commented out half the code in each case? Is it important or not? Where are you calling the `SignUpActivity` constructor? What does the stack trace look like? Your question is unclear at the moment.
comment on: http://stackoverflow.com/q/25257277
type: Comment
score: 0

http://stackoverflow.com/q/25232541
has answer: http://stackoverflow.com/a/25232591
has answer: http://stackoverflow.com/a/49211112
favorite count: 0
has answer: http://stackoverflow.com/a/29756741
has body: I am trying to run maven goal: validation and keep getting: [WARNING] The requested profile "pom.xml" could not be activated because it does not exist. In my org.eclipse.m2e.core.prefs: activeProfiles=pom.xml eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 What did I do wrong?
type: Question
score: 9
has comment: http://stackoverflow.com/comment/39305881
upvote count: 9
has answer: http://stackoverflow.com/a/58020128
type: UnansweredQuestion
downvote count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/61230306
tagged with: maven-profiles
tagged with: java
has title: WARNING The requested profile "pom.xml" could not be activated because it does not exist
answer count: 7
has answer: http://stackoverflow.com/a/48772340
has answer: http://stackoverflow.com/a/55452875
tagged with: eclipse

jackson-modules
type: Tag
tags question: http://stackoverflow.com/q/25272043
tags question: http://stackoverflow.com/q/25233131
tag name: jackson-modules

http://stackoverflow.com/q/25233313
has title: Hibernate Criteria Query select where clause
accepted answer: http://stackoverflow.com/a/25233668
has comment: http://stackoverflow.com/comment/39307553
has body: person: id | owner_email | firstname | lastname ----+-------------+-----------+---------- 44 | john@gmail.com | john | wood 45 | alex@gamil.com | alex | greenwood 49 | peter@gamil.com | peter | blacksmith 50 | john@gmail.com | lee | wu 51 | john@gmail.com | jane | li i am making a spring hibernate web application, i have a table like above. what i m trying to get is something like: select * from person where owner_email='john@gmail.com' so the method will return me list of person objects related to john@gmail.com here is my query code but doesnt work... @PersistenceContext EntityManager em; @Transactional public List&lt;Person&gt; listPerson() { CriteriaQuery&lt;Person&gt; c = em.getCriteriaBuilder().createQuery(Person.class); Root&lt;Person&gt; from = c.from(Person.class); c.multiselect(from.get("owner_email")); c.orderBy(em.getCriteriaBuilder().asc(from.get("firstname"))); return em.createQuery(c).getResultList(); } here is the error i get.... HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.example.model.Person] [select new com.example.model.Person(generatedAlias0.owner_email) from com.example.model.Person as generatedAlias0] please help me with code example thanks...
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39307555
score: 0
has answer: http://stackoverflow.com/a/25233668
has comment: http://stackoverflow.com/comment/39308216
tagged with: sql
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39307715
answer count: 1
tagged with: criteriaquery
type: Question
has comment: http://stackoverflow.com/comment/39307496

http://stackoverflow.com/comment/39467640
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25319385
score: 0
has text: well comrade im a newb so if you please tell me how else i could ... :3

http://stackoverflow.com/a/25241834
upvote count: 1
has body: Use class MyCircuitClass extends TorCircuit {...} sock.circuitClass = MyCircuitClass.class;
type: Answer
has comment: http://stackoverflow.com/comment/39323299
has comment: http://stackoverflow.com/comment/39323492
score: 1
answers question: http://stackoverflow.com/q/25241759
downvote count: 0

http://stackoverflow.com/a/25257297
downvote count: 0
score: 1
type: Answer
has body: After seeing your out put images ,here is what I understood and the reason for that problem When ever you scale an image ,must be scaled as per aspect ratio of that image. ex: lets say your image dimensions are 900 1200 (w h) to scale its width to 400 need to do like this newWidth = 400; newHeight = 1200 * (400/900) = 533.33 If you want image of a imageview should scale automatically then check scaleType properties of ImageView in xml layout(fitCenter,centerInside etc) Add this line in your getView holder.img.setScaleType(ScaleType.CENTER_INSIDE);
answers question: http://stackoverflow.com/q/25256399
upvote count: 1

http://stackoverflow.com/q/25332051
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25334523
answer count: 1
tagged with: formatting
type: Question
has body: I have a small issue with IntelliJ not making my code more readable through auto-formatting, but more confusing. Hence the following code excerpt: private static float _triangleCoords[] = { 0.0f, 0.62f, 0f, -0.5f, -0.31f, 0f, 0.5f, -0.31f, 0f }; If I run Java auto-formatting, IntelliJ formats it like this: private static float _triangleCoords[] = { 0.0f, 0.62f, 0f, -0.5f, -0.31f, 0f, 0.5f, -0.31f, 0f }; I don't want it to strip away the spaces since they align the floats nicely. I also don't want to write + signs in front of positive floats just to keep it that way. How can I turn this formatting off?
type: UnansweredQuestion
has title: Keep whitespaces when auto-formatting Java code in IntelliJ
has comment: http://stackoverflow.com/comment/39492148
tagged with: intellij-idea

http://stackoverflow.com/q/25278772
tagged with: java
has answer: http://stackoverflow.com/a/25278810
has body: I am making a code importing CSV files into String 2D array. Since I intend to apply this code for other CSV files also, which have different number of columns and rows, I should use dynamic array. But I don't know handle both importing &amp; saving in dynamic 2D array at once. Could you help me find what is wrong with my codes? It doesn't work. Code: import java.io.*; import java.util.*; public class DataImport_1 { private ArrayList&lt;ArrayList&lt;String&gt;&gt; arr = null; public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("C:/Dropbox (CMA)/1 Research (5)/TA/new Data/SPX Index.csv")); scanner.useDelimiter(","); arr = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); child1 = new ArrayList&lt;String&gt;(); while(scanner.hasNext()){ child1.add(scanner.next()); } arr.add(child1); child1.clear(); scanner.close(); } }
tagged with: import
answer count: 2
tagged with: dynamic
tagged with: arrays
has title: How to save dynamic 2D array imported from csv?
type: Question
possible better answer: http://stackoverflow.com/a/25278818
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25278810
has answer: http://stackoverflow.com/a/25278818
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/comment/39590227
type: QuestionComment
has text: http://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25384324

http://stackoverflow.com/q/25310759
tagged with: moxy
score: 8
has comment: http://stackoverflow.com/comment/47951009
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/29970021
has comment: http://stackoverflow.com/comment/47965807
has comment: http://stackoverflow.com/comment/39669787
upvote count: 8
tagged with: jersey
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47950890
has body: I'm trying to take JSON objects and put them into a collection (I picked List). I've been able to unmarshal the JSON responses into single POJOs by creating BuiltCharacter with the appropriate getters and setters. For an array of JSON elements, I tried the following approaches: List&lt;BuiltCharacter&gt; characters = response.readEntity(new GenericType&lt;List&lt;BuiltCharacter&gt;&gt;(){}); and List&lt;BuiltCharacter&gt; characters = client.target(uri).request(MediaType.APPLICATION_JSON).get(new GenericType&lt;List&lt;BuiltCharacter&gt;&gt;(){}); Using those approaches got me the following: Exception in thread "main" java.lang.ClassCastException: BuiltCharacter cannot be cast to java.util.List I originally used Character as the class name but was reminded that that is a reserved class name. Still, I can't figure out what's going on here!
has title: Deserializing JSON with Jersey and MOXy into a List collection
has comment: http://stackoverflow.com/comment/47966065
tagged with: java
has comment: http://stackoverflow.com/comment/39626589
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/94984303
comment on: http://stackoverflow.com/a/25384924
has text: how did you generate the `signature.cer` ?
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/25341787
linked to: http://stackoverflow.com/q/4802887
answer count: 1
has comment: http://stackoverflow.com/comment/39550677
score: 2
has comment: http://stackoverflow.com/comment/39512267
has body: I have an Parent object that contains a list of Child objects. When I fetch a list of these Parents (to display in a grid) I do NOT want all the Child objects - that just wastes time and memory. However, when I fetch a single Parent (to display all details of the parent on a different page) I DO want a list of its Children. class Parent { String name; List&lt;Child&gt; children; } class Child { String name; Date birthDate; } So I set up lazy-fetch on Children so that by default the Children are not returned (when getting a list), but I can set FetchMode to JOIN to return the full object (Parent + Children) for a single Parent when I want it. This works fine. However, for my action class that queries these two sets of data to 'return' it to my JSP screens, I use Gson.toJson(object) to format it. This throws a LazyInitializationException because its trying to fetch the Children. I don't WANT the children to be fetched when I don't need that data. So this brings up some questions on how to 'fix' this situation : 1) Can I tell/configure Gson to NOT fetch missing lazy-fetched children? 2) If not, is there an alternative Json formatter to Gson that will respect hibernate lazy-fetch? 3) Is there another way for my action class to return or make accessible the Java bean objects that are fetched from a DB to the JSPs so that the data can be used to fill in fields and grids, other than using json format?
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39510739
downvote count: 0
tagged with: gson
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25364888
has comment: http://stackoverflow.com/comment/39550646
upvote count: 2
tagged with: lazy-loading
has title: Hibernate + lazy fetch + gson = LazyInitializationException
type: UnansweredQuestion

http://stackoverflow.com/q/25376254
answer count: 0
has title: error: 'to_string' was not declared in this scope
duplicate of: http://stackoverflow.com/q/15569179
type: Question
type: UnansweredQuestion
tagged with: java-native-interface
tagged with: android
tagged with: java
has body: I'm using android jdk1.8.0_05 and I get the error: 'to_string' was not declared in this scope My code line is for (j = 1; j &lt;= MAX_NUM_OF_TRAIN; j++){ string strNum = std::to_string(j); ... } Does JNI supports to_string? What would be the best way to do it in a 'for' loop?
has comment: http://stackoverflow.com/comment/39572864
has comment: http://stackoverflow.com/comment/39626514
tagged with: c++
score: 0
linked to: http://stackoverflow.com/q/15569179

http://stackoverflow.com/q/25365598
has comment: http://stackoverflow.com/comment/39552196
answer count: 0
has comment: http://stackoverflow.com/comment/39556284
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39551937
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39552293
has title: Parsing routine not working on Android
tagged with: httpresponse
has body: I coded this parsing routine some time ago for a java console program and it works fine. Today I tried to put it into an android project but it seems not to work properly. public static String[] parser(String pageOut,String delim1,int offset1,String delim2,int offset2,int relieve) { if(pageOut.length()&lt;delim1.length()){ String[] mid={"",pageOut}; return mid; } String[] results=new String[2]; int index=pageOut.indexOf(delim1)+delim1.length()+offset1; if(index==-1 | index==0){ String[] mid={"",pageOut}; return mid; } String left=pageOut.substring(index,pageOut.length()); int index2=left.indexOf(delim2)+offset2; results[0]=left.substring(0,index2); results[1]=""; if(relieve==1) results[1]=left.substring(index2+delim2.length(),left.length()); return results; } May it not work because I got the input string(pageOut in the routine) from an httpRequest? However I got it back this way and it seems to be the right string if displayed on the screen. HttpResponse responseReq; responseReq = client.execute(httpPost); HttpEntity entity=responseReq.getEntity(); response=EntityUtils.toString(entity); Someone has any idea?
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/39552468

http://stackoverflow.com/comment/39554341
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25366745
has text: Yes, Apache POI is ~20mb itself.

http://stackoverflow.com/comment/39575787
type: Comment
type: QuestionComment
has text: I modified it so it would be more easy for people to read. But thanks for the tip anyways
score: 0
comment on: http://stackoverflow.com/q/25377939

http://stackoverflow.com/a/25334000
score: 1
accepted answer of: http://stackoverflow.com/q/25333385
has comment: http://stackoverflow.com/comment/39496005
has comment: http://stackoverflow.com/comment/39496649
answers question: http://stackoverflow.com/q/25333385
has comment: http://stackoverflow.com/comment/39496448
has comment: http://stackoverflow.com/comment/39496055
has comment: http://stackoverflow.com/comment/39496414
has body: After seeing your code, one thing you might want to try is setting listeners for the individual children within the ListView. You could do something like this: ListView listView = (ListView)findViewById(R.id.listView); int count = listView.getChildCount(); for (int x = 0; x &lt; count; x++) { Class&lt;? extends View&gt; c = listView.getChildAt(x).getClass(); if (c == CheckBox.class) { CheckBox checkBox = (CheckBox)(listView.getChildAt(x)); checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){ @Override public void onCheckedChanged(CompoundButton compoutButton, boolean isChecked) { // TODO Auto-generated method stub callBlockOptions.isChecked = isChecked; } }); } else if (c == TextView.class) { TextView textView = (TextView)(listView.getChildAt(x)); textView.setOnEditorActionListener(new OnEditorActionListener(){ @Override public boolean onEditorAction(TextView tView, int arg1, KeyEvent arg2) { // TODO Auto-generated method stub callBlockOptions.name = tView.getText().toString(); return true; } }); } You probably want your other class to be like this: public class callBlockOptions { public static String name; public static Boolean isChecked; } Then you can get and set name and isChecked like this: callBlockOptions.isChecked = false; Boolean boolVal = callBlockOptions.isChecked;
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/39507298
type: QuestionComment
has text: I'm not sure what you mean by "pausing the loop". Do you want to make the UI unresponsive until it's human player's turn again?
score: 0
comment on: http://stackoverflow.com/q/25337743
type: Comment

http://stackoverflow.com/q/25357372
has title: How create table with spring data cassandara?
has body: I have created my own repository like that: public interface MyRepository extends TypedIdCassandraRepository&lt;MyEntity, String&gt; { } So the question how automatically create cassandra table for that? Currently Spring injects MyRepository which tries to insert entity to non-existent table. So is there a way to create cassandra tables (if they do not exist) during spring container start up? P.S. It would be very nice if there is just config boolean property without adding lines of xml and creation something like BeanFactory and etc. :-)
score: 10
upvote count: 10
has answer: http://stackoverflow.com/a/30063268
tagged with: spring
downvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39545051
has answer: http://stackoverflow.com/a/56107676
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25362725
linked to: http://stackoverflow.com/q/69203058
has answer: http://stackoverflow.com/a/69202121
tagged with: cassandra
tagged with: spring-data-cassandra
has answer: http://stackoverflow.com/a/46610702
answer count: 5

http://stackoverflow.com/q/25315112
tagged with: client-server
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25315560
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25315560
favorite count: 0
tagged with: objectinputstream
type: Question
tagged with: classcastexception
downvote count: 0
has comment: http://stackoverflow.com/comment/39461518
has title: sending objects to/from client/server
has body: I'm on the search for a solution to my error which occur while trying to send an object from server side to client side. The object in form as a class instance will be created by clicking on a JButton. A client class will also be created which transfer the object to the server. No errors will occur. But when it comes to send a new object back to the client a ClassCastException will be thrown. ActionListener Class class ActionHandler implements ActionListener { String buttonPressed; List&lt;String&gt; parameterList = new ArrayList&lt;String&gt;(); public void actionPerformed(ActionEvent event) { if(event.getSource() == executeNameSearch) { buttonPressed = "NameSearch"; parameterList = new ArrayList&lt;String&gt;(); parameterList.add(pizzaNameSearch.getText()); ObjectToServer object = new ObjectToServer(buttonPressed, parameterList); // build connection to server Client client = new Client(); client.connectToServer(object); } else if(event.getSource() == executeNameSearch) { buttonPressed = "IDSuche"; parameterList = new ArrayList&lt;String&gt;(); parameterList.add(pizzaIDSearch.getText()); ObjectToServer object = new ObjectToServer(buttonPressed, parameterList); Client client = new Client(); client.connectToServer(object); } // some more actionPerformed cases.. } } Client class public class Client { public void connectToServer(ObjectToServer object) { Socket server = null; try { server = new Socket("localhost", 3141); ObjectOutputStream oos = new ObjectOutputStream(server.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(server.getInputStream()); // sending object to server oos.writeObject(object); oos.flush(); // receiving object from server try { // ERROR BY TRYING TO CAST HERE ObjectToClient objectIn = (ObjectToClient) ois.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); } oos.close(); ois.close(); } catch(UnknownHostException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } finally { if(server!=null)…
tagged with: objectoutputstream
type: AnsweredQuestion

heap-memory
tag name: heap-memory
type: Tag
tags question: http://stackoverflow.com/q/25250808
tags question: http://stackoverflow.com/q/25310929
tags question: http://stackoverflow.com/q/25253961

http://stackoverflow.com/comment/39471083
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25320950
has text: So if I understand correctly, you want all users which have an age between the given minimum and maximum ages. Is this correct?

http://stackoverflow.com/comment/39496912
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25325801
has text: I found out at leas one thing `RequestFactoryServlet.doPost()` takes up 1s of the 4s total for the 78 object request. So at least it seam there is no single point takes up a lot of time...

http://stackoverflow.com/comment/40267018
comment on: http://stackoverflow.com/a/25451662
type: AnswerComment
score: 3
type: Comment
has text: I'm not sure about the down voters... I don't even have the reputation to do it! The reason I don't necessarily like putting comments inline with posts is because consider the (unlikely) scenario when I have thousands of comments for a single post. I would like to be able to paginate the collection of comments instead of getting the entire bunch of them every time I want to access the contents of the post.

osx-mavericks
type: Tag
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/25387267

garbage-collection
tags question: http://stackoverflow.com/q/25285095
tags question: http://stackoverflow.com/q/25367634
tags question: http://stackoverflow.com/q/25389376
tags question: http://stackoverflow.com/q/25320570
type: Tag
tags question: http://stackoverflow.com/q/25251388
tags question: http://stackoverflow.com/q/25365022
tags question: http://stackoverflow.com/q/25369708
tags question: http://stackoverflow.com/q/25242033
tags question: http://stackoverflow.com/q/25259305
tags question: http://stackoverflow.com/q/25262383
tag name: garbage-collection
tags question: http://stackoverflow.com/q/25288493
tags question: http://stackoverflow.com/q/25332849
tags question: http://stackoverflow.com/q/25238548
tags question: http://stackoverflow.com/q/25251457

http://stackoverflow.com/comment/39439649
type: Comment
has text: @R.J That is true, but rather a little formal mistake compared to the real problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/25304217
score: 0

http://stackoverflow.com/a/26728632
downvote count: 0
score: 28
has comment: http://stackoverflow.com/comment/47327489
answers question: http://stackoverflow.com/q/25270171
has comment: http://stackoverflow.com/comment/47324391
type: Answer
has body: Create a layout like this one. &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/guides_no_results" android:id="@+id/empty_view" android:gravity="center" android:padding="16dp" android:fontFamily="sans-serif-light" android:textSize="20sp" android:visibility="gone"/&gt; &lt;ListView android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="true" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:id="@+id/guides_list" /&gt; &lt;/LinearLayout&gt; If you use this as-is, everytime you scroll up in that view, the SwipeRefreshLayout fires and updates, making your app unable to scroll up in a list. The trick here is to wire the OnScrollListener from the ListView manually. You just check if the first row being shown matches the first top-most position, and then enable the SwipeRefreshLayout. Otherwise, disable it. guidesList.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int topRowVerticalPosition = (guidesList == null || guidesList.getChildCount() == 0) ? 0 : guidesList.getChildAt(0).getTop(); swipeContainer.setEnabled(firstVisibleItem == 0 &amp;&amp; topRowVerticalPosition &gt;= 0); } }); With this little snippet now it works perfectly. Happy coding! Source - http://nlopez.io/swiperefreshlayout-with-listview-done-right/
has comment: http://stackoverflow.com/comment/47327547
upvote count: 28
has comment: http://stackoverflow.com/comment/70861644
has comment: http://stackoverflow.com/comment/67763321

http://stackoverflow.com/q/25346672
has answer: http://stackoverflow.com/a/25346820
type: AnsweredQuestion
tagged with: builder
answer count: 3
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has title: Are the builder pattern and a DSL equivalent - or is one more expressive?
has answer: http://stackoverflow.com/a/25347179
tagged with: clojure
accepted answer: http://stackoverflow.com/a/25347179
favorite count: 0
type: Question
tagged with: dsl
tagged with: scala
has answer: http://stackoverflow.com/a/25360648
possible better answer: http://stackoverflow.com/a/25346820
has body: Assumptions I'll limit this to internal DSLs - but if you can give me a good reason why I should consider external DSLs - I'll listen to that. If you want to answer this in Clojure or Scala and explain why I'm wrong - I'm cool with that too. I heard a friend say the other day: You know, a DSL and the builder pattern - they're basically the same thing. To me this sounded strange, as I had always assumed a DSL would always be more expressive than the Builder Pattern. My question is: Are the builder pattern and a DSL equivalent - or is one more expressive? So I took a look - here is a User Builder Pattern in Java: public class User { private final String firstName; // required private final String lastName; // required private final int age; // optional private final String phone; // optional private final String address; // optional private User(UserBuilder builder) { this.firstName = builder.firstName; this.lastName = builder.lastName; this.age = builder.age; this.phone = builder.phone; this.address = builder.address; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public int getAge() { return age; } public String getPhone() { return phone; } public String getAddress() { return address; } public static class UserBuilder { private final String firstName; private final String lastName; private int age; private String phone; private String address; public UserBuilder(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public UserBuilder age(int age) { this.age = age; return this; } public UserBuilder phone(String phone) { this.phone = phone; return this; } public UserBuilder address(String address) { this.address = address; return this; } public User build() { return new User(this); } } } Here is the above builder pattern being used: public User getUser() { return new User.UserBuilder("John", "Doe") .age(30) .phone("1234567") .address("Fake address 1234") .build(); } Here is u…

http://stackoverflow.com/a/25412339
score: 4
has comment: http://stackoverflow.com/comment/39640907
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25294677
has comment: http://stackoverflow.com/comment/39652754
accepted answer of: http://stackoverflow.com/q/25294677
has body: Since you mention Is there another tool I am going to jump at this part and offer you a different tool, i.e. Fiddler. You can set up Fiddler with proxy Change the Android device network settings to go through the proxy. Now, you can capture complete network requests inclusive of any request made from the device. So perfect for development, if I may say so. Source - http://www.cantoni.org/2013/11/06/capture-android-web-traffic-fiddler Helps to ease a painful debugging experience, to a pleasant one. Some freebies Fiddler also allows to break on http requests, modify the content, reissue requests without having to write any piece of code. And another factor, it works for any Android release, iOS or Windows Phone or any device that supports proxy. No SDKs required to do this! If you are using a mac, you can checkout Charles network inspector. Hope this helps! Note - This answer is purely to help in inspecting the network traffic. Update - HTTPS traffic Install Fiddler Certificate to Android As a final step to improve the debugging of secure HTTPS connections, we can install a Fiddler “root” certificate on the Android device. (Note: If your device does not already have a PIN or password, you will need to set one up before installing the certificate.) Steps: On Android start the Chrome browser Navigate to http://ipv4.fiddler:8888/ Tap on the link for the “Fiddler Root Certificate” Name the certificate “Fiddler” and install it (entering your PIN or password if prompted) With this test certificate installed, you should now be able to visit SSL sites from the Android Chrome browser and not receive any certificate warnings. The network traffic should also be viewable in Fiddler. Good test sites are those which always force secure HTTPS connections, like the Wells Fargo mobile site at https://wellsfargo.com/. Exercpt from the posted link.
has comment: http://stackoverflow.com/comment/39641921
type: Answer

auditing
tag name: auditing
type: Tag
tags question: http://stackoverflow.com/q/25305515

http://stackoverflow.com/comment/39596526
type: QuestionComment
has text: Reflection is expensive. You could find that out yourself by testing it. Measure the two options and see whether or not it's acceptable to you.
comment on: http://stackoverflow.com/q/25388938
score: 1
type: Comment

http://stackoverflow.com/a/25278943
type: Answer
accepted answer of: http://stackoverflow.com/q/25278920
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25278920
has body: StringBuilder uses less memory upon concatenation (because it doesn't copy both strings), which means that if you plan to make many concatenations (in a loop!) you'd better use StringBuilder. Usually the comparison of performance is not done between StringBuilder and String but between StringBuilder and StringBuffer. The latter is synchronized which is "safer" but also much slower, hence again, the preference usually tends towards StringBuilder when you're not concerned about concurrency issues and you want optimal performance.
score: 1

http://stackoverflow.com/comment/39380485
comment on: http://stackoverflow.com/q/25272230
type: QuestionComment
type: Comment
score: 0
has text: Is `test_function("a,b",obj)` a valid call? where `obj` is a `String` object reference.

http://stackoverflow.com/q/25350164
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25350515
possible better answer: http://stackoverflow.com/a/60796059
tagged with: java
downvote count: 0
tagged with: twitter
has answer: http://stackoverflow.com/a/60796059
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25350515
has body: So I call this method: System.out.println(getTwitterDate("Thu, 3 Jan 2010 18:26:07 +0000").getMonth()); And I keep getting 11 for every month I use. I'm doing this in the getTwitterDate: final String TWITTER="EEE, dd MMM YYYY HH:mm:ss ZZZZZ"; SimpleDateFormat sf = new SimpleDateFormat(TWITTER); return sf.parse(date); I'm going by this https://stackoverflow.com/a/4522095/1193534 but removed the sf.lenient part. What am I doing wrong?
linked to: http://stackoverflow.com/q/4521715
linked to: http://stackoverflow.com/q/7215621
has title: Java- Parsing Twitter's created_at String
tagged with: android
tagged with: datetime
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/25280377
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25282187
has title: Set output file name for PDF exporter
has body: I am using JasperReports 5.6 I generate pdf using PDFCreator. My pdf is generated successfully, but i can't set name to that PDF file. PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); printRequestAttributeSet.add(MediaSizeName.ISO_A4); PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet(); printServiceAttributeSet.add(new PrinterName("PDFCreator", null)); JRPrintServiceExporter exporter = new JRPrintServiceExporter(); exporter.setExporterInput(new SimpleExporterInput(tempFileName)); SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration(); configuration.setPrintRequestAttributeSet(printRequestAttributeSet); configuration.setPrintServiceAttributeSet(printServiceAttributeSet); configuration.setDisplayPageDialog(false); configuration.setDisplayPrintDialog(false); exporter.setConfiguration(configuration); exporter.exportReport(); My pdf name are set using that PDFCreator tool I want to pass the name to that pdf file. Since exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "d:/adc.pdf"); method is now deprecated. Please tell me solution how to set that out file name
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/25282187
upvote count: 1

http://stackoverflow.com/comment/39558118
score: 1
type: QuestionComment
has text: No, ActionListener doesn't respond to right clicks. And I can't see what's wrong with your MouseListener code because you haven't shown it.
type: Comment
comment on: http://stackoverflow.com/q/25347187

http://stackoverflow.com/a/30152601
upvote count: 1
score: 1
downvote count: 0
has body: You could utilize the open source library uniVocity-parsers to convert csv to bean objects, just as following code shows: public static void main(String[] args) throws FileNotFoundException { /** * --------------------------------------------- * Read CSV rows into list of beans you defined * --------------------------------------------- */ // 1st, config the CSV reader with row processor attaching the bean definition BeanListProcessor&lt;ColumnBean&gt; rowProcessor = new BeanListProcessor&lt;ColumnBean&gt;(ColumnBean.class); settings.setRowProcessor(rowProcessor); settings.setHeaderExtractionEnabled(true); // 2nd, parse all rows from the CSV file into the list of beans you defined parser.parse(new StringReader(cont)); List&lt;ColumnBean&gt; resolvedBeans = rowProcessor.getBeans(); // 3rd, process the beans with business logic // ...... } With the library, you only need several lines of code, and it also provides significent performance. Find tutorials at its Homepage. As per the convert from bean object to json, you can check the Google Gson project.
answers question: http://stackoverflow.com/q/25314664
type: Answer

http://stackoverflow.com/a/25346323
has comment: http://stackoverflow.com/comment/39555455
answers question: http://stackoverflow.com/q/25346295
downvote count: 0
has body: Builder can be used when there is no setters in the class being built. Accepting builder as constructor argument introduces tight coupling. Following approach solves these: public class PersonBuilder { private String firstName; private String lastName; public PersonBuilder withFirstName(String firstName) { this.firstName = firstName; return this; } public PersonBuilder withLastName(String lastName) { this.lastName = lastName; return this; } public Person build() { return new Person(firstName, lastName); } }
has comment: http://stackoverflow.com/comment/39550504
has comment: http://stackoverflow.com/comment/39517045
score: 3
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/39517039
has comment: http://stackoverflow.com/comment/39556416
has comment: http://stackoverflow.com/comment/39556517
has comment: http://stackoverflow.com/comment/39563685

http://stackoverflow.com/comment/39527106
score: 3
has text: You shouldn't be passing around Connection, Statement or ResultSet like that. To restart your Connection you don't need to reload the Driver class. And once you re-connect you would have to re-run your query. Finally, you seem to have a number of other issues in your code. I would suggest you find a tutorial on JDBC or switch to an ORM tool.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25351891

http://stackoverflow.com/comment/39343318
comment on: http://stackoverflow.com/a/25251473
score: 0
type: AnswerComment
has text: My suggestion is to do some refactoring. Try to condense all of those different for loops together. This seems to be the only reason to be updating `matrix`. Another good idea is to make the input parameter `final double[][] mat` in order to force yourself to not change it.
type: Comment

http://stackoverflow.com/comment/39304151
type: QuestionComment
comment on: http://stackoverflow.com/q/25230408
score: 0
type: Comment
has text: @Aubin -- The window wouldn't let me copy paste the text .. sorry :)

http://stackoverflow.com/q/25282026
favorite count: 0
type: Question
answer count: 0
has title: Spring profiles activate all datasource
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/39399840
has body: I was trying to use spring profiles to create separate datasources for dev/prod servers. <jdbc:embedded-database id="dataSource" type="HSQL"> <jdbc:script location="classpath:sql/schema-hsqldb.sql"/> <jdbc:script location="classpath:sql/test-data.sql"/> </jdbc:embedded-database> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@//192.168.1.1:1521/XXX"/> <property name="username" value="xxx"/> <property name="password" value="xxx"/> Problem is that I can't activate profile correctly. I tried both web.xml spring.profiles.active hsqldb and -Dspring.profiles.active=hsqldb. In both cases HSQLDB is working but I also have Oracle exceptions in log (like 2nd datasource is active too): 2014-08-13 10:39:57.216 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - could not get database metadata java.sql.SQLException: Wyjątek we-wy: The Network Adapter could not establish the connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) ~[ojdbc14-10.2.0.5.jar:Oracle JDBC Driver version - "10.2.0.5.0"] How I can force spring to use only one profile and ignore another?
tagged with: java
score: 1

http://stackoverflow.com/q/25307632
tagged with: bean-validation
tagged with: java
answer count: 1
tagged with: junit
type: Question
has comment: http://stackoverflow.com/comment/39544373
has body: We are using powermock for mocking static methods. Our code seems as follows public class ValidationLayer{ private GenericInputValidator v; public ValidationLayer(GenericValidator v){ this.v = v; } public boolean isValid(MyObject obj){ Logger.info(MyFinalClass.staticMethod()); return v.validate(); } } public class GenericInputValidator{ private MyOwnValidator validator; //setters &amp; getters public boolean validate(Object toBeValidated){ validator.validate(toBeValidated); } } public class MyOwnValidator(){ private Validator v; public MyOwnValidator(){ v = Validation.byProvider(HibernateValidator.class).configure() .buildValidationFactory().getValidator(); } public validate(){ //this calls validator method of javax.validation.Validate and analyzes //the result and returns true or false based on the case. } } My test class looks like following where MyBean annotated with proper JSR-303 annotations @RunWith(PowerMockRunner.class) @PrepareForTest({MyFinalClass.class}) public TestClass{ @Test public void testValidationLayer(MyBean bean){ PowerMock.mockStatic(MyFinalClass.class); EasyMock.expect(MyFinalClass.staticMethod()).andReturn("dummy data"); GenericInputValidator v = new GenericInputValidator(new MyOwnValidator()); ValidationLayer vLayer = new ValidationLayer(v); vLayer.isValid() } } Then while running tests it is showing the following error javax.validation.ValidationException : Unable to get available provider resolvers javax.validation.Validation$ProviderSpecificBootstrapImpl.configure() On digging deep I understood that configure() is causing problem which is throwing exception when it is unable to find the provide resolvers(I saw the exception throwing with this message in source code ).I don't know why it is saying like that even when I am providing HibernateValidator.class. More weird thing is if I didn't use powermock to mock static methods i.e., if I remove my Logger code, then everything is working fine. Is there any workaround for this?
tagged with: powermock
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39492015
has title: PowerMock error with hibernate validator (JSR - 303)
has comment: http://stackoverflow.com/comment/39542916
has answer: http://stackoverflow.com/a/25307771
has comment: http://stackoverflow.com/comment/39535650
score: 0

http://stackoverflow.com/comment/39485713
score: 0
type: Comment
type: QuestionComment
has text: And of course, if that's your real code, are you sure `_processImage` should discard all arguments passed to it and call `processImage` with null pointers?
comment on: http://stackoverflow.com/q/25328769

http://stackoverflow.com/a/26099167
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25318056
type: Answer
has body: There's an overloaded version of ssh.connect(): ssh.connect(String hostname, int port) If you use this version, you can specify the port you want to connect on.
score: 2

http://stackoverflow.com/comment/39553082
score: 0
has text: @GabeSechan - we do know, from the example.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25366168

http://stackoverflow.com/q/25305697
has answer: http://stackoverflow.com/a/25305840
favorite count: 0
type: Question
has title: Boolean program in java giving error
answer count: 2
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39442045
has comment: http://stackoverflow.com/comment/39442442
has answer: http://stackoverflow.com/a/25305757
score: -5
tagged with: java
downvote count: 5
has body: This code is giving error dont know why? error is " constructor Boolean in class Boolean cannot be applied to given type". I am running this code on jdk 7 class Boolean12 { public static void main(String s[]) { // this code is to assign boolean values in different form Boolean c = new Boolean(null); Boolean d = new Boolean("null"); Boolean e = new Boolean("TRue"); Boolean f = new Boolean(TRue); Boolean g = new Boolean(true); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); System.out.println(g); } }

http://stackoverflow.com/comment/39409076
comment on: http://stackoverflow.com/q/25274949
score: 0
has text: That looks like the correct start to the usage. Do you get `redhat` if you run `rpm -E %{_host_vendor}` manually? I'm betting you do. I get your version/usage output if I run `/bin/sh -c rpm -E %{_host_vendor}` too. But that's a quoting problem. The command needs to be `/bin/sh -c 'rpm -E %{_host_vendor}'` to pass the whole string to `/bin/sh`. The maven plugin is getting the quoting wrong somehow.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39480303
type: AnswerComment
comment on: http://stackoverflow.com/a/25325273
score: 0
has text: anytime it should not show the deleted rows. btw i was thinking of creating a button to "view history" so the view history will be able to view all the data from database while the jtable should not show deleted rows. Applicable?
type: Comment

http://stackoverflow.com/q/25372368
type: UnansweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39565752
has comment: http://stackoverflow.com/comment/39565528
upvote count: 2
has title: how to exchange an amount of money into notes and coins
has answer: http://stackoverflow.com/a/25372559
tagged with: coin-change
tagged with: arrays
has body: how can I exchange a given amount of money into notes and coins? lets say input is 1234,26 and we have notes for 1000, 500, 200, 100, 50, and coins for 20, 10, 1, and 0.5? so if input is greater than .25 and less than .75 it should be rounded to 1x 0.5 if its between .75 and 1.00 it should be rounded to 1x 1 and if its less than .25 it should be rounded to nothing?¨ for this exact program the desired output would look something like this: 1x: 1000 1x: 200 1x: 20 1x: 10 4x: 1 1x: 0.5 if it wasnt for the 0.5 coin, I think I would have been able to do it using int and %, but as of right now I am pretty much clueless(think I have to use array, but im not sure how) and have no idea how to start. also im beginnner, if you can keep that in mind as well when answering and explaining! any tips/solutions? thanks in advance! like this?: System.out.println((input/1000) + " thousand " + ((input/500)%2) + " fivehundred " + (input/200%2.5) + " two hundred " + (input/100%2) + " hundred " + (input/50%2) + " fifty " + (input/20%2.5) + " twenty " + (input/10%2) + " ten " + input/1%10 + " one " ); still not sure how to deal with the 0.5 since I have to use int, input only cuz if I use double I get it completely wrong, I also have to use a if statement for the 0.5 coin..
answer count: 1
has comment: http://stackoverflow.com/comment/39565573
favorite count: 0
type: Question
downvote count: 3

http://stackoverflow.com/comment/39522074
type: QuestionComment
has text: Wait, are you thinking of method overloading? That can be one form of polymorphism, but it's far from the only kind.
comment on: http://stackoverflow.com/q/25349243
type: Comment
score: 0

http://stackoverflow.com/comment/39590915
score: 0
has text: Thanks ... but rounding is not what i am looking for ... as title suggests STORING , not sure why a minus 1 for this
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25385905

http://stackoverflow.com/q/25322679
has comment: http://stackoverflow.com/comment/39492687
has comment: http://stackoverflow.com/comment/39473835
upvote count: 87
tagged with: pre-increment
tagged with: compiler-optimization
possible better answer: http://stackoverflow.com/a/25322710
downvote count: 13
has comment: http://stackoverflow.com/comment/39529072
tagged with: performance
accepted answer: http://stackoverflow.com/a/25323548
has comment: http://stackoverflow.com/comment/39525501
type: AnsweredQuestion
score: 74
tagged with: java
has comment: http://stackoverflow.com/comment/39511141
has comment: http://stackoverflow.com/comment/39480691
has title: Why is "while (i++ < n) {}" significantly slower than "while (++i < n) {}"
has comment: http://stackoverflow.com/comment/39607070
has answer: http://stackoverflow.com/a/25323548
has comment: http://stackoverflow.com/comment/39473673
answer count: 5
linked to: http://stackoverflow.com/q/25326377
has answer: http://stackoverflow.com/a/25358488
has comment: http://stackoverflow.com/comment/39525311
favorite count: 0
has comment: http://stackoverflow.com/comment/39504442
has answer: http://stackoverflow.com/a/25322710
has answer: http://stackoverflow.com/a/25322782
type: Question
has comment: http://stackoverflow.com/comment/39473785
has answer: http://stackoverflow.com/a/25322887
has comment: http://stackoverflow.com/comment/39473769
has body: Apparently on my Windows 8 laptop with HotSpot JDK 1.7.0_45 (with all compiler/VM options set to default), the below loop final int n = Integer.MAX_VALUE; int i = 0; while (++i &lt; n) { } is at least 2 orders of magnitude faster (~10 ms vs. ~5000 ms) than: final int n = Integer.MAX_VALUE; int i = 0; while (i++ &lt; n) { } I happened to notice this problem while writing a loop to evaluate another irrelevant performance issue. And the difference between ++i &lt; n and i++ &lt; n was huge enough to significantly influence the result. If we look at the bytecode, the loop body of the faster version is: iinc iload ldc if_icmplt And for the slower version: iload iinc ldc if_icmplt So for ++i &lt; n, it first increments local variable i by 1 and then push it onto the operand stack while i++ &lt; n does those 2 steps in reverse order. But that doesn't seem to explain why the former is much faster. Is there any temp copy involved in the latter case? Or is it something beyond the bytecode (VM implementation, hardware, etc.) that should be responsible for the performance difference? I've read some other discussion regarding ++i and i++ (not exhaustively though), but didn't find any answer that is Java-specific and directly related to the case where ++i or i++ is involved in a value comparison.
has comment: http://stackoverflow.com/comment/39486469
tagged with: post-increment
has comment: http://stackoverflow.com/comment/39473752

http://stackoverflow.com/a/25252984
has comment: http://stackoverflow.com/comment/39351154
has comment: http://stackoverflow.com/comment/39351213
has comment: http://stackoverflow.com/comment/39350926
has comment: http://stackoverflow.com/comment/39351282
has comment: http://stackoverflow.com/comment/39351343
has comment: http://stackoverflow.com/comment/39351048
has comment: http://stackoverflow.com/comment/39351176
has comment: http://stackoverflow.com/comment/39350898
type: Answer
has comment: http://stackoverflow.com/comment/39355234
has comment: http://stackoverflow.com/comment/39351085
answers question: http://stackoverflow.com/q/25252052
has body: You need to make sure that you... Set the size of the component Layout the child components of the container if required Use printAll rather the print as it will attempt to ensure the content is painted fully and doesn't double buffer the process (making it faster) dispose of the Graphics context once you are completed. The following shows the panel when displayed on a frame and when printed using the sample code... import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class PrintComponent { public static void main(String[] args) { new PrintComponent(); } public PrintComponent() { Example example = new Example(); example.setSize(example.getPreferredSize()); example.doLayout(); BufferedImage bi = new BufferedImage (example.getWidth(), example.getHeight(), BufferedImage.TYPE_BYTE_INDEXED); Graphics2D g2d = bi.createGraphics(); example.printAll(g2d); g2d.dispose(); try { ImageIO.write(bi, "png", new File("D:/PrintExample.png")); } catch (IOException ex) { ex.printStackTrace(); } } public class Example extends JPanel { public Example() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; add(new JLabel("Hello"), gbc); add(new JTextField("'ello", 20), gbc); add(new JButton("g'day"), gbc); } } }
score: 0
has comment: http://stackoverflow.com/comment/39351115
has comment: http://stackoverflow.com/comment/39352417
has comment: http://stackoverflow.com/comment/39350934
has comment: http://stackoverflow.com/comment/39346611
has comment: http://stackoverflow.com/comment/39351132
has comment: http://stackoverflow.com/comment/39351302
has comment: http://stackoverflow.com/comment/39350950
has comment: http://stackoverflow.com/comment/39350932
has comment: http://stackoverflow.com/comment/39350763
has comment: http://stackoverflow.com/comment/39351249
has comment: http://stackoverflow.com/comment/39350985
has comment: http://stackoverflow.com/comment/39350965

http://stackoverflow.com/q/25261263
downvote count: 0
upvote count: 1
has body: Following Java code is an example for uploading a file attachment to the SharePoint 2013 list item. String uploadquery =siteurl+ _api/web/Lists/GetByTitle('ListName')/items(1)/AttachmentFiles/add(FileName='File1.txt')"; HttpPost httppost = new HttpPost(uploadquery); httppost.addHeader("Accept", "application/json;odata=verbose"); httppost.addHeader("X-RequestDigest", FormDigestValue); httppost.addHeader("X-HTTP-Method", "PUT"); httppost.addHeader("If-Match", "*"); StringEntity se = new StringEntity("This is a Body"); httppost.setEntity(se); HttpResponse response = httpClient.execute(httppost, localContext); It creates the file with the content.But it returns the following error in the response. {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The type SP.File does not support HTTP PATCH method."}}} what causes this issue? in Above code,I upload simple text content.But How to upload other file types such as excel/ppt or images to sharepoint list item ?
has answer: http://stackoverflow.com/a/25285911
tagged with: sharepoint
tagged with: http
favorite count: 0
tagged with: sharepoint-2013
type: Question
tagged with: rest
has answer: http://stackoverflow.com/a/46326292
has title: upload attachment to SharePoint List Item using REST API from Java client
score: 1
tagged with: java
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/39344054
comment on: http://stackoverflow.com/a/25249749
type: Comment
type: AnswerComment
has text: Thank you for your input. However I need to understand what is wrong with the code I have used since this kind of Date/Calendar usage is repeated in many places in an application I have inherited and if this part is wrong then others will be also.
score: 0

http://stackoverflow.com/comment/39529654
type: Comment
score: 1
has text: Or http://stackoverflow.com/questions/21290104
type: QuestionComment
comment on: http://stackoverflow.com/q/25353414

http://stackoverflow.com/comment/39334866
type: Comment
score: 0
type: AnswerComment
has text: @Steven no, using `p=chooser...` would create a parameter with exactly that name. You need to use the string that represents the path, i.e. the return value of `chooser.getSelectedFile().getAbsolutePath()` and since a path _might_ contain spaces you _might_ need to add double quotes to that string at the start and the end, that's what the `"\""` is for - it's a string literal containing a single double quote.
comment on: http://stackoverflow.com/a/25246552

http://stackoverflow.com/comment/39426367
comment on: http://stackoverflow.com/q/25296899
has text: I take back my comment on the issue being on the Advanced Rest Client seeing the Neo4j server is issuing the errors. That said, I am still where I was a few minutes ago.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25329936
has answer: http://stackoverflow.com/a/25329993
type: Question
has title: variable miles might not have been initialized
has comment: http://stackoverflow.com/comment/39487694
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8284779
duplicate of: http://stackoverflow.com/q/8284779
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39487698
tagged with: java
has body: It keeps saying variable miles might not have been initialized? Here is the problem: float km = miles * 1.609f; Here is the full code: import java.io.*; public class MilesToKilometres { public static void main(String[] args)throws Exception { //1 mile = 1.609 kilometre; int miles; System.out.print("17"); float km = miles * 1.609f; System.out.println(miles + " miles is " + km + " kilometres. "); } }
has answer: http://stackoverflow.com/a/25329969

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/25301406
type: Tag

http://stackoverflow.com/comment/39568222
type: Comment
comment on: http://stackoverflow.com/a/25314488
score: 0
type: AnswerComment
has text: My answer is still correct. Sounds, videos, images, it really doesn't matter. That's all content that belongs in the jar. The only exception is if you want users to be able to modify that content. The point is that there's no reason to create a packaged executable just to include resources with your jar.

http://stackoverflow.com/comment/39369898
type: QuestionComment
comment on: http://stackoverflow.com/q/25266560
has text: Try changing ` /rest ` to ` /rest/* ` and let me know
score: 0
type: Comment

http://stackoverflow.com/comment/82163051
type: Comment
type: QuestionComment
score: 0
has text: Hey Nicolas, wanted to check how did your learning curve go. I am on same path. if you can post your findings it would be great.
comment on: http://stackoverflow.com/q/25270372

http://stackoverflow.com/comment/39576671
has text: thanks I am really looking forward to it , I am really having a problem with posting any JSON data to my backed service always being rejected
type: Comment
comment on: http://stackoverflow.com/a/25289991
score: 0
type: AnswerComment

http://stackoverflow.com/a/25332023
downvote count: 0
answers question: http://stackoverflow.com/q/25331926
has body: A HashSet uses a HashMap as its backing mechanism for the set. Normally, we would expect that hashCode and equals would be called to ensure that there are no duplicates. However, the put method (which calls a private putVal method to do the actual operation) makes an optimization in the source code: if (e.hash == hash &amp;&amp; ((k = e.key) == key || (key != null &amp;&amp; key.equals(k)))) If the hash codes match, it first checks to see if the keys are the same before calling equals. You are passing the same Student object, so they are already ==, so the || operator short-circuits, and equals is never called. If you passed in a different Student object but with the same ID, then == would return false and equals would be called.
upvote count: 9
score: 9
type: Answer

http://stackoverflow.com/a/25323636
has body: Removing The "@Override" does the job
answers question: http://stackoverflow.com/q/25323379
type: Answer
score: 0

http://stackoverflow.com/a/41514050
has comment: http://stackoverflow.com/comment/70392165
upvote count: 34
has body: Alternative to Filters, you can use HandlerInterceptor. public class SessionManager implements HandlerInterceptor{ // This method is called before the controller @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String xHeader = request.getHeader("X-Auth-Token"); boolean permission = getPermission(xHeader); if(permission) { return true; } else { response.setStatus(HttpStatus.UNAUTHORIZED.value()); return false; // Above code will send a 401 with no response body. // If you need a 401 view, do a redirect instead of // returning false. // response.sendRedirect("/401"); // assuming you have a handler mapping for 401 } return false; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { } } And then add this interceptor to your webmvc config. @EnableWebMvc @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Bean SessionManager getSessionManager() { return new SessionManager(); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(getSessionManager()) .addPathPatterns("/**") .excludePathPatterns("/resources/**", "/login"); // assuming you put your serve your static files with /resources/ mapping // and the pre login page is served with /login mapping } }
has comment: http://stackoverflow.com/comment/70388616
answers question: http://stackoverflow.com/q/25373053
has comment: http://stackoverflow.com/comment/70391945
has comment: http://stackoverflow.com/comment/70391001
downvote count: 1
score: 33
has comment: http://stackoverflow.com/comment/76667774
has comment: http://stackoverflow.com/comment/76667717
type: Answer

http://stackoverflow.com/comment/39371296
comment on: http://stackoverflow.com/q/25267497
has text: I would look into the `format` class which will let you specify the number of characters a number has before and after decimals. This should let you achieve what you want.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25287509
score: -3
has comment: http://stackoverflow.com/comment/39408063
tagged with: http://stackoverflow.com/tag/xml
downvote count: 4
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/25287903
tagged with: java
has comment: http://stackoverflow.com/comment/39408056
linked to: http://stackoverflow.com/q/21266500
has title: Simple XML to Java variables
upvote count: 1
tagged with: variables
answer count: 1
has body: I am just wondering if there is a simple method to load Java variables (only String) from a XML file, that is like the following. Most of the libraries and methods i read seem to be quite confusing. <?xml version="1.0" encoding="UTF-8"?> Max Mustermann max@mustermann.com Max's Mustermänner Thank you for your help! Benjamin
has comment: http://stackoverflow.com/comment/39408014
favorite count: 0
has comment: http://stackoverflow.com/comment/39411051
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25237986
downvote count: 0
has comment: http://stackoverflow.com/comment/39398772
has comment: http://stackoverflow.com/comment/39399023
favorite count: 0
accepted answer: http://stackoverflow.com/a/25338717
possible better answer: http://stackoverflow.com/a/25283250
has body: Following question has been separated from this one: ArrayIndexOutOfBoundsException while Spring save data to MongoDB I have problem with saving Object to MongoDB. I've noticed that problem might be caused by too complex object. I have following class hierarchy: ClassA is superclass for ClassB and ClassC. ClassD contains map of maps. ClassC contains ClassB. Code which I invoke is following: ClassC c = new ClassC() c.setName("NAME"); mongoOperation.save(c, "Mongo"); // MongoOperations object The problem is that Mongo doesn't save object's data. It saves only _id and _class. Actual data { "_id" : ObjectId("53e86cd9c506f66eafaa03cb"), "_class" : "com.sample.ClassC" } Expected data { "_id" : ObjectId("53e86cd9c506f66eafaa03cb"), "_class" : "com.sample.ClassC", "name" : "NAME" } Funny thing is that when I comment out map field in ClassD everything works fine. Is it possible to be caused by too complex object which I try to serialize? EDIT When I remove bObject from ClassC it also works fine. EDIT 2 All classes are simple beans with setters and getters. e.g. public class ClassD{ private TreeMap&lt;String, TreeMap&lt;String,String&gt;&gt; map; public TreeMap&lt;String, TreeMap&lt;String, String&gt;&gt; getMap() { return map; } public void setMap(TreeMap&lt;String, TreeMap&lt;String, String&gt;&gt; map) { this.map = map; } } EDIT 3 Full example below, it has same class hierarchy as picture above. public class Application implements CommandLineRunner { @Autowired private MongoTemplate mongoTemplate; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override public void run(String... args) throws Exception { ClassC cObject = new ClassC(); cObject.setName("Jon"); try { mongoTemplate.save(cObject); }catch(Exception e){ e.printStackTrace(); } mongoTemplate.save(cObject); } } class ClassA{ private String name; private ClassD dObject; public String getName() { return name; } public void setName(String name) { this.name = name; } public Cla…
tagged with: mongodb
tagged with: spring-boot
type: Question
has answer: http://stackoverflow.com/a/25338717
answer count: 2
has title: Spring doesn't save object to MongoDB correctly
tagged with: spring
score: 6
upvote count: 6
linked to: http://stackoverflow.com/q/25264827
has answer: http://stackoverflow.com/a/25283250
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39461700
type: Comment
has text: Now i understood your question and I changed my code(RETORNO1WS.JAVA) for non static and everything works fine. Thanks for your help
type: QuestionComment
comment on: http://stackoverflow.com/q/25313247
score: 0

http://stackoverflow.com/q/25327080
score: 0
tagged with: nullpointerexception
tagged with: java
answer count: 1
tagged with: vaadin
linked to: http://stackoverflow.com/q/40480
has title: Vaadin Null Pointer Exception when trying to add component to tabsheet
type: Question
has body: I am still new to Java and Vaadin , and I am having a hard time trying to figure out how to resolve a null point exception when I try to populate the tabsheet with a component. Where am I screwing at? I know the issue is with my ObjList being null...but I am not sure how to resolve that. Please see below code: Main Class: public class Main extends Application { private ObjList objList = null; private ObjContainer dataSource = ObjContainer.createData(); private TabWindow tabWindow = new TabWindow(objList); public void init() { buildmainlayout(); } private void buildmainlayout() { setMainWindow(new Window("Test")); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(tabWindow); getMainWindow().setConent(layout); } private TabWindow getTabWindow() { if(tabwindow == null) { objList = new ObjList(this); tabWindow = new TabWindow(objList); } return tabWindow; } public ObjContainer getDataSource() { return dataSource; } } ObjList Class: public class ObjList extends Table { public ObjList (Main app) { setSelectable(true); setImmediate(true); setContainerDataSource(app.getDataSource()); setColumnHeaders(ObjContainer.COL_HEADERS_ENGLISH); setVisibleColumnsw(ObjContainer.NATURAL_COL_ORDER); } } TabWindow Class: public class TabWindow extends TabSheet implements TabSheet.SelectedTabChangeListener { private TabSheet t; public TabWindow(ObjList objList) { VerticalLayout l1 = new VerticalLayout(); l1.setMargin(true); l1.addCOmponent(new Label("A")); t= new TabSheet(); final Tab a = t.addTab(l1, "A", null)); addComponent(t); } public void selectedTabChange(SelectedTabChangeEvent event){ TabSheet tabsheet = event.getTabSheet(); Tab tab = tabsheet.getTab(tabsheet.getSelectedTab()); if (tab != null) { getWindow().showNotification("Selected tab" + tab.getCaption()); } } } Thanks!
has comment: http://stackoverflow.com/comment/39483190
accepted answer: http://stackoverflow.com/a/25327744
has answer: http://stackoverflow.com/a/25327744
type: AnsweredQuestion

http://stackoverflow.com/q/25349005
has answer: http://stackoverflow.com/a/25352231
type: Question
has comment: http://stackoverflow.com/comment/39521610
tagged with: android
has comment: http://stackoverflow.com/comment/39521736
tagged with: java
has comment: http://stackoverflow.com/comment/39521655
has comment: http://stackoverflow.com/comment/39521785
has comment: http://stackoverflow.com/comment/39521444
type: AnsweredQuestion
score: 0
has title: Random application crashes - Fatal developer error
answer count: 1
accepted answer: http://stackoverflow.com/a/25352231
has body: I'm currently developing an Android Game Application and am almost done but stumbled upon some problems. I had no need for Google Play Services in my game until now, when i need to implement leaderboards and achievements. This is where the problem popped up. After adding required libraries I made all my game activities extend BaseGameActivity. The first problem that showed up was regarding the calls of requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); and it said that i have to call requestFeature() before adding content, which I think I did , since I'm calling setContentView after it. I decided to resolve (better expression would be ignore) this problem by commenting above code. After running the application after that, every times it crashes after a random period of time giving me the following error: 08-17 13:55:43.879: I/dalvikvm(30369): Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.games.internal.PopupManager$PopupManagerHCMR1.h 08-17 13:55:43.879: W/dalvikvm(30369): VFY: unable to resolve virtual method 9019: Landroid/view/View;.getDisplay ()Landroid/view/Display; 08-17 13:55:43.879: D/dalvikvm(30369): VFY: replacing opcode 0x6e at 0x0009 08-17 13:55:43.910: W/PopupManager(30369): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view. 08-17 13:55:43.940: D/dalvikvm(30369): GC_FOR_ALLOC freed 181K, 14% free 7567K/8711K, paused 22ms, total 22ms 08-17 13:55:43.970: I/dalvikvm-heap(30369): Grow heap (frag case) to 12.105MB for 4008020-byte allocation 08-17 13:55:44.020: D/dalvikvm(30369): GC_CONCURRENT freed 1K, 10% free 11480K/12679K, paused 15ms+2ms, total 52ms 08-17 13:55:44.020: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 7ms 08-17 13:55:44.…

http://stackoverflow.com/a/25266466
has body: You can't use variable name as the type. You must use Class instead of clazz List&lt;Class&gt; myList = new ArrayList&lt;Class&gt;();
score: 1
answers question: http://stackoverflow.com/q/25266425
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/39414347
type: Comment
type: AnswerComment
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59285/discussion-between-angryjuice-and-holger).
comment on: http://stackoverflow.com/a/25290011

http://stackoverflow.com/comment/39499823
score: 0
type: QuestionComment
has text: Add your entity̧, the new error is very clear, your `User` entity dont have a `String getTitle()` method.
comment on: http://stackoverflow.com/q/25335954
type: Comment

http://stackoverflow.com/q/25384285
downvote count: 0
upvote count: 1
answer count: 1
has title: Android PDF Load Timing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25427606
accepted answer: http://stackoverflow.com/a/25427606
has body: The requirements: ensure that the PDF document is deleted from the device after the user has left the PDF viewing screen The problem: on certain devices (Samsung 4.4.2 and Samsung 4.1.2 for sure, but not Asus 4.2.1) only the first time that the PDF is requested after restarting the application an error message is displayed stating "This document cannot be opened". Thereafter the PDF will load normally. I'm thinking this is a timing issue due to processes that need to be started the first time, but are running after the first attempted load. The code: note that createFile() is called first, then startActivityForIntentResult() private File file; private ArrayList&lt;Uri&gt; uriList = new ArrayList&lt;Uri&gt;(); private void createFile() { int fileNameLength = pdfFileName[0].length(); String fileName = pdfFileName[0].substring(0, fileNameLength - 4) + DateTime.now(); String fileExtension = pdfFileName[0].substring(fileNameLength - 4, fileNameLength); byte[] content = Base64.decodeBase64(pdfData[0].getBytes()); BufferedOutputStream outputStream = null; try { File path = new File(getExternalFilesDir(null).getAbsolutePath(), "temp"); if (!path.exists()) { path.mkdirs(); } file = new File(path, fileName + fileExtension); outputStream = new BufferedOutputStream(new FileOutputStream(file)); outputStream.write(content); file.deleteOnExit(); uriList.add(Uri.fromFile(file)); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } finally { try { if (outputStream != null) { outputStream.flush(); outputStream.close(); } } catch (IOException ex) { ex.printStackTrace(); } } } private static int REQUEST_CODE = 1; private Intent intent; private void startActivityForIntentResult() { if (file.exists()) { Uri targetUri = uriList.get(0); intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(targetUri, "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); try { startActivityForResult(intent, REQUEST_CODE); } ca…
score: 1
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
type: AnsweredQuestion

http://stackoverflow.com/q/25336914
score: 0
answer count: 2
tagged with: java
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25337989
has answer: http://stackoverflow.com/a/25337989
has title: Arrays and bank accounts in Java
has comment: http://stackoverflow.com/comment/39501030
type: Question
tagged with: bank
has comment: http://stackoverflow.com/comment/39501147
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/25338845
has comment: http://stackoverflow.com/comment/39501200
has body: I am trying to write a simple Bank Account Management program that does the following: Creates a new account with Account number and Balance taken from user and stored in an array Selects an account (from the array) Deletes the account selected Withdraw and Deposit into account selected. Problem: I don't understand what the my mistakes are. I tried using different types of arrays for account number and balance storing, but I didn't not find the answer yet. I search the web and Stackoverflow for references, documentations, simple examples, but could not find any (the ones that I found, use some commands and things that I haven't learned yet so I can understand how they work). I am a beginner, I am still learning and would appreciate some advice. Thanks! //Bank account class public class account { private int ANumber; private double balance; public account(double initialBalance, int accno) { balance = initialBalance; ANumber = accno; } public void deposit (double u_amm){ balance += u_amm; } public double withdraw(double amount) { balance -= amount; return amount; } public double getBalance() { return balance; } public int getAccount(){ return ANumber; } } And this is the Main class import java.util.Scanner; // main class public class bankmain { public static void main(String[] args) { Scanner scan = new Scanner(System.in); // Menu starts from here Scanner input = new Scanner(System.in); System.out.println("Enter the option for the operation you need:"); System.out.println("****************************************************"); System.out.println("[ Options: ne - New Account de - Delete Account ]"); System.out.println("[ dp - Deposit wi - Withdraw ]"); System.out.println("[ se - Select Account ex - Quit ]"); System.out.println("****************************************************"); System.out.print("&gt; "); //indicator for user input String choice = input.next(); //Options while(true){ if(choice == "ne"){ int nacc; int bal; int [][]array = new int[nacc][bal]; // Arr…
has comment: http://stackoverflow.com/comment/39501082
linked to: http://stackoverflow.com/q/7520432
has answer: http://stackoverflow.com/a/25338845
type: AnsweredQuestion

http://stackoverflow.com/comment/39401547
type: Comment
type: QuestionComment
score: 0
has text: Here is the org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory class and there is a registery instantiated inside it: http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5.2/org.eclipse.m2m.qvt/oml/2.0.1/org/eclipse/m2m/internal/qvt/oml/compiler/UnitResolverFactory.java
comment on: http://stackoverflow.com/q/25283589

http://stackoverflow.com/comment/39596655
score: 1
has text: It means you're trying to run uncompilable code -- don't do that. First fix the compilation problem, test that it compiles first, and only then try to run it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25388870

http://stackoverflow.com/q/25295640
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39425017
tagged with: serialization
has body: I want to deserialize this json data into an ArrayList {"users":[{"username":"jon@jafprod.com","pw":"123456","data":""},{"username":"fred@jones.com","pw":"abcde","data":""}]} this is the class public class UserClass { public String email; public String pw; public JSONObject data; } My attempts such as: UserClass users = new JSONDeserializer&lt;UserClass&gt;().use("users", UserClass.class) .deserialize( resultStr, Array.class ); but always result in a java.lang.NoClassDefFoundError: Failed resolution of: Lflexjson/JSONDeserializer;
score: 0
has title: deserialize JSON to an ArrayList with Flexjson (Java Android)
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: flexjson
has comment: http://stackoverflow.com/comment/39423970
type: Question
has comment: http://stackoverflow.com/comment/39424961
answer count: 0

http://stackoverflow.com/q/25367229
has title: what type of Data Structure to be used to store this type of data?
has comment: http://stackoverflow.com/comment/39555166
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25367281
linked to: http://stackoverflow.com/q/24954648
has answer: http://stackoverflow.com/a/25367302
duplicate of: http://stackoverflow.com/q/24954648
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39555150
has body: I am retrieving the data from Database in this format which will be in key , value pair . | Soft Drinks | Bottled,Lemon(19) | Soft Drinks | Bottled,Clear(20) | Ice creams | Cone,KoolCool(21) | Ice creams | Stick,KoolCool,Sai,BabaSai(27) Please suggest ,Is there any data structure to store this type of data ?? The key is duplicated so i cant use Map .
type: UnansweredQuestion

http://stackoverflow.com/a/25370197
score: 0
has body: Server must support up to 8 connections. I can't imagine how this would be a problem. You can handle thousands, if not tens of thousands of connection with Java. Each connection must receive up to 25 Megabytes per second. I think average summary speed of all connections - 90% of time - will be about 100 Megabytes per second, but system must stable work in worst case too. This means you need at least a 1 Gb/s connection. Java can handle this rate with one thread. Note: 100 MB/s is about 8 TB/day. You will have to find way to minimise disk usage if you plan to use SSD. Server must work on commodity-class hardware (8Gb RAM, i7 (i5 preferable) processor). My project have restrictions with size of hardware (very small box, low heat and low power consumption) and price. Unfortunately, I can’t change it if you propose. I have no idea why you would buy multiple enterprise SSD and very buy on 8 GB (I assume you mean Giga-byte not Gb = Giga-bit) My 8 year son had 8 GB for his games PC 18 months ago. Not sure why you would by an i5 for a performance system either. I would get an i7 if not a Xeon. Not because it can't be done using i5, but because you will cost far more in development time than you will save in hardware. The rest seems entirely achievable. Is here anyone who implemented high loaded systems on commodity software with JVM? Many have, it depends on what you are trying to do. As I know, operations system must bufferize network input, so GC delays don’t matter in such situation, isn’t it? Network buffers don't make any difference to GCs. They can help if you have very bursty behaviour, but if you only need 1 Gb/s I wouldn't worry about it so much. The most important thing to do is to manage your allocaton rate by reducing usage. A memory profiler can help you do that. What can I read about JVM (GC)? I spend your time reducing the need for GC, esp since you have so little memory. Most servers these days have well over 32 GB e.g. 256 GB to 4 TB. It sounds like your ma…
answers question: http://stackoverflow.com/q/25369708
type: Answer

http://stackoverflow.com/a/25386189
upvote count: 1
has comment: http://stackoverflow.com/comment/39591307
has body: If it is the request only that you want to set a timeout to then in request body: query_config = { 'timeoutMs': 1000, set timeoutsMs to whatever you like withing reason ;) Hope that helps the documentation is here Edit To get the results of the query even if it hasn't obeyed the timeout Call jobs.getQueryResults taken from the site you must specify a start row, and this also takes a timeout that behaves the same as the jobs.query timeout to allow waiting if the job is not yet complete.
answers question: http://stackoverflow.com/q/25385951
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39597530
downvote count: 0

http://stackoverflow.com/a/25369463
answers question: http://stackoverflow.com/q/25369416
score: 2
upvote count: 2
downvote count: 0
has body: This is called an anonymous type in Java. It allows you to implement an interface or extend an abstract class without needing a named class for it. This is especially useful if the interface or abstract class is implemented very often and creating a new class for each implementation would end up in a confusing mess of classes. A good example for this is Java's Runnable interface that simply allows to pass a void method to a method which takes no arguments. You can find more on this here: http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
type: Answer

http://stackoverflow.com/a/48867087
type: Answer
answers question: http://stackoverflow.com/q/25311090
score: 0
has body: I had a similar problem but my issue was due to missing a generated Id in the entity class as in below: @Id @GeneratedValue Integer xxx; That fixed my issue. As a new comer to JPA, seems like every entity table needs it?

http://stackoverflow.com/q/25322531
possible better answer: http://stackoverflow.com/a/25322595
score: 6
has comment: http://stackoverflow.com/comment/39473436
has answer: http://stackoverflow.com/a/25322595
has comment: http://stackoverflow.com/comment/39473441
has title: Chess bitboard implementation in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39473421
answer count: 2
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/39473442
has body: I'm looking to create a basic chess (or failing that, checkers/draughts) engine. After researching the topic I'm fairly confident that I want to use a series of bitboards. I understand the concept at a basic level but I'm having trouble representing them in Java. I've attempted to represent the white pieces of a chessboard as 1 and everything else as 0 using a long: long whitePieces = 0000000000000000000000000000000000000000000000001111111111111111L; But when I print it out I get the following 46 bits: System.out.println(Long.toBinaryString(whitePieces)); 1001001001001001001001001001001001001001001001 What is causing this result? I'm sure there's something I'm fundamentally misunderstanding here; If anyone could point me in the right direction I'd be very grateful.
downvote count: 1
tagged with: bitboard
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39473437
accepted answer: http://stackoverflow.com/a/25322570
has answer: http://stackoverflow.com/a/25322570

http://stackoverflow.com/a/25299262
type: Answer
answers question: http://stackoverflow.com/q/25278033
has body: I modified my implementation to use DataInputStream to read data from socket as outline here:Java TCP How do you read a sent stream size (header) and keep reading based upon that size This approach provide flexibility to manipulate the various values such as individual header fields by using ByteBuffer Thanks
score: 0

http://stackoverflow.com/comment/94319800
score: 0
type: Comment
has text: If you're looking for the correct URL from @DavidLeedy above, it's: https://edm00se.io/xpages/consistent-multivalue-formatting/
type: AnswerComment
comment on: http://stackoverflow.com/a/25272517

http://stackoverflow.com/a/25363393
type: Answer
answers question: http://stackoverflow.com/q/25363324
score: 0
has comment: http://stackoverflow.com/comment/39547637
has comment: http://stackoverflow.com/comment/39548270
has comment: http://stackoverflow.com/comment/39547940
has body: try { ps.setInt(3, Integer.parseInt(playerNumberFld.getText())); } catch (Exception e) { ps.setInt(3,0); e.printStackTrace(); } playerNumberFld is empty. So If you try to parse exception comes. So Incase of exception you just put 0 in catch block and try

http://stackoverflow.com/comment/39451906
type: Comment
score: 1
type: QuestionComment
has text: Go to json.org and learn the JSON syntax -- it only takes 5-10 minutes to learn, and then things will make a lot more sense.
comment on: http://stackoverflow.com/q/25310276

http://stackoverflow.com/comment/39453487
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25309549
has text: Have you checked out the code from github or are you copying it? If you are doing the later, you might have missed something

http://stackoverflow.com/q/25313788
tagged with: android
has answer: http://stackoverflow.com/a/25314775
tagged with: listview
has title: Last Listview item removed instead of selected one
score: 0
tagged with: custom-adapter
tagged with: java
has answer: http://stackoverflow.com/a/25313965
has body: I have a listView, with items. When I longClick on one of them, a delete button appears. But when I press it, it's the last item which is deleted and not the one I pressed ... Here my code : appList0 = new ArrayList&lt;Appreciation&gt;(); String[] app0 = settings.getString("App0", "aucune remarque").toString().split(";"); for (String app : app0) appList0.add(new Appreciation(app)); dataAdapter0 = new MyCustomAdapter(this,R.layout.affichageitem, appList0); ListView listView0 = (ListView) findViewById(R.id.listView0); listView0.setAdapter(dataAdapter0); and the adapter private class MyCustomAdapter extends ArrayAdapter&lt;Appreciation&gt; { private ArrayList&lt;Appreciation&gt; appList; public MyCustomAdapter(Context context, int textViewResourceId,ArrayList&lt;Appreciation&gt; appList) { super(context, textViewResourceId, appList); this.appList = new ArrayList&lt;Appreciation&gt;(); this.appList.addAll(appList); } private class ViewHolder { TextView text; ImageButton button; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = vi.inflate(R.layout.affichageitem, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.textview); holder.button = (ImageButton) convertView.findViewById(R.id.editButton); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); holder.button.setVisibility(View.INVISIBLE); } holder.text.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { TextView tv = (TextView) v ; //To DO } }); holder.button.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { ListView listView0=(ListView)findViewById(R.id.listView0); Log.e("DELETING : ",appList0.get(position).getValue()); appList0.remove(position); //DELETING HERE dataAdapter0.notifyDataSetChanged(); ImageButton…
has comment: http://stackoverflow.com/comment/39470393
type: Question
has comment: http://stackoverflow.com/comment/39458136
has comment: http://stackoverflow.com/comment/39469878
answer count: 2
tagged with: items
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39458796

http://stackoverflow.com/comment/39625285
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/25404594/how-to-expand-an-object-in-a-treeviewer Here is a new link
comment on: http://stackoverflow.com/q/25382699
score: 0

http://stackoverflow.com/comment/39338018
score: 0
type: Comment
has text: @user3930508 `JSONArray var = arrayValues(0);`
comment on: http://stackoverflow.com/a/25248904
type: AnswerComment

http://stackoverflow.com/q/25302916
type: AnsweredQuestion
answer count: 2
score: 5
accepted answer: http://stackoverflow.com/a/25345664
downvote count: 0
possible better answer: http://stackoverflow.com/a/25303079
has answer: http://stackoverflow.com/a/25345664
has answer: http://stackoverflow.com/a/25303079
favorite count: 0
type: Question
tagged with: nullpointerexception
has body: I'm getting a NullPointerException on blah.startAnimation(anim), which is inside a LongClickListener. What I'm trying to do is get the number of children in a GridLayout on a DragListener, and set an animation to all of the children when you start to drag an imageview. For some reason this returns a NullPointerException, Where it's coming from is: @Override public boolean onLongClick(View v) { View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v); v.startDrag(null, shadowBuilder, v, 0); deleteAreaForAdapter.setVisibility(View.VISIBLE); deleteAreaForAdapter.startAnimation(slide_in); for(int i=0; i&lt;middleViewForAdapter.getChildCount(); i++) { int middleChildCount = middleViewForAdapter.getChildCount(); int middleChildCount1 = middleViewForAdapter.getChildCount(); int topChildCount = middleViewForAdapter.getChildCount(); int topChildCount1 = middleViewForAdapter.getChildCount(); int bottomChildCount = middleViewForAdapter.getChildCount(); LinearLayout topChild = (LinearLayout)topViewForAdapter.getChildAt(i); LinearLayout topChild1 = (LinearLayout)topViewForAdapter1.getChildAt(i); LinearLayout bottomChild = (LinearLayout)bottomViewForAdapter.getChildAt(i); Context context = mContext; Animation shakeAnim = AnimationUtils.loadAnimation(context, R.anim.shake); // do stuff with child view //ll.clearAnimation(); /*middleChild1.startAnimation(shakeAnim); topChild.startAnimation(shakeAnim); topChild1.startAnimation(shakeAnim); bottomChild.startAnimation(shakeAnim);*/ if(middleChildCount &gt; 0) { GridLayout hjk = middleViewForAdapter; LinearLayout middleChild = (LinearLayout)hjk.getChildAt(i); middleChild.startAnimation(shakeAnim); ll.clearAnimation(); } if(middleChildCount1 &gt; 0) { GridLayout hjs = middleLayoutForAdapter1; LinearLayout middleChild1 = (LinearLayout)hjs.getChildAt(i); middleChild1.startAnimation(shakeAnim); //Line it's coming from! ll.clearAnimation(); } if(topChildCount &gt; 0) { topChild.startAnimation(shakeAnim); ll.clearAnimation(); } if…
tagged with: android
upvote count: 5
tagged with: java
has title: NullPointerException on startAnimation(anim)
has comment: http://stackoverflow.com/comment/39439422

http://stackoverflow.com/comment/39571419
has text: @MadProgrammer May I please have an example of that?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25375234
type: Comment

http://stackoverflow.com/q/25265997
has comment: http://stackoverflow.com/comment/39368603
has body: Hi I have a program like this. interface package Sarvari.pack1; public interface Inter { void f(); } An outer class and Inner class: package Sarvari.pack2; import Sarvari.pack1.*; public class Outer { protected class Inner implements Inter { Inner() {//only public is working not protected or default; System.out.println("constructor of inner class"); } public void f(){ System.out.println("f method in inner class"); } } } a class that extends the outer class: package sarvari; import sarvari.pack2.*; import sarvari.pack1.*; public class Coffee extends sarvari.pack2.Outer{ public Inter met(){ return new Inner(); } public static void main(String[] args){ new Coffee().met().f(); } } My questions are is why I have to declare the constructor of the Inner class as public? why I cant access it as default? If the protected access of Inner class is coming to the constructor, then even if I kept the access as protector to the constructor, its not working..only public is working..can anyone explain this behavior?
has comment: http://stackoverflow.com/comment/39368819
has comment: http://stackoverflow.com/comment/39369225
has answer: http://stackoverflow.com/a/25266328
score: 0
has title: Inner classe constructor in java
tagged with: inner-classes
has comment: http://stackoverflow.com/comment/39368981
tagged with: java
answer count: 1
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39368888
type: Question
has comment: http://stackoverflow.com/comment/39369167
type: UnansweredQuestion

http://stackoverflow.com/comment/101670875
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25381063
has text: Thank you! JFTR: I've opened Settings > Languages & Frameworks > PHP. And then I clicked on the folder icon next to "Path mappings" > folder icon text to Remote Path. At this moment, Phpstorm tries to connect to a remote path and recreate the known_hosts file. Moreover, worth remembering: double-check the password entered in Settings > Languages & Frameworks > PHP > CLI Interpreter.
type: Comment

http://stackoverflow.com/q/25258876
has comment: http://stackoverflow.com/comment/39355594
tagged with: mocking
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25259107
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39357147
upvote count: 1
has answer: http://stackoverflow.com/a/25259107
has title: Mocking apache.commons.io.IOUtils class
favorite count: 0
type: Question
tagged with: powermock
tagged with: apache-commons-io
has body: I need to mock toByteArray() of apache.commons.io.IOUtils class. I've a code snippet like ths: PowerMockito.mockStatic(IOUtils.class); PowerMockito.when(IOUtils.toByteArray(any(InputStream.class))).thenReturn(mockByteArray); But I'm getting NullPointerException from org.apache.commons.io.IOUtils.copyLarge() function.
type: AnsweredQuestion

http://stackoverflow.com/a/25236837
has comment: http://stackoverflow.com/comment/39324574
has comment: http://stackoverflow.com/comment/39324518
has comment: http://stackoverflow.com/comment/39316795
has comment: http://stackoverflow.com/comment/39352269
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25236792
has comment: http://stackoverflow.com/comment/39324540
has comment: http://stackoverflow.com/comment/39314990
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/25236792
has comment: http://stackoverflow.com/comment/39317970
type: Answer
has comment: http://stackoverflow.com/comment/39314938
has comment: http://stackoverflow.com/comment/39316901
has comment: http://stackoverflow.com/comment/39324686
has body: if you use this code: java.sql.Blob blob=null; blob.setBytes(1, myByte ); blob is null. You have to create a new Blob Object like: Blob blob = new SerialBlob(myByte ); and then you can store it.

http://stackoverflow.com/comment/39319035
has text: Do you run the whole snippet in a loop? Looks to me that the for loop exits correctly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25239348
score: 0

http://stackoverflow.com/comment/39577227
comment on: http://stackoverflow.com/q/25376221
score: 0
type: Comment
type: QuestionComment
has text: I voted for your comment, but you should write an answer, because when you read pthread_once man (http://linux.die.net/man/3/pthread_once ), the behaviour explained is close to how with static initializers work.

http://stackoverflow.com/comment/39469049
has text: That's a huge bummer, and I'm not totally sure that I buy it.... How are other people able to make such apps then?
score: 0
comment on: http://stackoverflow.com/q/25276144
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25360962
score: 0
accepted answer of: http://stackoverflow.com/q/25360916
type: Answer
answers question: http://stackoverflow.com/q/25360916
type: AcceptedAnswer
has body: Add an @Deprecated annotation to that method and tell witch other classes to use in javadoc.

http://stackoverflow.com/a/25293319
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25287593
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39471627
has body: In your webapp's WEB-INF directory is a web.xml file. Your servlet container won't load the practiceServlet class, instantiate it, and initialize it as a servlet unless you declare it in web.xml like below. practice practiceServlet practice /practiceServlet In your jsp, adjust the relative url to be the url-pattern you used in the web.xml. <jsp:include page="/practiceServlet" flush="true"/>
answers question: http://stackoverflow.com/q/25287593
type: Answer
score: 2

http://stackoverflow.com/q/25278322
favorite count: 0
type: Question
has title: Share one set of read-only Table data across many users/sessions/UIs in Vaadin
tagged with: multithreading
answer count: 1
downvote count: 0
tagged with: vaadin7
has answer: http://stackoverflow.com/a/25301710
type: AnsweredQuestion
upvote count: 1
score: 1
tagged with: java
has body: I have a a set of read-only data to be displayed as a Table in instances of the same Layout across many user sessions. Rather than replicate the data for each user, I'd like to have only a single instance of the data in memory on my Vaadin server. My data is simple JavaBean objects, in a List, wrapped in a BeanItemContainer. ➤ Is it safe and proper to create a single List (of data beans) in a single BeanItemContainer, and then specify that one BeanItemContainer instance as the backing Container of many Table instances in many UI instances? The following is my plan for data updated every minute. I assume there is no way to ask for a list of active Layouts across the Vaadin server, so I'll have build my own weak collection. Each Layout registers itself through a synchronized static class method. Store the list of registered Layouts in a concurrent weak set. (Garbage-collected Layouts disappear from the set, so no need for them to unregister.) A single thread/executor on the Vaadin server: Detects fresh data from the data source. Builds a new BeanItemContainer, Goes through the list of registered Layouts. On each Layout, using Push, invoke the Vaadin access method to send a thread-safe message telling the Layout to switch its Table's old Container for the new Container. (When the last Layout replaces the old Container, the old Container becomes available for garbage-collection.) Is that approach not thread-safe? Perhaps I should make a single concurrent List of JavaBean data objects shared to all the Layouts, where each Layout makes its own BeanItemContainer wrapping the single concurrent List?
tagged with: vaadin
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/25301710

boolean
tags question: http://stackoverflow.com/q/25344956
tags question: http://stackoverflow.com/q/25355420
tags question: http://stackoverflow.com/q/25352728
tags question: http://stackoverflow.com/q/25356401
tags question: http://stackoverflow.com/q/25377102
tags question: http://stackoverflow.com/q/25254647
tags question: http://stackoverflow.com/q/25248687
tags question: http://stackoverflow.com/q/25360375
tag name: boolean
type: Tag

http://stackoverflow.com/comment/39347655
type: Comment
has text: @Puru-- maybe then you should extract your library into a web service and just deploy and use it locally. There will be overhead on calls and development costs. One other alternative would be RCP.
comment on: http://stackoverflow.com/q/25253711
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39436694
comment on: http://stackoverflow.com/q/25302612
type: Comment
score: 2
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
type: QuestionComment

http://stackoverflow.com/a/25369535
has comment: http://stackoverflow.com/comment/39559807
score: 7
type: AcceptedAnswer
downvote count: 0
upvote count: 7
has body: I see the problem as well using Java 8u11. I seem to remember this being filed as a known bug, but I can't seem to find it now. A solution that works for me is to add an intermediate step: public void actionPerformed(ActionEvent e) { tf.setText(" "); tf.setText(""); } I'm not sure why this is necessary, I think it's a bug with the setText() function specifically ignoring empty Strings. If somebody finds the filed bug there would be more information there.
accepted answer of: http://stackoverflow.com/q/25369221
type: Answer
answers question: http://stackoverflow.com/q/25369221

http://stackoverflow.com/comment/39304230
type: QuestionComment
comment on: http://stackoverflow.com/q/25231597
score: 0
has text: [`$min`](http://docs.mongodb.org/manual/reference/operator/aggregation/min/#grp._S_min) is an `aggregate` operator, not a `find` operator.
type: Comment

http://stackoverflow.com/a/25305934
answers question: http://stackoverflow.com/q/25305380
type: Answer
has body: Maintain a List&lt;Artist&gt; and override Artist#equals and Artist#hashCode to delegate only to Artist name. Then use List#contains to see if you need to add a new one or take the existing one. Finally make pics a List&lt;Pic&gt; as well so you can dynamically add Pics to your Artist. It's about code design choices, not about the SQL output.
score: 0

http://stackoverflow.com/a/25423980
type: Answer
has body: Regarding process management you can easily achieve your goal by mixing functionalities of Apache Commons Exec library which can help spawning new instances of workers with Apache Commons Pool library which will manage running instances. The implementation is really easy because commons pool will ensure that you can use one object at the time until it is returned to the pool. If object is not returned to the pool, commons pool will spawn new instance for you. You can controll lifetime of your workers either by adding watchdog service (from apache commons exec) - watchdog can kill an instance unused for some time or you can also use commons pool itself for example by calling pool.clearOldest(). You can also see how many requests are processed (how many workers are active) at the moment by calling pool.getNumActive(). Reffer to javadoc of GenericKeyedObjectPool to see more. The implementation can be done with one simple servlet running on Tomcat server. This servlet will instantiate the pool and simply ask the pool for new worker by calling pool.borowObject(parameters). Inside parameters you define what characteristics should have your worker to handle request (in your case parameters should include the language). In case no such worker is available (for example no worker for french langauge) pool will spawn new worker for you. Also if there is a worker but the worker is currently handling another request, pool will also spawn a new worker for you (so you will have two workers handling the same language). Worker will be back ready to handle new request when you call pool.returnObject(parameters, instance). The whole implementation took me less than 200 lines of code (see below for complete code). The code includes a situation when a worker process gets killed from outside or will crash (see WorkersFactory.activateObject()). IMHO: using Apache Cammel is not good option for you, because it too big tool and it is designed as a mediation bus between different messages for…
accepted answer of: http://stackoverflow.com/q/25259873
score: 5
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25259873
has comment: http://stackoverflow.com/comment/39663675
has comment: http://stackoverflow.com/comment/39765925
upvote count: 5

http://stackoverflow.com/a/25271867
answers question: http://stackoverflow.com/q/25271605
type: Answer
has body: First of all transient keyword is used along with instance variables to exclude them from serialization process. if a field is transient its value will not be persisted. The perfect use of Transient variable can be seen in Hibernate. For and example in you Database table there are only two column (name and surname) but in your POJO entity you are having three variable (name , surname and age) in this situation you can make Transient to age field and you can save your entity without any complain as age variable becomes as transient not going to persist.
score: 0

http://stackoverflow.com/comment/39443626
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25306555
has text: Please visit [How to Use Various Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/layoutlist.html) Try `GridBagLayout`
type: Comment

http://stackoverflow.com/comment/39496501
comment on: http://stackoverflow.com/a/25333844
type: Comment
has text: I assume all fields are correctly initialized after the constructor is done. Maybe I am wrong. Can you provide some code that shows the problem?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25312336
type: Answer
answers question: http://stackoverflow.com/q/25293507
has comment: http://stackoverflow.com/comment/39521433
upvote count: 2
has comment: http://stackoverflow.com/comment/39548403
has body: From the looks of your output, you are not executing with jybot/Jython. Jython is required to load Java classes in a Python interpreter. Here is what the output would look like if you were: PYTHONPATH: C:\apps\Python27\Lib\site-packages C:\apps\jython2.5.3\Lib\site-packages\setuptools-0.6c11-py2.5.egg C:\apps\jython2.5.3\Lib\site-packages\pip-1.2.1-py2.5.egg C:\apps\jython2.5.3\Lib __classpath__ __pyclasspath__/ C:\apps\jython2.5.3\Lib\site-packages . c:\ws\local CLASSPATH: C:\apps\jython2.5.3\jython.jar A word of caution: if you run the Robot Framework jar (e.g. java -jar robotframework-2.5.3.jar ...) as some examples suggest, all classpath settings are ignored. You would have to put all your dependencies in one jar for that way to work...
score: 2
downvote count: 0

http://stackoverflow.com/comment/39556776
type: Comment
has text: Yes, I implemented a "regular" file-upload with Ajax and selected files above 5MB which was no problem at all. However, if I record a video via html5 and append the resulting blob file (content-type = video/webm) manually to a FormData object, the file transfer doesn't want to work for files larger than 1MB. All other videos are correctly stored on the server. However, I'll continue my search, there must be a solution ;) Thank you for your effort!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25350893

http://stackoverflow.com/comment/39446153
type: Comment
comment on: http://stackoverflow.com/a/25268661
score: 0
type: AnswerComment
has text: The documentation appears to be wrong. Firewalls can't control source routing. You don't have any evidence that this is the most common symptom.

http://stackoverflow.com/a/25250287
has body: One (or both) of String Date or String Due is not 10 characters long, String chkMonth = Date.substring(0, 2); String chkDay = Date.substring(3, 5); String chkYear = Date.substring(6, 10); // &lt;-- Here //Stringing Due dates String lateMonth = Due.substring(0, 2); String lateDay = Due.substring(3, 5); String lateYear = Due.substring(6, 10); // &lt;-- and/or Here The easiest solution I can see is to add a check. String chkYear = (Date.length() &gt;= 10) ? Date.substring(6, 10) : ""; // ... String lateYear = (Due.length() &gt;= 10) ? Due.substring(6, 10) : ""; Also, Java naming conventions would be String date and String due. Your way Date and Due look like class names.
answers question: http://stackoverflow.com/q/25250197
type: Answer
score: 0

http://stackoverflow.com/q/25248855
has comment: http://stackoverflow.com/comment/39338215
score: -6
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25248990
duplicate of: http://stackoverflow.com/q/33278558
downvote count: 8
has comment: http://stackoverflow.com/comment/39336843
linked to: http://stackoverflow.com/q/33278558
type: UnansweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/39336751
has comment: http://stackoverflow.com/comment/39336781
has comment: http://stackoverflow.com/comment/39336771
has comment: http://stackoverflow.com/comment/39337109
upvote count: 2
answer count: 2
has title: Java The left-hand side of an assignment must be a variable
has comment: http://stackoverflow.com/comment/39336931
tagged with: java
has body: I got a problem here. I got error that The left-hand side of an assignment must be a variable. But i don't understand where is the problem. And btw there are a lot of JSONarrays, i just put one for an example. public class As { static JSONArray temp0=new JSONArray(); public static void main(String[] args) throws IOException { arrayValues(0)=new JSONArray(); //The left-hand side of an assignment must be a variable } public static JSONArray arrayValues(int ip) { switch (ip) { case 0: return temp0; } return null; } } Thank you guys
tagged with: variables
has answer: http://stackoverflow.com/a/25248904

http://stackoverflow.com/comment/39609100
has text: I will add comments to it :) I'm actually quiet intrigued with this question thank you
comment on: http://stackoverflow.com/a/25353331
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39576225
type: Comment
comment on: http://stackoverflow.com/a/25375523
has text: Yup, AOP is probably what you want. Alternately, you could provide your own message converters.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39529021
type: QuestionComment
comment on: http://stackoverflow.com/q/25353138
has text: +1 for "_don't need regex_"
score: 0
type: Comment

http://stackoverflow.com/comment/39424669
type: AnswerComment
has text: Ok, thanks a lot guys. I've been searching everywhere trying to find something similar, so that's why I had to give it a try here. I wasn't trying to get anyone to write it for me, just wanted to know what I was doing wrong. Now you guys have given me multiple options that I can try out. So thanks again for all your help. It's much appreciated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25295967

http://stackoverflow.com/a/25366355
has comment: http://stackoverflow.com/comment/39554687
has body: Change: Toast.makeText(this, String.valueOf("The perimeter of square is " + perimeter),Toast.LENGTH_LONG).show(); To: Toast.makeText(MainActivity.this, String.valueOf("The perimeter of square is " + perimeter),Toast.LENGTH_LONG).show(); this here refers to OnCheckedChangeListener which is not applicable with makeText(Context, CharSequence, int). MainActivty.this is the context.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25366309
score: 0
answers question: http://stackoverflow.com/q/25366309

http://stackoverflow.com/a/25288848
answers question: http://stackoverflow.com/q/25288226
downvote count: 0
has body: You could use JAXB to convert your Model A to XML. This leverages the Java first aspect of JAXB instead if the schema first in your question.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/25333119
has comment: http://stackoverflow.com/comment/39494123
tagged with: nullpointerexception
score: 0
tagged with: java
has body: Ok so the problem is this, when I use the code below, using ACCURACY_COARSE, everything works except the location is NOT accurate to where I am. // Creating a criteria object to retrieve provider Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); // Getting LocationManager object from System Service // LOCATION_SERVICE LocationManager locationManager = (LocationManager) getActivity().getApplicationContext() .getSystemService(LOCATION_SERVICE); // Getting the name of the best provider String provider = locationManager.getBestProvider(criteria, true); // Getting Current Location Location location = locationManager.getLastKnownLocation(provider); if (location != null) { onLocationChanged(location); } locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); // Get current location Latitude and Longitude double lat = location.getLatitude(); double lng = location.getLongitude(); But when i use this code i get a nullpointerexception from location.getLatitude(); // Creating a criteria object to retrieve provider Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); // Getting LocationManager object from System Service // LOCATION_SERVICE LocationManager locationManager = (LocationManager) getActivity().getApplicationContext() .getSystemService(LOCATION_SERVICE); // Getting the name of the best provider String provider = locationManager.getBestProvider(criteria, true); // Getting Current Location Location location = locationManager.getLastKnownLocation(provider); if (location != null) { onLocationChanged(location); } locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); // Get current location Latitude and Longitude double lat = location.getLatitude(); double lng = location.getLongitude(); The problem is on the line that sets the accuracy. When I use this I g…
has title: Google API v2 location.getLatitude() return nullpointerexception
type: Question
tagged with: google-maps-android-api-2
has comment: http://stackoverflow.com/comment/39494116
answer count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25333276
has answer: http://stackoverflow.com/a/25333301

http://stackoverflow.com/q/25271470
score: 0
tagged with: string-formatting
answer count: 2
has comment: http://stackoverflow.com/comment/39379049
tagged with: decimalformat
linked to: http://stackoverflow.com/q/25253121
has body: I want to format lengthy double numbers in my android calculator app 2 problems ... First is that I want to enable Grouping by 3 so 1200 would be shown 1,200 . But for numbers like 1000 what I get is 1, How can I get 1,000 for result ? also another problem is that I want Results with up to 25 integer digits and 4 decimal fraction digits ... but even though I set Decimalformat maximum to 25, after number of integers surpasses 18, Digits turn to be zeros. for example what I want is 1,111,111,111,111,111,111,111,111 but I get 1,111,111,111,111,111,110,000,000, Here's the code DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(4); df.setMaximumIntegerDigits(25); df.setGroupingUsed(true); df.setGroupingSize(3); String formatted = df.format(mResultBeforeFormatting); what pattern should I use ?
linked to: http://stackoverflow.com/q/13542944
type: Question
has title: Remove the last grouping separator when using DecimalFormat Grouping java
tagged with: android
tagged with: java
type: UnansweredQuestion
tagged with: formatting
has answer: http://stackoverflow.com/a/25288799
has comment: http://stackoverflow.com/comment/39409961
has answer: http://stackoverflow.com/a/25273271

http://stackoverflow.com/comment/39495829
type: Comment
comment on: http://stackoverflow.com/q/25334004
type: QuestionComment
score: 0
has text: Awesome - thanks all of you for the response. So in this case, are you saying I cant run genOutputSet from the class Test at all?

user-interface
tags question: http://stackoverflow.com/q/25338941
tags question: http://stackoverflow.com/q/25356401
tags question: http://stackoverflow.com/q/25340638
tags question: http://stackoverflow.com/q/25311938
tags question: http://stackoverflow.com/q/25352870
tags question: http://stackoverflow.com/q/25360886
tags question: http://stackoverflow.com/q/25326407
tags question: http://stackoverflow.com/q/25343252
tags question: http://stackoverflow.com/q/25284410
tags question: http://stackoverflow.com/q/25317268
tags question: http://stackoverflow.com/q/25319104
tags question: http://stackoverflow.com/q/25247519
tags question: http://stackoverflow.com/q/25343875
tags question: http://stackoverflow.com/q/25345105
tags question: http://stackoverflow.com/q/25333132
tags question: http://stackoverflow.com/q/25367688
tags question: http://stackoverflow.com/q/25248791
tags question: http://stackoverflow.com/q/25372124
tags question: http://stackoverflow.com/q/25299489
type: Tag
tags question: http://stackoverflow.com/q/25333624
tags question: http://stackoverflow.com/q/25232709
tags question: http://stackoverflow.com/q/25270240
tags question: http://stackoverflow.com/q/25297262
tags question: http://stackoverflow.com/q/25381293
tags question: http://stackoverflow.com/q/25363473
tags question: http://stackoverflow.com/q/25341801
tags question: http://stackoverflow.com/q/25266189
tags question: http://stackoverflow.com/q/25387122
tag name: user-interface
tags question: http://stackoverflow.com/q/25292465
tags question: http://stackoverflow.com/q/25256052
tags question: http://stackoverflow.com/q/25252127
tags question: http://stackoverflow.com/q/25342888
tags question: http://stackoverflow.com/q/25260954
tags question: http://stackoverflow.com/q/25372459
tags question: http://stackoverflow.com/q/25284104
tags question: http://stackoverflow.com/q/25381782
tags question: http://stackoverflow.com/q/25350468
tags question: http://stackoverflow.com/q/25324633

http://stackoverflow.com/comment/39550056
comment on: http://stackoverflow.com/q/25364587
score: 3
type: Comment
type: QuestionComment
has text: I think you are calling setMaximum() method from the thread where the task is going on. You should call it from EDT using SwingUtilities.invokeLater()

http://stackoverflow.com/a/38802038
score: 0
answers question: http://stackoverflow.com/q/25341182
type: Answer
has body: I installed JDK, "Java SE Development Kit 8u101", in addition to JRE and eclipse started to work fine.

http://stackoverflow.com/a/25338011
upvote count: 1
has body: In method B declaration You use the same generic type(E) for all three parameters. It meens that you may use a parameter of any kind (E) but it must be the same for all 3 parameters. Try adding another generic type(T) like this: public class Test { public static void main(String[] args) { String[] arr = new String[0]; MethodA(arr); } public static &lt;E&gt; void MethodA(E[] array) { Integer[] intArray = new Integer[0]; List&lt;E&gt; someList = new ArrayList&lt;E&gt;(); MethodB(array, intArray, someList); } public static &lt;E, T&gt; void MethodB(E[] array, T[] secondArray, List&lt;E&gt; list) { //Stuff } } Or if there is a need you can add third so that List does not require the E to be the same type as in E[] array.
type: Answer
answers question: http://stackoverflow.com/q/25336993
score: 1
downvote count: 0

http://stackoverflow.com/comment/39443727
comment on: http://stackoverflow.com/a/25305052
type: Comment
type: AnswerComment
score: 1
has text: @Jack you don't need a map with boolean, a simple set will suffice, once you add the identifier to the set it is marked as done.

http://stackoverflow.com/comment/39388828
comment on: http://stackoverflow.com/q/25276964
type: Comment
type: QuestionComment
has text: Theres a lot of questionable code here. First, `while(true)` doesn't do anything; you didnt give it a body. Second, you only initialized the inputstream on the server, but the input AND output stream on the client. I'm guessing that the client is waiting to initialize the stream that you didn't initialize on the server.
score: 0

http://stackoverflow.com/comment/39567336
type: Comment
type: AnswerComment
has text: hahah I don't know how I did not think of it. Simple enough, thank you very much (Will accept after 8 minutes)
comment on: http://stackoverflow.com/a/25373361
score: 0

http://stackoverflow.com/q/25318056
score: 1
tagged with: java
tagged with: sshj
has answer: http://stackoverflow.com/a/26099167
answer count: 1
has title: How do I make SSHJ initiate outbound SFTP on a non-standard port?
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has body: I'm doing this and it works fine but I'd like to be able to hit an sshd on a port other than 22. final SSHClient ssh = new SSHClient(); ssh.addHostKeyVerifier( SFTP_KEY_FINGERPRINT ); ssh.connect( SFTP_SERVER_HOSTNAME ); try { ssh.authPassword( SFTP_USER , SFTP_PASSWORD ); final String src = fileToFtp.getFileName().toString(); final SFTPClient sftp = ssh.newSFTPClient(); try { sftp.put(new FileSystemFile(src), "/"); success = true; } finally { sftp.close(); } } finally { ssh.disconnect(); }
tagged with: sftp

http://stackoverflow.com/q/25329879
answer count: 1
has comment: http://stackoverflow.com/comment/42978187
has answer: http://stackoverflow.com/a/27534354
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39488049
tagged with: java
score: 1
tagged with: eclipse
has title: Eclipse Luna + ADT -freeze 99% when running app on mac
favorite count: 0
has body: I was using Eclipse Luna + ADT, everything was fine, but today, when I try to run my project in my cel, it freezes to 99%, and then says: Unable to execute dex: GC overhead limit exceeded and then : Unhandled loop expected The only solution I find is go back to ADT Bundle ( w/ Kepler), but I don't love this solution as Eclipse is very outdate... Any help will be appreciated
has comment: http://stackoverflow.com/comment/39487700
tagged with: adt
downvote count: 0
has comment: http://stackoverflow.com/comment/39487510
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/25390922
score: -1
answers question: http://stackoverflow.com/q/25374403
upvote count: 0
has body: Have you tried upgrading your rxJava version? https://github.com/ReactiveX/RxJava/issues/957
downvote count: 1
has comment: http://stackoverflow.com/comment/39601933
has comment: http://stackoverflow.com/comment/39602467
type: Answer

http://stackoverflow.com/q/25338377
accepted answer: http://stackoverflow.com/a/25338511
has answer: http://stackoverflow.com/a/25338511
has title: java ee: class not found despite valid import?!
type: Question
has body: I use jersey to create some sort of RESTful API. To get information about the current request, I use the HttpServletRequest Object. I am able to compile the project without problems or errors, but when I run it, I get the following error: [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ backend --- [WARNING] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2570) at java.lang.Class.getDeclaredMethods(Class.java:1855) at org.glassfish.jersey.server.model.IntrospectionModeller$2.run(IntrospectionModeller.java:236) at java.security.AccessController.doPrivileged(Native Method) at org.glassfish.jersey.server.model.IntrospectionModeller.getAllDeclaredMethods(IntrospectionModeller.java:230) at org.glassfish.jersey.server.model.IntrospectionModeller.checkForNonPublicMethodIssues(IntrospectionModeller.java:170) at org.glassfish.jersey.server.model.IntrospectionModeller.doCreateResourceBuilder(IntrospectionModeller.java:118) at org.glassfish.jersey.server.model.IntrospectionModeller.access$000(IntrospectionModeller.java:80) at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:111) at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:108) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.processWithExcepti…
score: 0
answer count: 2
tagged with: jersey-2.0
has answer: http://stackoverflow.com/a/25338542
tagged with: maven
linked to: http://stackoverflow.com/q/6646959
tagged with: jakarta-ee
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25338542
tagged with: classnotfoundexception
tagged with: java

http://stackoverflow.com/q/25290213
tagged with: java
has answer: http://stackoverflow.com/a/25290312
answer count: 1
has comment: http://stackoverflow.com/comment/39413124
has comment: http://stackoverflow.com/comment/39414443
has title: TextView cannot be cast to SeekBar
tagged with: android-activity
type: Question
has comment: http://stackoverflow.com/comment/39414392
tagged with: android-layout
tagged with: parse-platform
tagged with: android
has body: I am experiencing issues relating my textview to my seekbar, and have received the below message as such. I am under the premises that it was due for the following reasons: 1) Trying to store the seekbar values information recorded by the user into parse to be able to retrieve it later. Storing the EditText such as name, age, headline and radiobox such as gender works fine, but its when I include the seek that the application fails to run. I have tried doing a project clean, and rewording ID with the "right prefix" such as sb for seekbar, and tv for textview. Below is the logcat message: update logcat posted below Below is the activity code public class ProfileCreation extends Activity { private static final int RESULT_LOAD_IMAGE = 1; FrameLayout layout; Button save; protected EditText mName; protected EditText mAge; protected EditText mHeadline; protected ImageView mprofilePicture; RadioButton male, female; String gender; RadioButton lmale, lfemale; String lgender; protected SeekBar seekBarMinimum; protected SeekBar seekBarMaximum; protected SeekBar seekBarDistance; protected Button mConfirm; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile_creation); RelativeLayout v = (RelativeLayout) findViewById(R.id.main); v.requestFocus(); Parse.initialize(this, "ID", "ID"); mName = (EditText)findViewById(R.id.etxtname); mAge = (EditText)findViewById(R.id.etxtage); mHeadline = (EditText)findViewById(R.id.etxtheadline); mprofilePicture = (ImageView)findViewById(R.id.profilePicturePreview); male = (RadioButton)findViewById(R.id.rimale); female = (RadioButton)findViewById(R.id.rifemale); lmale = (RadioButton)findViewById(R.id.rlmale); lfemale = (RadioButton)findViewById(R.id.rlfemale); seekBarMinimum = (SeekBar) findViewById(R.id.sbseekBarMinimumAge); seekBarMaximum = (SeekBar) findViewById(R.id.sbseekBarMaximumAge); seekBarDistance = (SeekBar) findViewById(R.id.tvseekBarDistanceValue); mConf…
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25290312

http://stackoverflow.com/q/25236002
linked to: http://stackoverflow.com/q/1721553
tagged with: file-io
has comment: http://stackoverflow.com/comment/39312989
tagged with: java
has answer: http://stackoverflow.com/a/25236119
has body: I have a text file which contains something like this - 23+3 i have to do the math and write the ans in a different text file. i have tried with scan.nextInt() method.but shows exception when scanning "+" any help here with ignoring the other chars ??
has comment: http://stackoverflow.com/comment/39312838
type: Question
linked to: http://stackoverflow.com/q/3422673
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25236058
type: UnansweredQuestion
has title: How to read integers from a file which have characters mixed with them in JAVA?

http://stackoverflow.com/a/25334689
type: Answer
answers question: http://stackoverflow.com/q/25334637
downvote count: 0
upvote count: 1
has body: Arrays.asList() doesn't create a new list, really. It gives you an object that acts like a List, but really just accesses the array. Since you can't make an array larger by adding elements to it, you can't append to this kind of list, either. Instead of phrases = Arrays.asList(s); try phrases = new ArrayList&lt;String&gt;(Arrays.asList(s)); which does create a new list, and initializes it by copying the elements of the array.
score: 1

mobile
tags question: http://stackoverflow.com/q/25381607
tags question: http://stackoverflow.com/q/25336293
type: Tag
tag name: mobile
tags question: http://stackoverflow.com/q/25320934
tags question: http://stackoverflow.com/q/25239983
tags question: http://stackoverflow.com/q/25341344
tags question: http://stackoverflow.com/q/25364002

http://stackoverflow.com/q/25244474
has comment: http://stackoverflow.com/comment/39338597
favorite count: 0
answer count: 4
tagged with: websphere
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29503523
tagged with: intellij-idea
has body: I'm using Intellij with WebSphere 8. When I run from within IDE the server works normally. When I try to run it in debug mode however, it fails with the following error: C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin\generated_websphere_server_start_script.cmd C:\IBM\WebSphere\AppServer\java\bin\java -Dfile.encoding=windows-1252 -classpath "C:\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.admin.client_8.5.0.jar;C:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.security.crypto.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\webSphereIntegration\lib\webSphereIntegration.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\JavaEE\lib\javaee-impl.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\lib\openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\webSphereIntegration\lib\specifics\webSphereClientImpl.jar" com.intellij.javaee.oss.process.JavaeeProcess 62847 com.intellij.j2ee.webSphere.agent.WebSphereAgent Error: JDWP agent already loaded - please check java command line options [2014-08-11 01:58:59,248] Artifact x.ear: Server is not connected. Deploy is not available. JVMJ9TI064E Agent initialization function Agent_OnLoad failed for library jdwp, return code -1 Detected server admin port: 8880 JVMJ9VM015W Initialization error for library j9jvmti26(-3): JVMJ9VM009E J9VMDllMain failed Detected server http port: 9080 Disconnected from server I tried almost everything I have no idea what the problem is. I did google it for several hours with no luck. Do anyone know what this all is about and how can it be fixed? Here is my server configuration:
downvote count: 0
has answer: http://stackoverflow.com/a/71302800
has comment: http://stackoverflow.com/comment/39357236
score: 6
accepted answer: http://stackoverflow.com/a/29503523
has title: Websphere works when run but fails when debug
possible better answer: http://stackoverflow.com/a/57007995
type: Question
has answer: http://stackoverflow.com/a/57007995
tagged with: java
has answer: http://stackoverflow.com/a/50759638
upvote count: 6

http://stackoverflow.com/q/25262377
tagged with: java
linked to: http://stackoverflow.com/q/7197268
accepted answer: http://stackoverflow.com/a/25283898
type: Question
has answer: http://stackoverflow.com/a/25283898
tagged with: spring-boot
has answer: http://stackoverflow.com/a/25266532
tagged with: maven
has answer: http://stackoverflow.com/a/25262889
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25266532
tagged with: spring-data-rest
answer count: 3
has body: I'm experimenting RESTful Web Services with Spring, my starting project is Spring's gs-rest-service. The project works fine, when I hit http://localhost:8080/greeting I get {"id":1,"content":"Hello, World!"}. The problem is when I added dependencies to spring-data-rest-core and spring-data-rest-webmvc in my pom.xml the application does not work any more. When I hit http://localhost:8080/greeting I get the following error: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Aug 12 12:27:28 CEST 2014 There was an unexpected error (type=Not Acceptable, status=406). Could not find acceptable representation When I remove the depndencies the application works fine again, what is causing this problem? Here is my pom.xml: 4.0.0 org.springframework gs-rest-service 0.1.0 org.springframework.boot spring-boot-starter-parent 1.1.5.RELEASE war <spring.version>4.0.5.RELEASE</spring.version> <spring.boot.version>1.1.4.RELEASE</spring.boot.version> <jdk.version>1.7</jdk.version> <jetty.version>8.1.8.v20121106</jetty.version> <spring.data.rest.version>2.1.2.RELEASE</spring.data.rest.version> org.springframework.boot spring-boot-starter-web ${spring.boot.version} org.springframework.data spring-data-rest-core ${spring.data.rest.version} org.springframework.data spring-data-rest-webmvc ${spring.data.rest.version} junit junit 3.8.1 test org.apache.maven.plugins maven-compiler-plugin 3.0 ${jdk.version} ${jdk.version} org.mortbay.jetty jetty-maven-plugin ${jetty.version}
has title: Dependency issue after adding spring-data-rest to gs-rest-service sample project

http://stackoverflow.com/comment/39487083
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25329064
type: AnswerComment
has text: If it was up to me, I'd use CLOB as well. But, I was asked to investigate options that don't do that by the powers above me :P

http://stackoverflow.com/a/25374650
answers question: http://stackoverflow.com/q/25370135
score: 1
type: Answer
has body: Use CardLayout, seen here, to change the form dynamically. Given the large number of alternatives, look for a hierarchical breakdown among the choices that might allow you to use two related controls, as shown here.
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25236869
has body: When you construct EulerianCirlsDirected with 26, your code expects that there will be 26 vertices and that they will all be touched by DFS. Replace EulerianCirlsDirected g1 = new EulerianCirlsDirected(26); g1.addEdge(6, 10); g1.addEdge(10, 6); with EulerianCirlsDirected g1 = new EulerianCirlsDirected(2); g1.addEdge(0, 1); g1.addEdge(1, 0); and it will work. Alternatively, check for this.sizeNeighbours(i) &gt; 0 every time you iterate from 0 to v. Twice in isConnected() and once in isEurlerianCycle()
score: 2
answers question: http://stackoverflow.com/q/25236331
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39333519
type: Answer
accepted answer of: http://stackoverflow.com/q/25236331
has comment: http://stackoverflow.com/comment/39338668

http://stackoverflow.com/q/25355268
has body: I know it is possible to access the id of a single object without actually loading the entity from the database. Is it possible to access all the ids in a lazy loaded collection without initializing the actual collection?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39536027
answer count: 0
type: UnansweredQuestion
downvote count: 0
has title: Accessing IDs only in a Lazy Loaded Collection
score: 2
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39500834
type: Comment
comment on: http://stackoverflow.com/q/25336770
score: 2
type: QuestionComment
has text: Or better yet, the new [java.time](http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) API (if you're using Java 8). Or if you can't, use JodaTime. Days aren't always 24 hours. Months aren't always 30 days. And the original date/time/calendar classes (and related formatters/parsers) had lots of issues.

ms-access-2007
tag name: ms-access-2007
tags question: http://stackoverflow.com/q/25261785
tags question: http://stackoverflow.com/q/25280300
type: Tag

http://stackoverflow.com/comment/39541449
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25359024
has text: @ Bruno Lowagie I have to generate only one page for one individual. can You please modify my code by which it supported watermark . Thanks in advance

http://stackoverflow.com/q/25369407
has title: How to retrieve a value from a list of keys/values separated by pipes?
possible better answer: http://stackoverflow.com/a/25369504
upvote count: 1
has comment: http://stackoverflow.com/comment/39560057
has comment: http://stackoverflow.com/comment/39559709
favorite count: 0
type: Question
answer count: 5
has body: I have a string like: String s = "a=xxx|b = yyy|c= zzz" I am trying to write a function that returns the value corresponding to a given key but it does not work as expected (it returns an empty string): static String getValueFromKey(String s, String key) { return s.replaceAll(key + "\\s*=\\s*(.*?)(\\|)?.*", "$1"); } Test: static void test() { String s = "a=xxx|b = yyy|c= zzz"; assertEquals(getValueFromKey(s, "a"), "xxx"); assertEquals(getValueFromKey(s, "b"), "yyy"); assertEquals(getValueFromKey(s, "c"), "zzz"); } What regex do I need to pass the tests?
has answer: http://stackoverflow.com/a/25369518
downvote count: 0
has answer: http://stackoverflow.com/a/25369504
has answer: http://stackoverflow.com/a/25370401
accepted answer: http://stackoverflow.com/a/25370401
tagged with: regex
has answer: http://stackoverflow.com/a/25369571
has comment: http://stackoverflow.com/comment/39559768
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25369674
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39559723

http://stackoverflow.com/a/25272687
has comment: http://stackoverflow.com/comment/67645131
has comment: http://stackoverflow.com/comment/67735880
downvote count: 0
type: Answer
score: 31
has comment: http://stackoverflow.com/comment/67732027
upvote count: 31
type: AcceptedAnswer
has body: You have to define no-args or default constructor if you are creating your own constructor. You can read why default or no argument constructor is required here: Why default or no argument constructor is important in Java class?
answers question: http://stackoverflow.com/q/25272543
accepted answer of: http://stackoverflow.com/q/25272543

http://stackoverflow.com/comment/39534963
type: QuestionComment
has text: What's the exception?
score: 0
comment on: http://stackoverflow.com/q/25356493
type: Comment

http://stackoverflow.com/q/25368049
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25368796
downvote count: 0
has title: Custom memory allocation inside JNI native function
upvote count: 1
favorite count: 0
type: Question
tagged with: memory-management
has body: I need to allocate array of bytes inside JNI C-function. Then transmit this array into Java code as a byte[] object. I know there is a function NewByteArray, but it takes as input only size of byte array, so I can’t use custom memory allocation functions. In my case I need to use very specific nonstandard malloc-like allocation function from Linux. There should be no additional copying because of very limited resources.
accepted answer: http://stackoverflow.com/a/25368796
tagged with: java-native-interface
possible better answer: http://stackoverflow.com/a/25368202
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/25368202
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/comment/39521058
score: 0
type: QuestionComment
has text: no idea about javacv (why arent you using opencv's own java bindings?) but you either have to pass an *empty* Mat for varidx and sampleidx , or one that has the same shape as the labels. (also, using an svm might give better results)
type: Comment
comment on: http://stackoverflow.com/q/25348334

set
tags question: http://stackoverflow.com/q/25279033
tag name: set
tags question: http://stackoverflow.com/q/25306967
tags question: http://stackoverflow.com/q/25386928
type: Tag
tags question: http://stackoverflow.com/q/25304580

http://stackoverflow.com/q/25365667
tagged with: regex
has answer: http://stackoverflow.com/a/25365706
answer count: 4
tagged with: replace
possible better answer: http://stackoverflow.com/a/25365691
type: Question
has answer: http://stackoverflow.com/a/25365691
upvote count: 3
tagged with: url
downvote count: 0
tagged with: string
has title: Java dot doesn't match 'any character'
has answer: http://stackoverflow.com/a/25365727
has comment: http://stackoverflow.com/comment/39551974
favorite count: 0
has comment: http://stackoverflow.com/comment/39552027
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25365703
has body: Dot should match any character. So why doesn't this regex work? String url = "http://wikipedia.org"; System.out.println(url.replace("htt.://", "")); Output: http://wikipedia.org
tagged with: java
has answer: http://stackoverflow.com/a/25365703

http://stackoverflow.com/q/25259760
tagged with: jax-rs
type: Question
has title: @Consumes(MediaType.APPLICATION_FORM_URLENCODED) FormParameter is null
answer count: 2
tagged with: jersey
has body: I've created a Jersey webservice that looks like this: @Path("/webhookservice") public class Webhook { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response readData(@FormParam("payload") Payload payload, @Context HttpServletRequest req) { // Gets client IP address String ipAddress = (req.getRemoteHost().equals("") || req.getRemoteHost() == null) ? "UNKNOWN" : req.getRemoteHost(); // Persist data to DB Persist.saveToDb(payload.getId(), Integer.toString(payload.getTimestamp()), payload.getStatus(), payload.getAuth_code(), payload.getTotal_amount(), payload.getRequired_amount(), ipAddress); // Repsond with a HTTP 200 OK Response response = Response.status(200).build(); return response; } @GET @Produces("text/plain") public String testService() { return "Service is up and working!"; } } The Payload class looks like this: @XmlRootElement public class Payload { private String id; private int timestamp; private String status; private String auth_code; private int total_amount; private int required_amount; // Getters @XmlElement(name = "id") public String getId() { return this.id; } @XmlElement(name = "timestamp") public int getTimestamp() { return this.timestamp; } @XmlElement(name = "status") public String getStatus() { return this.status; } @XmlElement(name = "auth_code") public String getAuth_code() { return this.auth_code; } @XmlElement(name = "total_amount") public int getTotal_amount() { return this.total_amount; } @XmlElement(name = "required_amount") public int getRequired_amount() { return this.required_amount; } // Setters public void setId(String id) { this.id = id; } public void setTimestamp(int timestamp) { this.timestamp = timestamp; } public void setStatus(String status) { this.status = status; } public void setAuth_code(String auth_code) { this.auth_code = auth_code; } public void setTotal_amount(int total_amount) { this.total_amount = total_amount; } public void setRequired_amount(int required_amount) { this.required_amount = required_amo…
downvote count: 0
tagged with: web-services
tagged with: http
has answer: http://stackoverflow.com/a/25259955
has answer: http://stackoverflow.com/a/25259960
possible better answer: http://stackoverflow.com/a/25259955
favorite count: 0
accepted answer: http://stackoverflow.com/a/25259960
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/25367261
has comment: http://stackoverflow.com/comment/39555255
favorite count: 0
has body: I am trying to use HikariCP connection pool. I was able to get it to work and get a connection that I could use. I am not sure what is the best approach for returning the connection to the pool. I have the following questions: Should I close the connection when I am done, rely on idleTimeout and maxLifetime settings or is there another call that I can use so as not to hog the connections from the pool? If I close the connections (instead of returning to the pool), would that not result in additional connection objects being created to meet the requirements of the connection pool size? Looking for helpful suggestions.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25367496
tagged with: java
upvote count: 32
score: 32
has title: Best approach for returning connection objects to HikariCP pool
type: Question
accepted answer: http://stackoverflow.com/a/25367496
tagged with: hikaricp
tagged with: connection-pooling
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25269740
accepted answer of: http://stackoverflow.com/q/25269247
answers question: http://stackoverflow.com/q/25269247
upvote count: 2
type: Answer
score: 2
has body: StackPane lays out its child Nodes according just to the alignment property of the StackPane itself: the layoutX and layoutY of the Node are basically ignored. The default value of the alignment property is CENTER. Your best solution here is just to use a Pane instead of a StackPane. You could also potentially solve this by setting the translateX property of the images to be placed in the StackPane. However, note that such transforms are not included in layout calculations, so you introduce the possibility of pushing the cards out of the visible bounds of the StackPane.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39461680
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25316184
has text: Just to make myself feel better, I feel I must tell you I've been doing Java for about 7 years and have been doing bit-manipulation for 3... I guess this is just a brain fart syntax error.

http://stackoverflow.com/q/25342528
downvote count: 4
has title: Random background color in a loop (Java)
accepted answer: http://stackoverflow.com/a/25342781
has comment: http://stackoverflow.com/comment/39510763
upvote count: 0
score: -4
type: AnsweredQuestion
tagged with: java
has body: I want to change the background color of a panel each time repaint() is called. I'm having a hard time doing it with setBackground, so I wonder if a drawRect with the same dimensions as the frame will do the same job, or is this a no-no? public class Artwork extends JPanel implements Runnable { boolean running = false; Random rng = new Random(); public Artwork() { this.setOpaque(true); } public void Start() { running = true; Thread thread = new Thread(this); thread.start(); } public void Stop() { running = false; } public void run() { while (running = true) { repaint(); try { Thread.sleep(2500); } catch (InterruptedException e) { e.printStackTrace(); } } } public void paintComponent(Graphics g) { super.paintComponent(g); super.setBackground(randomColor()); } public Color randomColor() { int r = rng.nextInt(255); int g = rng.nextInt(255); int b = rng.nextInt(255); return new Color(r, g, b); } With this the background color changes rapidly regardless of Thread.sleep
answer count: 1
has answer: http://stackoverflow.com/a/25342781
favorite count: 0
type: Question

http://stackoverflow.com/comment/39527882
type: QuestionComment
score: 0
has text: Also, update your question with error you are getting.
comment on: http://stackoverflow.com/q/25352393
type: Comment

http://stackoverflow.com/comment/39386959
comment on: http://stackoverflow.com/q/25275821
has text: did you relate your fragment in the layout with its main activity?
score: 0
type: Comment
type: QuestionComment

static-libraries
tag name: static-libraries
tags question: http://stackoverflow.com/q/25247164
type: Tag

http://stackoverflow.com/q/25236140
has body: I have a pre-made json file that I want to test out. This Json file will be modified so I want to read/write. I noticed that internal is read-only. So I want to save my Json file in the local storage(manually through eclipse or OS(windows 8)) such that I can access through files.local(). Does anyone know the address of the local storage defined by libgdx? So that I can save my pre-made Json file? This is for testing only! If there is a better way for me to test out my json file (read/write) please help me! Thank you!
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/25238939
has title: Where can I access Gdx.files.local()?
has comment: http://stackoverflow.com/comment/39317936
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25238939
type: Question
upvote count: 2

http://stackoverflow.com/a/25356597
has comment: http://stackoverflow.com/comment/39535404
has comment: http://stackoverflow.com/comment/39535986
downvote count: 0
has body: You need to use UserEnvironment and get the path for this user. int userId = UserHandle.myUserId(); sCurrentUser = new UserEnvironment(userId); This code stolen from Environment.java and the code they use to initialize their internal user.
upvote count: 1
answers question: http://stackoverflow.com/q/25356545
type: Answer
has comment: http://stackoverflow.com/comment/39535366
has comment: http://stackoverflow.com/comment/39535222
score: 1

http://stackoverflow.com/q/25320409
type: Question
accepted answer: http://stackoverflow.com/a/25320565
upvote count: 2
has body: When I deployed and I have received 'permgen' error for my JSF Web application. Detail are : JBOSS AS 7, jvm: Oracle JRE 1.7, OS: Amazon Linux 32-bit, 1.7 GB RAM. Exception is : javax.servlet.ServletException : PermGen space javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) ...
has answer: http://stackoverflow.com/a/25320565
downvote count: 0
tagged with: amazon-web-services
has title: Getting 'permgen error' while deploying war file on AWS
favorite count: 0
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18143155
tagged with: java
answer count: 1
tagged with: jboss
has comment: http://stackoverflow.com/comment/39469527

http://stackoverflow.com/a/25354201
score: 0
answers question: http://stackoverflow.com/q/25348008
has body: If your XPath isn't working that means that your selector cannot be found in the document. When you look a the article in your browsers sometimes things aren't always as they seem. Remember that when you look at it in the browser JavaScript is being executed and many times that means rearranging or adding elements to the DOM. Your XPath query is a bit specific and you might have better luck making it a bit more relaxed so if one &lt;div&gt; tag is missing it wont break the entire thing. Expecially when using xpaths in HTML you should rely more on the id and class attributes. I think your trying to get the page title which is directly under the element with id mediaarticlehead. Using this xpath //*[@id="mediaarticlehead"]/div/h1. However all this to get a article title when the W3C already solved this problem with &lt;meta&gt; tags :). Check out in the &lt;head&gt; of the document and you will find the title, description and likely a link to an image for the article.
type: Answer
has comment: http://stackoverflow.com/comment/39544816

http://stackoverflow.com/q/25388419
downvote count: 1
favorite count: 0
tagged with: jbutton
has comment: http://stackoverflow.com/comment/39596253
has comment: http://stackoverflow.com/comment/39596433
tagged with: imageicon
has title: Adding images to JButtons
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39607977
has comment: http://stackoverflow.com/comment/39596504
type: Question
has comment: http://stackoverflow.com/comment/39596331
has answer: http://stackoverflow.com/a/25388445
tagged with: jframe
upvote count: 0
type: UnansweredQuestion
answer count: 1
has body: I want to add images to my JButtons. I have tried to add the rollover icon command to one of my buttons, but I keep getting an exception even though eclipse doesn't say that there are any errors. I have saved the images in workspace/projectname/src where the class files are, and they are called a and b, and they are JPEG images. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class button extends JFrame { private static final long serialVersionUID = 1L; private JButton hi; private JButton custom; public button() { super("The title"); setLayout(new FlowLayout()); hi = new JButton("Hi button"); Icon a = new ImageIcon(getClass().getResource("a.JPEG")); Icon b = new ImageIcon(getClass().getResource("b.JPEG")); custom = new JButton("custom", a); custom.setRolloverIcon(b); add(custom); add(hi); HandlerClass handler = new HandlerClass(); hi.addActionListener(handler); custom.addActionListener(handler); } private class HandlerClass implements ActionListener { public void actionPerformed(ActionEvent event) { JOptionPane.showMessageDialog(null, String.format("%s", event.getActionCommand())); } } } import javax.swing.JFrame; public class buttonm { public static void main(String[] args) { button hello = new button(); hello.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); hello.setSize(350,100); hello.setVisible(true); } }
tagged with: swing
linked to: http://stackoverflow.com/q/3988788

http://stackoverflow.com/a/25256679
type: AcceptedAnswer
downvote count: 0
has body: Here's a relatively easy method to do this. Throw a GridView into your layout, setting the stretch mode to stretch the column widths, set the spacing to 0 (or whatever you want), and set the number of columns to 2: <?xml version="1.0" encoding="utf-8"?> <GridView android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="match_parent" android:verticalSpacing="0dp" android:horizontalSpacing="0dp" android:stretchMode="columnWidth" android:numColumns="2" /> and refer this to know more about GridView and ImageView
accepted answer of: http://stackoverflow.com/q/25256399
type: Answer
answers question: http://stackoverflow.com/q/25256399
score: 4
has comment: http://stackoverflow.com/comment/39431703
upvote count: 4

http://stackoverflow.com/q/25259707
tagged with: spring
tagged with: aop
linked to: http://stackoverflow.com/q/16955588
has body: We have a class with "special" fields. The field type is String, but it can take only a set of defined values. The values it can take on are specified by "type" and each type has a set of defined values. For instance, class MyClass { // Special Field of "TypeA" String zimbra; } zimbra can be assigned only a set of values - "ValueA1, ValueA2, etc." If zimbra is of "TypeB", it can be assigned - "ValueB1, ValueB2, etc." The types and values are configured in a persistent store. We would like to validate the field value assignments. This can be done using Observer pattern or property field change listener. But we would like to simplify it using AOP (Spring annotations or AspectJ). Please suggest if AOP can be used as a solution here.
has title: java: Field change notification using AOP
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39438964
has answer: http://stackoverflow.com/a/25261506
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39541759
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25356192
has text: just to get clear, message to live for 10 secs in queue right ?

http://stackoverflow.com/a/72432691
score: 1
has body: This is actually a limitation of JDK. Since the JDK-4724038 which tracks this problem (even though it is marked an enhancement) in JDK says that invoking the cleanup method directly is strongly advised against (also, that the Unsafe class might go away in some future version of JDK), the only workaround seems to be to call the GC. If using the try-with-resources for the file, that would look like this: try (RandomAccessFile file = new RandomAccessFile(filePath, "rw")) { MappedByteBuffer buffer = file.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, 128); // Do something buffer.putInt(4); } System.gc(); // has to be called outside the try-with-resources block I created https://github.com/vladak/RandomAccessFileTrap to demonstrate this - take a look at the detail of a build in the Github actions tab for this repository to see the actual results.
answers question: http://stackoverflow.com/q/25238110
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/138230616
type: Answer

http://stackoverflow.com/comment/39415990
type: QuestionComment
comment on: http://stackoverflow.com/q/25291159
has text: Which is why my mind is boggled. What really confuses me is that I am able to connect via SQL workbench, but not through java
score: 0
type: Comment

exception
tags question: http://stackoverflow.com/q/25297355
tags question: http://stackoverflow.com/q/25381511
tags question: http://stackoverflow.com/q/25260942
tags question: http://stackoverflow.com/q/25270502
tags question: http://stackoverflow.com/q/25278137
tags question: http://stackoverflow.com/q/25312084
tags question: http://stackoverflow.com/q/25233783
tags question: http://stackoverflow.com/q/25364338
tags question: http://stackoverflow.com/q/25322189
tags question: http://stackoverflow.com/q/25330169
tags question: http://stackoverflow.com/q/25318925
tags question: http://stackoverflow.com/q/25379374
tags question: http://stackoverflow.com/q/25251595
tags question: http://stackoverflow.com/q/25303232
tags question: http://stackoverflow.com/q/25327229
tags question: http://stackoverflow.com/q/25358836
tags question: http://stackoverflow.com/q/25266156
tags question: http://stackoverflow.com/q/25277286
tags question: http://stackoverflow.com/q/25237973
tags question: http://stackoverflow.com/q/25355379
tag name: exception
tags question: http://stackoverflow.com/q/25332633
tags question: http://stackoverflow.com/q/25296906
tags question: http://stackoverflow.com/q/25337033
tags question: http://stackoverflow.com/q/25254934
tags question: http://stackoverflow.com/q/25262994
tags question: http://stackoverflow.com/q/25283713
type: Tag
tags question: http://stackoverflow.com/q/25327445
tags question: http://stackoverflow.com/q/25239108
tags question: http://stackoverflow.com/q/25279312
tags question: http://stackoverflow.com/q/25341870
tags question: http://stackoverflow.com/q/25322328
tags question: http://stackoverflow.com/q/25335269
tags question: http://stackoverflow.com/q/25363689
tags question: http://stackoverflow.com/q/25259165
tags question: http://stackoverflow.com/q/25257654

http://stackoverflow.com/q/25293615
tagged with: roles
tagged with: java
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25318521
has answer: http://stackoverflow.com/a/25318521
has title: Roles vs ACLs in spring
tagged with: spring
type: AnsweredQuestion
has body: The Question is should I use roles with object scopes or just use ACLs Here is the use case, Lets say I want a User to have CRUD permissions on a companyA but only have Read permission on companyB. Now I can implement this in two ways. Method #1) Create two Roles 1) ROLE_ADMIN : A user in this role will have all CRUD permissions with respect to any company. 2) ROLE_SUPPORT : A user in this role has only read permissions at class (company) level e Now I can say, UserA--> has ROLE_ADMIN --on CompanyA UserA--> has ROLE_SUPPPORT --on CompanyB. Note: Here I am not putting any permissions on the object. Method #2) Have only one Role [Administrator] and I can say UserA--> has CRUD permissions --on CompanyA UserA--> has R[Read] permissions--on CompanyB I am not sure which method is preferred and why. In the method #2) I see no value in Role as permissions are defined on object anyway. The only case I see it make sense is for CREATE. User would not know upfront if he allowed to create as the object does not exist by then. In method 2, I would not need any multiple roles. but it does not sound right. So now why should I use method #2 when I can do the same thing using method 1. looking fwd to hear from you. thanks Paul
score: 0
tagged with: acl

http://stackoverflow.com/a/25342565
answers question: http://stackoverflow.com/q/25342435
score: 0
accepted answer of: http://stackoverflow.com/q/25342435
has body: You need to create a custom Object that contains the ID and the display text in the same Object. Then the combo box can display one value but your program can use another value. There are two basic approaches for accomplishing this: Create a custom renderer. See: Combobox With Renderer Use the toString() method of your custom Object. See Combobox With Hidden Data Most people would suggest the renderer approach is better, just don't forget about the KeySelectionManager.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/39526815
score: 1
type: Comment
has text: @ElliottFrisch The java version is the one bundled in OS X (I don't *believe* it has debug). At this time, I only have my mac available for testing. Juggling Java versions in the past has caused some headaches and I'm hesitant to do it off hand (though I'm curious about the result for other VMs on other platforms). The full benchmarking suite is 3x larger than this one (I don't want to paste 180 lines of code when 60 will demonstrate it) and I do consider other empty string tests: http://chat.stackexchange.com/transcript/message/17193796#17193796 (and non-trivial problems are the fun ones)
type: AnswerComment
comment on: http://stackoverflow.com/a/25351833

http://stackoverflow.com/comment/39597263
type: Comment
score: 0
type: AnswerComment
has text: And how can I use such a connection along with BigQuery API client? Actually I retry the request if it fails, however, I would like to extend the timeout anyway.
comment on: http://stackoverflow.com/a/25387064

http://stackoverflow.com/a/25235928
has comment: http://stackoverflow.com/comment/39312748
downvote count: 1
has comment: http://stackoverflow.com/comment/39312720
answers question: http://stackoverflow.com/q/25235854
type: Answer
upvote count: 2
has body: You can use this regex to match all word with spaces or none. sample: Pattern p = Pattern.compile("([a-zA-Z ]+)");
score: 1

http://stackoverflow.com/comment/39550671
score: 1
type: Comment
type: QuestionComment
has text: Your question title does nothing whatsoever to tell us what your question is about. Some grammar would also help.
comment on: http://stackoverflow.com/q/25364923

http://stackoverflow.com/comment/39559955
score: 0
has text: I don't want to use an enum.
comment on: http://stackoverflow.com/q/25369541
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39620903
type: AnswerComment
score: 0
has text: Modified your code a little bit, you found a good trick, but as you mentioned, it requires to code in Java. So, if I have to code a part of that in Java, then I don't need Nashorn with "tricks" at all :). It's obviously "no-question" implementation in Java, Scala, Groovy, etc. But I'm disappointed, that there is a scripting language which comes with JDK, and it'll be very useful to use just a text editor and scratch something there and run it from console, but there is no obvious way to script basic things!
type: Comment
comment on: http://stackoverflow.com/a/25381827

http://stackoverflow.com/comment/39315670
type: Comment
type: AnswerComment
has text: Thank you so much, exactly what I needed! I'll make sure to check with the website devs on their irc, thanks for letting me know.
score: 0
comment on: http://stackoverflow.com/a/25237275

http://stackoverflow.com/comment/39339393
score: 0
comment on: http://stackoverflow.com/q/25250025
type: Comment
type: QuestionComment
has text: Perhaps you could add the stacktrace to the question...

http://stackoverflow.com/comment/42178460
type: QuestionComment
has text: Unfortunately not yet....
score: 0
comment on: http://stackoverflow.com/q/25335495
type: Comment

http://stackoverflow.com/q/25306271
type: AnsweredQuestion
tagged with: proxy
has comment: http://stackoverflow.com/comment/39447059
tagged with: cglib
tagged with: spring
has comment: http://stackoverflow.com/comment/39447548
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/39444574
has body: I have mixed stack: EJB and Spring. For autowiring Spring to EJBs I use SpringBeanAutowiringInterceptor (not sure if that could affect the problem I have). Whlie trying to autowire beans in a following way: @Scope(proxyMode=ScopedProxyMode.TARGET_CLASS, value="singleton") @Repository public class ClassA imlpements IfA { ... } @Scope(value="singleton") @Repository public class ClassB { @Autowired private ClassA classA; ... } I get error: Could not autowire field: private ClassA ClassB.classA; nested exception is java.lang.IllegalArgumentException: Can not set ClassA field ClassB.classA to com.sun.proxy.$Proxy257. Please see server.log for more details. As far as I've understood, the problem is that JDK proxies are used (as ClassA implements interface IfA), while I'd need cglib ones. But I don't get it. Based on the docs, the annotation: @Scope(proxyMode=ScopedProxyMode.TARGET_CLASS, should do the job here. Well and it's not an option for me to use interfaces (as a field type). Any idea how to force cglib proxying here? EDIT: Not sure if it's relevant, but I'm running glassfish 3.1.x. And stacktrace (partial, as I can't expose all the class names here: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'classB': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ClassA ClassB.classA; nested exception is java.lang.IllegalArgumentException: Can not set ClassA field ClassB.classA to com.sun.proxy.$Proxy257. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) at org.springframework.beans.factory.support.AbstractAutowireCapableB…
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25307365
has answer: http://stackoverflow.com/a/25307365
has title: spring - forcing cglib proxies for @Autowired fields
favorite count: 0
type: Question

timer
tags question: http://stackoverflow.com/q/25293459
tag name: timer
tags question: http://stackoverflow.com/q/25271830
tags question: http://stackoverflow.com/q/25342872
tags question: http://stackoverflow.com/q/25334661
tags question: http://stackoverflow.com/q/25345171
tags question: http://stackoverflow.com/q/25297741
tags question: http://stackoverflow.com/q/25280016
tags question: http://stackoverflow.com/q/25256988
tags question: http://stackoverflow.com/q/25332168
tags question: http://stackoverflow.com/q/25350178
type: Tag
tags question: http://stackoverflow.com/q/25314562
tags question: http://stackoverflow.com/q/25296718
tags question: http://stackoverflow.com/q/25355611
tags question: http://stackoverflow.com/q/25352888
tags question: http://stackoverflow.com/q/25301333
tags question: http://stackoverflow.com/q/25257654
tags question: http://stackoverflow.com/q/25338090

spring-data-jpa
tags question: http://stackoverflow.com/q/25247863
tags question: http://stackoverflow.com/q/25311978
tags question: http://stackoverflow.com/q/25289275
tags question: http://stackoverflow.com/q/25266248
tags question: http://stackoverflow.com/q/25269596
type: Tag
tags question: http://stackoverflow.com/q/25237664
tag name: spring-data-jpa
tags question: http://stackoverflow.com/q/25362540
tags question: http://stackoverflow.com/q/25380984

http://stackoverflow.com/comment/39487178
type: Comment
comment on: http://stackoverflow.com/a/25329575
score: 0
type: AnswerComment
has text: @GPI There isn't enough context in his description to know if thread-safety is a concern. If all of that is happening in a method and none of it escapes the method, thread-safety may not be of any consequence. Using your own wrapper, or one provided by the JDK or one provided by some other library, all of those are options of course.

http://stackoverflow.com/a/25339229
answers question: http://stackoverflow.com/q/25339072
has comment: http://stackoverflow.com/comment/39518687
type: Answer
accepted answer of: http://stackoverflow.com/q/25339072
has comment: http://stackoverflow.com/comment/40215057
score: 0
has body: You could give the user a choice of connections for instance AutomaticConnection, LongRunningConnection, UnmanagedConnection. The AutomaticConnection could perhaps work like your current connection closing them after a default amount of time. For the LongRunningConnection you could make the user provide a long indicating the number of miliseconds they expect to be using the connection before it being automatically closed. Finally for the UnmanagedConnectionthe users would have the responsibility of calling close themselves. Perhaps you could also reset the timer based on when the Connection's methods were called.
type: AcceptedAnswer

http://stackoverflow.com/a/25296023
score: 0
has comment: http://stackoverflow.com/comment/39425243
has comment: http://stackoverflow.com/comment/39425343
upvote count: 1
answers question: http://stackoverflow.com/q/25295756
has comment: http://stackoverflow.com/comment/39425019
downvote count: 1
has comment: http://stackoverflow.com/comment/39427346
has comment: http://stackoverflow.com/comment/39427373
has comment: http://stackoverflow.com/comment/39424749
type: Answer
has comment: http://stackoverflow.com/comment/39428239
has body: This is an example of synchronization with no affect. First of all, it is unlikely you will need to synchronize on String, it is immutable after all, therefore, you don't need it to perform anything asynchronously. Second, you are likely to be synchronizing on the incorrect object anyways, no correctly written program would use String as a synchronization lock. Third and finally, s is a local variable. In fact, it holds exactly the same pattern that JCIP specifically tells you not to use if you inline it: synchronized (new Object()) { // ... } This is synchronization without effect, as it does not guarantee the purpose of the synchronized keyword: serialized access, lock and release semantics that require that only one thread execute the synchronized block at any given time. Because of this, each thread will have their own lock - not good.
has comment: http://stackoverflow.com/comment/39429044
has comment: http://stackoverflow.com/comment/39425085
has comment: http://stackoverflow.com/comment/39424897

http://stackoverflow.com/comment/39336813
type: Comment
comment on: http://stackoverflow.com/a/25247905
has text: Well first of all you didn't mention in your question that performance is an issue. Second, how big of a file are we talking about? If you are in the 10's of thousands of lines then buffered classes will do better yes.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/125381452
score: 0
comment on: http://stackoverflow.com/a/25284911
type: AnswerComment
has text: I implemented this version but didn't manage to get the same results as all online CRC8 calculators. Did I miss something ?
type: Comment

http://stackoverflow.com/q/25239777
has comment: http://stackoverflow.com/comment/39319812
tagged with: angularjs
has answer: http://stackoverflow.com/a/25239909
tagged with: javascript
has title: UI Bootstrap (AngularJS) modal is not working
has comment: http://stackoverflow.com/comment/39319702
tagged with: angular-ui-bootstrap
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25239909
tagged with: java
answer count: 1
has body: I have this practice project that I am working on, but I cant get my UI Boostratp modal working. Using example from the site https://github.com/angular-ui/bootstrap/tree/master/src/modal I have been trying to implement this feature but without success. I believe that this is because of that I do not have the knowledge to integrate demo code to my MVC style project (I have separate app.js, controller, and service files), and this one file example is rather confusing to me. My folder/file structure: Now, I have tried various things, including making a separate controller, and separate view for modal content (that's why I have bookDetailes.html and bookDetailesConreoller.js files but they are currently out of order - not connected in app.js's stat provider and their code is under comment). This is where I am: A have a list of basic book details retrieved from data base and printed out in book.html view via data-ng-repeat. In every repeat I have an Action button that is supposed to open modal for editing or deleting that entry. Here is my book.html file where I have nested the demo markup code from UI Bootsratp site: Book Collection ID Image Title Author Year Publisher City of Publishing Genre Action {{book.id}} {{book.image}} {{book.title}} {{book.author}} {{book.yearOfPublishing}} {{book.publisher}} {{book.cityOfPublishing}} {{book.genre}} Action As you can see, this last part after table tag is supposed to be modal markup taht is called when Action button is pressed and command "open()" i passed to bookController.js via data-ng-click. My bookControler.js: collectionsApp.controller('bookController', function($scope, bookService, $state) { var books = []; $scope.save = function() { bookService.save($scope.book, onSaveDelete); } $scope._delete = function(id) { for (book in books) { if (book.id === id) { bookService._delete(book, onSaveDelete); } } } $scope.edit = function(id) { for (book in books) { if (book.id === id) { $scope.book; } } } $scope.init = function() { boo…
type: Question
has comment: http://stackoverflow.com/comment/39319661

http://stackoverflow.com/a/25242479
downvote count: 1
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39325374
has comment: http://stackoverflow.com/comment/39325077
has comment: http://stackoverflow.com/comment/39324710
answers question: http://stackoverflow.com/q/25242323
upvote count: 0
has comment: http://stackoverflow.com/comment/39325230
has body: you can use M D answer if you want to use intent. if you want to access String from Main Activity.java you can do like this in your **MainActivity** //declare a method public static String getString() { String result; // assign value to string here result = "your assingment" return result; } and in your another activity //get value like this String string = MainActivity.getString(); This way is used to access variable whenever required.
has comment: http://stackoverflow.com/comment/39325259
has comment: http://stackoverflow.com/comment/39324862
has comment: http://stackoverflow.com/comment/39325199
has comment: http://stackoverflow.com/comment/39325529
has comment: http://stackoverflow.com/comment/39325129

http://stackoverflow.com/comment/39506178
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25334283
type: Comment
has text: Independently of what the Mule team has done, the `System.getProperty("javax.net.ssl.trustStore")` is only read once to initialise the default `SSLContext`. Changing it after the default `SSLContext` has been initialised (i.e. the first time SSL/TLS is used without a specific `SSLContext` loaded programmatically) will have no effect. Therefore, echoing out `System.getProperty("javax.net.ssl.trustStore")` will not necessarily reflect what's being used.

http://stackoverflow.com/a/25283236
type: Answer
score: 0
has body: You could use Junit's Rules Junit Rules, which includes an ExpectedException rule, which can be used to also test messages of exceptions. EDIT: If you implemented TerribleWindException the following way: public class TerribleWindException extends Exception { private Integer windSpeed = 0; public TerribleWindException(final Integer windSpeed) { // use Exception constructor, which passes a message super("windSpeed: " + windSpeed); this.windSpeed = windSpeed; } } You could achieve what you want using this test code: @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void shouldTestExceptionMessage() throws IndexOutOfBoundsException { List&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); thrown.expect(TerribleWindException .class); thrown.expectMessage("windSpeed: 100"); WalkService ws = new WalkService(100); ws.goForAWalk(); }
answers question: http://stackoverflow.com/q/25283140

http://stackoverflow.com/q/25304958
type: Question
has answer: http://stackoverflow.com/a/25305146
has comment: http://stackoverflow.com/comment/39440928
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39440933
has body: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.sound.sampled.*; public class AudioTest extends JFrame implements ActionListener { AudioFormat audioFormat; AudioInputStream audioInputStream; SourceDataLine sourceDataLine; boolean stopPlayback = false; private final JButton stopBtn = new JButton("Stop"); private final JButton playBtn = new JButton("Play"); private final JTextField textField = new JTextField("junk.au"); public static void main(String[] args) { AudioTest gui = new AudioTest(); gui.setVisible(true); } public AudioTest() { stopBtn.setEnabled(false); playBtn.setEnabled(true); playBtn.addActionListener(this); stopBtn.addActionListener(this); getContentPane().add(playBtn, "West"); getContentPane().add(stopBtn, "East"); getContentPane().add(textField, "North"); setTitle("Audio Test"); addWindowListener(new WindowDestroyer()); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(250, 70); } private void playAudio() { try { File soundFile = new File(textField.getText()); audioInputStream = AudioSystem.getAudioInputStream(soundFile); audioFormat = audioInputStream.getFormat(); System.out.println(audioFormat); DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class, audioFormat); sourceDataLine = (SourceDataLine)AudioSystem.getLine(dataLineInfo); new PlayThread().start(); } catch(Exception e) { e.printStackTrace(); System.exit(0); } } private class PlayThread extends Thread { byte tempBuffer[] = new byte[10000]; public void run() { try { sourceDataLine.open(audioFormat); sourceDataLine.start(); int cnt; while((cnt = audioInputStream.read( tempBuffer, 0, tempBuffer.length)) != 1 &amp;&amp; stopPlayback == false) { if(cnt &gt;0) { sourceDataLine.write(tempBuffer, 0, cnt); } } sourceDataLine.drain(); sourceDataLine.close(); stopBtn.setEnabled(false); playBtn.setEnabled(true); stopPlayback = false; } catch (Exception e) { e.printStackTrace(); System.exit(0); } } } public void actionPerformed(ActionEvent e) { i…
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39441062
has comment: http://stackoverflow.com/comment/39441240
tagged with: java
answer count: 1
downvote count: 3
has comment: http://stackoverflow.com/comment/39440906
has title: Error: could not get audio input stream from input file from code? What's wrong with code?
favorite count: 0

http://stackoverflow.com/comment/39349546
has text: The exception thrown is android.os.NetworkOnMainThreadException
type: Comment
comment on: http://stackoverflow.com/q/25255210
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39568948
score: 0
type: Comment
type: QuestionComment
has text: (You can only use `exec` on executable files. For other files you must appropriately identify the program needed to display them. Eg, a text file needs something like `notepad.exe`.)
comment on: http://stackoverflow.com/q/25374113

http://stackoverflow.com/a/25301897
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39446743
has comment: http://stackoverflow.com/comment/39437886
has comment: http://stackoverflow.com/comment/39435872
answers question: http://stackoverflow.com/q/25301520
has body: Web services are services communicating over a network. This is a general term, and they cover services over HTTP or not, RESTful services or not. An example of non-RESTful web services is SOAP. To answer your question: a REST API is a web service. REST and RESTful services mean the same thing. Some prefer not to use the terminology 'web service' when using REST principles and prefer to say 'REST(ful) API' in order to differentiate from 'old school' services, e.g. with RCP or SOAP. To increase confusion even more, some call their APIs 'RESTful', just because they use JSON over HTTP. This is not REST!
type: Answer

http://stackoverflow.com/q/25239720
has answer: http://stackoverflow.com/a/25239871
has body: I am trying to sort ArrayList on the basis of String actually I have numbers in "", like this: "4000" I have written code to sort arraylist on the basis of price, but whenever i do tap on button it is not affecting to my ListView... why ? I am following this tutorial.... This is how my JSON looks: { "locations": [ { "name": "Office", "price": "4,00,000" }, { "name": "Work", "price": "1,20,000" } ] } Model class: public class Locations { private String name; private String price; public Locations() { // TODO Auto-generated constructor stub } public Locations(String name, String price) { super(); this.name = name; this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } } LocationsActivity.java: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_locations); actorsList = new ArrayList&lt;Locations&gt;(); new JSONAsyncTask().execute(" "); listview = (ListView) findViewById(R.id.list); adapter = new LocationsAdapter(getApplicationContext(), R.layout.adapter_locations, actorsList); btnHTL = (Button) findViewById(R.id.btnHTL); btnHTL.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Collections.sort(actorsList, new Comparator&lt;Locations&gt;(){ public int compare(Locations obj1, Locations obj2) { // ascending return (Integer)(arg1.price).compareTo(arg2.price); } }); } }); btnLTH = (Button) findViewById(R.id.btnLTH); btnLTH.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Collections.sort(actorsList, new Comparator&lt;Locations&gt;(){ public int compare(Locations obj1, Locations obj2) { // descending return (Integer)(arg2.price).compareTo(arg1.price); } }); } }); }
has comment: http://stackoverflow.com/comment/39319486
tagged with: arraylist
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39319532
has answer: http://stackoverflow.com/a/25239846
linked to: http://stackoverflow.com/q/23296627
tagged with: java
has title: Sorting ArrayList not affecting to ArrayList
has answer: http://stackoverflow.com/a/25239867
accepted answer: http://stackoverflow.com/a/25239871
has comment: http://stackoverflow.com/comment/39319648
has comment: http://stackoverflow.com/comment/39319657
has comment: http://stackoverflow.com/comment/39319530
type: Question
has answer: http://stackoverflow.com/a/25239940
has answer: http://stackoverflow.com/a/25239872
answer count: 5
has comment: http://stackoverflow.com/comment/39319563
possible better answer: http://stackoverflow.com/a/25239846
tagged with: android

http://stackoverflow.com/comment/39564938
type: QuestionComment
comment on: http://stackoverflow.com/q/25365204
has text: the sql injections, they burn! please please please fix the sql injections! http://stackoverflow.com/questions/332365/how-does-the-sql-injection-from-the-bobby-tables-xkcd-comic-work
score: 0
type: Comment

http://stackoverflow.com/a/25239581
has comment: http://stackoverflow.com/comment/39319928
has comment: http://stackoverflow.com/comment/39319961
type: Answer
has body: You would wrap the path using quotations. In your case, the command would be: java -cp lib.jar "test-java-1.0.1/test"
answers question: http://stackoverflow.com/q/25239387
score: 0

http://stackoverflow.com/q/25273736
has answer: http://stackoverflow.com/a/25274000
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25274000
tagged with: java
answer count: 1
has title: Where to add the security provider in a web-app?
favorite count: 0
type: Question
has body: I am working on a Java web application that is being deployed on a Tomcat server. I have make use of several cryptographic functions at several points in the application. I want to use Bouncycastle as my security provider. I am not sure where I have to call Security.addProvider(new BouncyCastleProvider());. Does this have to happen on a per-method basis or should this only be done on start. Where the provider be added?
has comment: http://stackoverflow.com/comment/39383063
type: AnsweredQuestion
downvote count: 0

angularjs
tags question: http://stackoverflow.com/q/25250438
tags question: http://stackoverflow.com/q/25341934
type: Tag
tags question: http://stackoverflow.com/q/25312425
tags question: http://stackoverflow.com/q/25365930
tags question: http://stackoverflow.com/q/25386738
tags question: http://stackoverflow.com/q/25239777
tags question: http://stackoverflow.com/q/25241896
tags question: http://stackoverflow.com/q/25273808
tags question: http://stackoverflow.com/q/25272144
tag name: angularjs

http://stackoverflow.com/comment/39393096
has text: I understand. This is why I said *"related"*. Future visitors of this question might be actually looking for a way to partition a list into two lists, which is only subtly different from your approach.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25270073
type: QuestionComment

http://stackoverflow.com/a/25368435
type: Answer
score: 0
has body: Java uses zero-indexed arrays, meaning that counting starts at 0 (not 1!), 1, 2, 3, 4... This means that when you attempt to reference array[4], it's actually getting the fifth element in the array (and if it doesn't exist? ArrayIndexOutOfBoundsException!) You can fix your for-loops by changing it to look like this; it starts with zero, and goes up to (but not equaling) num1. for(int x = 0; x &lt; num1; x++) {
answers question: http://stackoverflow.com/q/25368355

http://stackoverflow.com/comment/39328436
comment on: http://stackoverflow.com/q/25243825
type: QuestionComment
has text: @user3487063, thank you a lot. BTW, do I have to flush session every time or something?
score: 0
type: Comment

http://stackoverflow.com/q/25258652
has answer: http://stackoverflow.com/a/25258733
has title: When to use web services
favorite count: 0
has comment: http://stackoverflow.com/comment/39355775
type: Question
linked to: http://stackoverflow.com/q/19884295
tagged with: rest
type: UnansweredQuestion
downvote count: 0
tagged with: soap
tagged with: web-services
has body: I am new to the concept of web services but i have gone through few atrticles and have implemented REST services. I have few questions Are web services used only in the case of cross-platform communication? When to use SOAP or REST? How do i make the decision What are the advantages of web services Thanks in advance
linked to: http://stackoverflow.com/q/2131965
linked to: http://stackoverflow.com/q/2013793
score: 1
tagged with: java
answer count: 1
upvote count: 1

http://stackoverflow.com/comment/39381350
score: 0
comment on: http://stackoverflow.com/q/25270461
type: Comment
has text: All bootstrap-resources are loaded from the class-path which is set in system property "sun.boot.class.path" (see also [sun.misc.Launcher](http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/sun/misc/Launcher.java)). But I could only find a "load resource from classpath" implementation [here](http://www.java2s.com/Code/Java/Reflection/ResponsibleforloadingclassfilesfromtheCLASSPATHInspiredbysuntoolsClassPath.htm) which is not even close to an equivalent of `ClassLoader.getResource(String)`.
type: QuestionComment

http://stackoverflow.com/q/25239983
has body: I am using SubsamplingScaleImageView by Dave Morrissey (https://github.com/davemorrissey/subsampling-scale-image-view) to allow users to crop and pan a photo with gestures. I modified the library to add a tint and a logo to the photo. Now I need to upload the photo to the server. In order to do that I need to somehow extract the photo from the SubsamplingScaleImageView. I added the following method to the SubsamplingScaleImageView class: /** * Capture a photo of the image view */ public Bitmap getOutput() { buildDrawingCache(); Bitmap b1 = getDrawingCache(); Bitmap b = b1.copy(Config.ARGB_8888, true); destroyDrawingCache(); return b; } I am using this method to get the file, resize it to a specific resolution (800x800), and save it to my app's folder. The problem I noticed is that the extracted photo from the drawing cache depends on the resolution of the device. For example, on my Full HD device I get 1080x1080 photo, which is enough, but on some lower res devices I get resolutions like 480x480 and that is not enough since the image needs to be bigger than that, so the photo gets blurry when I resize it to 800x800. Is there a way to get the same resolution photo from that image view on all devices?
tagged with: android
tagged with: android-imageview
score: 3
answer count: 0
upvote count: 3
tagged with: java
has title: Is it possible to get a higher resolution from getDrawingCache?
downvote count: 0
favorite count: 0
type: Question
tagged with: mobile
type: UnansweredQuestion
tagged with: android-view

http://stackoverflow.com/comment/39378799
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25271474
type: Comment
has text: I was writing the same answer :)

http://stackoverflow.com/a/25236720
has body: This is because you process your for inside the main thread of your code. If you wand to do something heavy and still you want other parts of your code run smoothly, you should use Threads. However, for your code, you can use InvokeLater to let your main thread to run part of your code after the first available time - I think it is when you are out of every function call you have up to this call (They have to be finished and control should be back to the main running routine which I believe it is update GUI for the next cycle. Please read InvokeLater help section by yourself) This is how your code work if you want to disable/invisible your buttons. import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; public class FinCSV implements ActionListener { JFrame frame = new JFrame("ICON"); JPanel panel = new JPanel(new GridLayout(2, 1, 4, 4)); JButton primaryButton = new JButton(" Primary Process"); JButton secondaryButton = new JButton(" Secondary Process"); public static void main(String[] args) throws Exception { FinCSV msql = new FinCSV(); msql.initGUI(); } public void initGUI() { this.primaryButton.setActionCommand("Primary"); this.secondaryButton.setActionCommand("Secondary"); this.primaryButton.addActionListener(this); this.secondaryButton.addActionListener(this); this.primaryButton.setFont(new Font("Serif", Font.BOLD, 22)); this.secondaryButton.setFont(new Font("Serif", Font.BOLD, 22)); panel.add(this.primaryButton); panel.add(this.secondaryButton); frame.setContentPane(panel); frame.setSize(650, 300); frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Primary")) { secondaryButton.setVisible(false); primaryButton.setEnabled(false); run_btn_1(); } else if (e.…
type: Answer
answers question: http://stackoverflow.com/q/25236408
downvote count: 1
has comment: http://stackoverflow.com/comment/39315623
has comment: http://stackoverflow.com/comment/39315124
has comment: http://stackoverflow.com/comment/39314746
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/39314090
has comment: http://stackoverflow.com/comment/39315652

http://stackoverflow.com/a/25352298
accepted answer of: http://stackoverflow.com/q/25345885
has body: I have been using GridLayouts by setting up the elements in rows and columns. The vertical scroll works without any problems. Have you tried something like this? <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/orange" android:layout_row="0" android:layout_column="0" android:layout_columnSpan="6" android:text="Social" /> <Space android:id="@+id/space_col" android:layout_marginBottom="8dp" android:layout_marginLeft="16dp" android:layout_column="6" android:layout_columnSpan="4" /> <TextView android:id="@+id/blue" android:layout_row="0" android:layout_column="10" android:layout_columnSpan="6" android:text="Utilities" /> <TextView android:id="@+id/red" android:layout_row="1" android:layout_column="0" android:layout_columnSpan="6" android:text="Games" /> <TextView android:id="@+id/green" android:layout_row="1" android:layout_column="6" android:layout_columnSpan="10" android:text="Google" /> You can adjust the row height by adding margins for top/bottom to the text views as needed. Don't use the margins and gravity to position the children. Only use row/column spec.
has comment: http://stackoverflow.com/comment/39554417
type: Answer
has comment: http://stackoverflow.com/comment/39538224
answers question: http://stackoverflow.com/q/25345885
downvote count: 0
has comment: http://stackoverflow.com/comment/39530476
type: AcceptedAnswer
upvote count: 11
score: 11

http://stackoverflow.com/comment/39301475
comment on: http://stackoverflow.com/q/25230257
has text: What's wrong with using `javax.swing.JOptionPane` as a starting point?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25247083
score: 0
has comment: http://stackoverflow.com/comment/39333582
tagged with: java
has comment: http://stackoverflow.com/comment/39333790
tagged with: eclipse
type: Question
has title: Java web project not running after cleaning?
has comment: http://stackoverflow.com/comment/39333699
answer count: 0
has comment: http://stackoverflow.com/comment/39333388
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39333468
tagged with: jsp
has comment: http://stackoverflow.com/comment/39333951
has body: I clicked on Project > Clean... in Eclipse Kepler, removed the project from the local Tomcat7 server list and re-added it. Now when I attempt to run the website I get a 404 error. I have attempted restarting the Tomcat server and restarting Eclipse to no avail. How do I correctly re-run my web project after cleaning so it loads in the browser? edit: Just to clarify the web project was working perfectly fine before Cleaning. I browse to the web project like so: http://localhost:8080/website/

http://stackoverflow.com/q/25252749
tagged with: android
accepted answer: http://stackoverflow.com/a/25253189
has answer: http://stackoverflow.com/a/25252892
score: -1
has answer: http://stackoverflow.com/a/25253189
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39344989
has title: Android android.view.InflateException Binary XML file line #644: Error inflating class <unknown>?
type: AnsweredQuestion
answer count: 2
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39345345
has comment: http://stackoverflow.com/comment/39345311
has body: I don't know how to fix this error, first the app works great, it starts opening a menu then I press a button to start a new class and it works fine but when I press the back button and select it again it the application stops working. so any idea how to fix this problem? line #644: &lt;ImageButton //&lt;&lt;this is line 644 android:id="@+id/sephiroth" android:layout_width="110dip" android:layout_height="110dip" android:layout_gravity="center" android:background="@android:color/transparent" android:scaleType="fitCenter" android:src="@drawable/sephiroth" /&gt; here is my logcat: 08-11 17:19:39.758: D/dalvikvm(2108): GC_FOR_ALLOC freed 3146K, 9% free 55441K/60568K, paused 2ms, total 2ms 08-11 17:19:39.788: D/dalvikvm(2108): GC_FOR_ALLOC freed 16761K, 35% free 39783K/60568K, paused 0ms, total 0ms 08-11 17:19:39.808: D/dalvikvm(2108): GC_FOR_ALLOC freed 257K, 33% free 40653K/60568K, paused 2ms, total 2ms 08-11 17:19:39.818: D/dalvikvm(2108): GC_FOR_ALLOC freed 159K, 31% free 42392K/60568K, paused 2ms, total 2ms 08-11 17:19:39.848: D/dalvikvm(2108): GC_FOR_ALLOC freed 383K, 28% free 43924K/60568K, paused 3ms, total 3ms 08-11 17:19:39.868: D/dalvikvm(2108): GC_FOR_ALLOC freed &lt;1K, 27% free 44719K/60568K, paused 4ms, total 4ms 08-11 17:19:39.868: I/dalvikvm-heap(2108): Grow heap (frag case) to 46.997MB for 3256332-byte allocation 08-11 17:19:39.898: D/dalvikvm(2108): GC_FOR_ALLOC freed 0K, 21% free 47899K/60568K, paused 2ms, total 2ms 08-11 17:19:39.938: D/dalvikvm(2108): GC_FOR_ALLOC freed 968K, 20% free 48480K/60568K, paused 3ms, total 3ms 08-11 17:19:39.948: D/dalvikvm(2108): GC_FOR_ALLOC freed 670K, 19% free 49199K/60568K, paused 3ms, total 3ms 08-11 17:19:39.968: D/dalvikvm(2108): GC_FOR_ALLOC freed 195K, 17% free 50697K/60568K, paused 0ms, total 0ms 08-11 17:19:39.988: D/dalvikvm(2108): GC_FOR_ALLOC freed 900K, 16% free 51409K/60568K, paused 3ms, total 3ms 08-11 17:19:40.008: D/dalvikvm(2108): GC_FOR_ALLOC freed &lt;1K, 14% free 52356K/60568K, paused 2ms, total 2m…
downvote count: 1
favorite count: 0
type: Question
tagged with: logcat
has comment: http://stackoverflow.com/comment/39344526
has comment: http://stackoverflow.com/comment/39344784
possible better answer: http://stackoverflow.com/a/25252892

http://stackoverflow.com/comment/111528614
score: 3
comment on: http://stackoverflow.com/a/54737451
type: Comment
has text: Use of Java 8 LocalDate
type: AnswerComment

http://stackoverflow.com/comment/39556814
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25367979
has text: Edited the question. It is asking for a no-arg constructor.
score: 0

http://stackoverflow.com/q/25263028
downvote count: 1
favorite count: 0
tagged with: hive
accepted answer: http://stackoverflow.com/a/25264686
type: Question
has body: I'm trying to update a Hive Driver to connect to a database. I've downloaded the driver and I've used Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver"); to load it. It doesn't work properly and gives a null in return. To be more specific, I get this message Exception in thread "main" java.lang.NullPointerException at HiveClient.main(HiveClient.java:39) Java Result: 1 That line is Statement stmt = con.createStatement(); When I debug the program I realise that the problem is in Class.forName, because I've got a try-catch structure and it goes to the catch part. No suitable driver found for jdbc:hive://130.206.80.46:10000/default?user=myuser&amp;password=mypasswd What could be the problem?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25264686
has comment: http://stackoverflow.com/comment/39362954
tagged with: java
tagged with: jdbc
score: -1
has title: Class.forName() Hive
has comment: http://stackoverflow.com/comment/39362900
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39362886

http://stackoverflow.com/comment/39841017
comment on: http://stackoverflow.com/q/25257077
type: Comment
type: QuestionComment
score: 0
has text: Just a guess, maybe you could stream your video to a named pipe and then use pipe as a source for streaming to a network. So you could change the source of video without restarting a streaming program.

http://stackoverflow.com/q/25265540
has answer: http://stackoverflow.com/a/25269282
tagged with: web-applications
tagged with: jsp
type: UnansweredQuestion
has body: I have a buisness layer class to manage some data. There is a method which generate HTML-code in those code include a JSTL tag. &lt;h1 id=\"infoMsg\"&gt;&lt;fmt:message key=\"uebersicht.infomsg\" /&gt;&lt;/h1&gt; This code will be included in JSP file like this: &lt;%=bl.getMessages()%&gt; But in that way it will be included as HTML request, but is there another way to include the code from a method For example like this: &lt;c:out value="${bl.getMessages()}"/&gt;
type: Question
has comment: http://stackoverflow.com/comment/39367634
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39367723
has title: JSTL tags print in JSP from a data class
has comment: http://stackoverflow.com/comment/39367992
has answer: http://stackoverflow.com/a/25282740
tagged with: jstl
answer count: 2

http://stackoverflow.com/comment/39388536
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25273634
score: 0
has text: @user3810342 Please post your `Order` class.

http://stackoverflow.com/comment/39353550
score: 0
has text: Try this 2 links http://stackoverflow.com/questions/8258244/accessing-a-file-inside-a-jar-file and http://stackoverflow.com/questions/403256/how-do-i-read-a-resource-file-from-a-java-jar-file
comment on: http://stackoverflow.com/q/25257513
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25295552
type: Answer
answers question: http://stackoverflow.com/q/25290935
has comment: http://stackoverflow.com/comment/39423989
downvote count: 0
upvote count: 1
has body: This is what I would do: @Named public class MyComponent { // introduce a marker interface for Injecting proxies @InjectDynamic IService service ... public void useIService() { service.doSomething(); ... service.doSomethingElse(); ... service.doFinally(); } } Define a BeanPostProcessor that scans for bean with fields annotated with @InjectDynamic, then creates and inject a Proxy implementing the type required by the field. The Proxy implementation will look in the applicationContext for beans implementing Supplier&lt;T&gt; (Java 8 or guava versions) where &lt;T&gt; is the type of the field annotated with @InjectDynamic. Then you can define @Name public IServiceSupplier implements Supplier&lt;IService&gt; { @Override public IService get() { // here you implement the look-up logic for IService } } In this way the look-up of active the current implementation is decoupled from the Proxy and can be change by target type.
score: 1

http://stackoverflow.com/comment/39485238
has text: you are missing some brackets
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25328709
score: 0

http://stackoverflow.com/comment/39388913
comment on: http://stackoverflow.com/q/25277043
score: 3
has text: So be specific. *Where* are you seeing an issue? When I run this code I get an error well before the `switch`. Do you have a specific way you're entering in your data?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25235048
has body: rooms.get("roomA").get("desc1") Is the short answer. Since you're new to HashMaps, let's clarify that a bit. rooms is a HashMap that maps a string to HashMap&lt;String, String&gt;. So every .get(...) you call on rooms has a return type of HashMap&lt;String, String&gt;. Calling .get(...) on anything of HashMap&lt;String, String&gt; returns a value of type String, which is what you're going for. Thus rooms.get("roomA") returns a HashMap&lt;String,String&gt;, and rooms.get("roomA").get("desc1") returns the String. Another way of thinking about it is splitting it into two statements: HashMap&lt;String, String&gt; myRoom = rooms.get("roomA"); String desc = myRoom.get("desc1"); Which can then easily be squished down to rooms.get("roomA").get("desc1").
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25235004
upvote count: 1

http://stackoverflow.com/comment/39343230
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25249646
has text: do you know what ports are open by default other then port 80 on a normal router. any ports that would not have any negative effects on common computer setups.
type: Comment

http://stackoverflow.com/a/25273901
type: Answer
answers question: http://stackoverflow.com/q/25273610
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/60042352
has body: You should ask yourself what the mission critical code is for your project - reading files or parsing their content. For my projects, parsing was the interesting part, so I placed files to parse as test resources, read them in the unit test to string and pass them to the parser to unit test the parser. It is also possible to include the contents directly in unit tests as big ugly strings, but when you have a dedicated place for test resources, why not use it.
score: 3

http://stackoverflow.com/comment/39458649
type: AnswerComment
has text: Ya, I am looking to represent 1.0 as 1.000000. But I want to variable to store that many decimals.
score: 0
comment on: http://stackoverflow.com/a/25314428
type: Comment

http://stackoverflow.com/a/25319197
answers question: http://stackoverflow.com/q/25318925
has body: Below is a fully runnable example which shows you A, B, C and no exception occurring. Without stating what the ArrayList contains there is no way to fully answer the question. public class Test { public static void main(final String... args) { try { Test.throwNullPointer(); } catch (final Throwable e) { System.out.println(e); } try { Test.throwIndexOutOfBoundsException(); } catch (final Throwable e) { System.out.println(e); } try { Test.throwClassCastException(); } catch (final Throwable e) { System.out.println(e); } try { Test.noException(); System.out.println("No Exception"); } catch (final Throwable e) { System.out.println(e); } } public static void throwNullPointer() { final ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add("a"); a.add(null); a.add("c"); Test.doSomething(a, 0); } public static void throwIndexOutOfBoundsException() { final ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add("a"); a.add("b"); a.add("c"); Test.doSomething(a, 0); } public static void throwClassCastException() { final ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); Test.doNaughtyStuff(a); Test.doSomething(a, 0); } private static void doNaughtyStuff(final ArrayList a) { a.add(new Object()); } public static void noException() { final ArrayList&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add(""); Test.doSomething(a, 0); } public static String doSomething(final ArrayList&lt;String&gt; a, final int b) { String t; int u; for (u = 0; u &lt;= a.size(); u++) { t = a.get(u); if (t.length() == b) { return t; } } return null; } } Output: java.lang.NullPointerException java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String No Exception
type: Answer
score: 0

http://stackoverflow.com/comment/39356821
score: 0
comment on: http://stackoverflow.com/q/25239432
type: Comment
type: QuestionComment
has text: @ Jens Samples is not initialized in init() method of class speexEncoder. Sir please tell.help me

http://stackoverflow.com/q/25253711
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39347319
tagged with: java
answer count: 1
has title: Tomcat library eager loading of jars
downvote count: 0
tagged with: web-applications
tagged with: tomcat
favorite count: 0
type: Question
tagged with: classloader
has answer: http://stackoverflow.com/a/25254560
accepted answer: http://stackoverflow.com/a/25254560
has comment: http://stackoverflow.com/comment/39346890
has comment: http://stackoverflow.com/comment/39347655
has comment: http://stackoverflow.com/comment/39346978
type: AnsweredQuestion
has body: I have two applications deployed on a Tomcat server (v7) , both the applications use same shared library. I wanted to reduce the permgen memory foot print of these apps on JVM so I decided to take the common shared library out of the individual wars and put it in the tomcat library folder. However this experiment backfired as the ClassLoader is per application context even though I moved the libraries to tomcat lib, shared library is getting loaded into the context of both the apps, worse it is getting loaded into the context of other apps that do not use this shared library. Is there a way to load the library only once across the contexts in the web server? I understand the risks of thread safety and security, those risks are mitigated in my case.

http://stackoverflow.com/comment/39579059
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25378870
type: Comment
has text: I mean strbld.append(System.getProperty("line.separator"));

http://stackoverflow.com/a/25284154
answers question: http://stackoverflow.com/q/25284059
has body: You can use negative "look around"s for that. For instance: String[] input = {"foo bar", "nope", " "}; Pattern p = Pattern.compile("(?!&lt;\\s|^)\\s+(?!\\s|$)"); for (String s: input) { Matcher m = p.matcher(s); System.out.printf("Found in %s? %b%n", s, m.find()); } Output Found in foo bar? true Found in nope? false Found in ? false
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25364066
tagged with: java
has comment: http://stackoverflow.com/comment/39548983
has answer: http://stackoverflow.com/a/25364125
type: AnsweredQuestion
has title: My resultset is always returning false
accepted answer: http://stackoverflow.com/a/25364107
has answer: http://stackoverflow.com/a/25364114
has body: I have written the following code: String username=request.getParameter("username"); System.out.println(""+username); String password=request.getParameter("password"); System.out.println(""+password); Connection con=getConnection.getConnectionBuilder(); System.out.println("Inside"); PreparedStatement pstmt=con.prepareStatement("Select password from users where username=? "); pstmt.setString(1, "username"); ResultSet rs=pstmt.executeQuery(); try { System.out.println(""+rs.next()); while(rs.next()) { String pass=rs.getString(1); System.out.println(""+pass); if(pass.equals("password")) { out.print("Welcome back"+username); } else { out.print("Wrong username/password combination"); } } } catch(Exception e) { e.printStackTrace(); } pstmt.close(); con.close(); My rs.next() part is always getting evaluated to false. How come is it happening so?
answer count: 3
has answer: http://stackoverflow.com/a/25364107
score: 0
possible better answer: http://stackoverflow.com/a/25364125
type: Question
has comment: http://stackoverflow.com/comment/39549385
has comment: http://stackoverflow.com/comment/39548994

http://stackoverflow.com/q/25370256
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25370330
has title: Java BufferedReader to String Array
tagged with: while-loop
answer count: 5
has answer: http://stackoverflow.com/a/25370339
score: 1
tagged with: java
has body: I was looking through a lot of diffrent subjects here on stackoverflow but couldn't find anything helpful so far :/ So this is my problem. I am writing a filecopier. The problem occurs already at reading the file. My test docoument got 3 lines of random text. All those 3 lines should get written in a string array. The problem is that only the 2nd line of the textdocument gets written in the array and I can't figure out why. Already debugged it, but didn't get me any further. I know there are diffrent solutions for a filecopier with diffrent classes etc. But I would really like to get it running with the classes I used here. String[] array = new String[5]; String datei = "test.txt"; public String[] readfile() throws FileNotFoundException { FileReader fr = new FileReader(datei); BufferedReader bf = new BufferedReader(fr); try { int i=0; //String Zeile = bf.readLine(); while(bf.readLine() != null){ array[i] = bf.readLine(); // System.out.println(array[i]); This line is for testing i++; } bf.close(); } catch (IOException e) { e.printStackTrace(); } return array;
accepted answer: http://stackoverflow.com/a/25370298
tagged with: filereader
has answer: http://stackoverflow.com/a/68705860
has answer: http://stackoverflow.com/a/25370298
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25370412
tagged with: filewriter
tagged with: arrays
downvote count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/25370330

http://stackoverflow.com/q/25341182
linked to: http://stackoverflow.com/q/14341865
has body: I just tried to run Eclipse on a Mac Book Pro running OSX Mavericks. I've downloaded both, the 32 and the 64 bit version. Both end up in following Notification: Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater is required. I know that the question was already asked, but my Eclipse won't event start with the 64-bit version, which was the answer for a smiliar question. So I checked the version of my installed Java by running java -version In the terminal. The output really confirmed, that version 1.6.0_65 was installed. Here's the output: java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) Now the problem is that when launching the Java Control panel, it says, that Java 7 Update 67 is installed, and there are no updates. So where's my problem, how get I get Eclipse to run?
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/38802038
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25341202
tagged with: java
downvote count: 0
has title: Can't start Eclipse on OSX (Version not suitable)
upvote count: 1
score: 1
tagged with: macos
favorite count: 0
type: Question

http://stackoverflow.com/q/25278583
downvote count: 0
has comment: http://stackoverflow.com/comment/39416691
possible better answer: http://stackoverflow.com/a/25278940
has answer: http://stackoverflow.com/a/25292095
tagged with: spring
has body: Experts/Gurus/Friends Our application runs with Spring 3.2, JPA 2, Hibernate 4.2 tech stack with MySQL &amp; Tomcat 7. We are getting a weird exception which is quite a puzzle to solve. We have a very simple entity which works well through Junit test without any issues. But when I added Hibernate EmptyInterceptor (moved the common company logic in here) then I get the below mentioned exception.. Alternatively I even tried with Hibernate PreInsertEventListener also but same exception. After reading few posts in stackoverflow - this and this and few others, it makes me to think that read operation using EntityManager (in Interceptor) is triggering auto flush which causes exception to be thrown. But couldn't identify what it is. Also I have remove any not null constrains in this simple Entity class as well as in table (which dont even have a foreign key). MYSQL Table CREATE TABLE `rcent_rel_2`.`worklist_status_master` ( `worklist_status_seqid` int(10) unsigned NOT NULL AUTO_INCREMENT, `worklist_status_name` varchar(45) DEFAULT NULL, `created_by` varchar(45) DEFAULT '', `updated_ts` datetime DEFAULT NULL, `updated_by` varchar(45) DEFAULT '', `comp_seq_id` int(10) unsigned DEFAULT NULL, `created_ts` datetime DEFAULT NULL, PRIMARY KEY (`worklist_status_seqid`) ) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=latin1; Simple Entity @Entity @Table(name="worklist_status_master") public class WorklistStatusDO implements Serializable { private static final long serialVersionUID = 1L; private static final Logger log = LoggerFactory.getLogger(WorklistStatusDO.class); private Integer id; private String workListStatusName; @Id //@GeneratedValue(strategy = GenerationType.IDENTITY) -- Tried this too @GeneratedValue @Column(name="worklist_status_seqid") public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Column(name="worklist_status_name") public String getWorkListStatusName() { return workListStatusName; } public void setWorkListStatusName(String w…
has answer: http://stackoverflow.com/a/62531892
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25278940
score: 3
tagged with: java
tagged with: hibernate
has title: Spring JPA/Hibernate org.hibernate.AssertionFailure: null id in Entity (don't flush the Session after an exception occurs)
tagged with: interceptor
type: AnsweredQuestion
answer count: 3
has comment: http://stackoverflow.com/comment/39410762
upvote count: 3
accepted answer: http://stackoverflow.com/a/25292095
tagged with: jpa

http://stackoverflow.com/comment/39303036
score: 1
comment on: http://stackoverflow.com/a/25231116
has text: There's also a considerable potential in simple improvements like using a char[][] for the board instead of a String[][]. Also, a move can be encoded in a single int (using row<<2+col) to avoid split, String[] and parseInt.
type: Comment
type: AnswerComment

executorservice
type: Tag
tags question: http://stackoverflow.com/q/25260993
tags question: http://stackoverflow.com/q/25231149
tags question: http://stackoverflow.com/q/25330464
tag name: executorservice
tags question: http://stackoverflow.com/q/25375144
tags question: http://stackoverflow.com/q/25305877

http://stackoverflow.com/q/25249082
accepted answer: http://stackoverflow.com/a/25249124
type: Question
has answer: http://stackoverflow.com/a/25249472
has answer: http://stackoverflow.com/a/25249542
has comment: http://stackoverflow.com/comment/39337172
has comment: http://stackoverflow.com/comment/39337325
has body: The objective is to create withdraw method which will substract withdrawAmount from current balance only if withdrawAmount does not exceede that balance. If it does, then we print a message and leave the balance unchanged. It's easy to do with if...else, ex: public void withdraw(double withdrawAmount) { if (withdrawAmount &gt; 0.0) if (withdrawAmount &gt; balance) System.out.println("Withdrawal amount exceeded account balance"); else balance = balance - withdrawAmount; } Is there a way to achieve the same effect WITHOUT using if...else structure or &amp;&amp; and its brothers?
has comment: http://stackoverflow.com/comment/39337237
has answer: http://stackoverflow.com/a/25249124
answer count: 4
has comment: http://stackoverflow.com/comment/39337345
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39337298
score: 0
tagged with: java
has title: If statement in Java withdraw method
has answer: http://stackoverflow.com/a/25249225
possible better answer: http://stackoverflow.com/a/25249225
has comment: http://stackoverflow.com/comment/39337166

http://stackoverflow.com/a/25319447
type: Answer
has comment: http://stackoverflow.com/comment/39484831
accepted answer of: http://stackoverflow.com/q/25317244
has comment: http://stackoverflow.com/comment/39482047
has comment: http://stackoverflow.com/comment/39485227
has comment: http://stackoverflow.com/comment/39482721
answers question: http://stackoverflow.com/q/25317244
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39483698
has comment: http://stackoverflow.com/comment/39484696
has body: PropertyValueFactory&lt;&gt;("TicketType") should be ticketType, note the lower case. Same for all fields. http://docs.oracle.com/javafx/2/api/javafx/scene/control/cell/PropertyValueFactory.html

http://stackoverflow.com/comment/39356881
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25259446
has text: So you want it to get some kind of initial trigger when its registered (when `addListener` is called)?
type: Comment

http://stackoverflow.com/comment/39486828
has text: I've added some hideous example code so you can see if it works for your purpose. Use it sparingly and then rework the whole thing to not be awful.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25329064

http://stackoverflow.com/q/25360927
downvote count: 0
has answer: http://stackoverflow.com/a/25385198
possible better answer: http://stackoverflow.com/a/46274190
tagged with: java-8
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/46274190
has title: minimum hibernate version compatible with java8
upvote count: 12
tagged with: java
tagged with: hibernate
tagged with: apache-tomee
linked to: http://stackoverflow.com/q/10852035
score: 12
type: AnsweredQuestion
has body: I have a terrible time trying to find out which is the minimum version of Hibernate that supports being run on a java8 JRE, where the user code will use java8 features. I found this bug, but it talks about making use of java8 features in hibernate, it's planned for hibernate 5.2 and for sure hibernate 4.3.1 already supports java8, since Wildfly ships it and claims to fully support java8. I've tried to find in the hibernate bug tracker bugs related to java8, but again all are "too new". Finally I've searched in the Hibernate release notes for .0 versions, and again without success: it seems the release notes will only describe the changes since the previous RC or beta release... I tried tracking all RC and beta releases for 4.3.0.Final and 4.2.0.Final but failed finding such a mention. We are currently using Hibernate 4.2.12.Final and I wonder whether we could just start using java8 or whether we need to upgrade to a newer version of hibernate (4.3.x presumably). For some context, we are using TomEE as an application server. The 1.7.0 is just released with support for java8. However in case we must upgrade to hibernate 4.3.x, I'm a bit afraid that we can't use Hibernate 4.3.x together with TomEE as I've seen this: "However, Hibernate 4.3+ (JPA 2.1) is not supported by TomEE, because it's Java EE 7.". So we'd rather stick to 4.2.x a bit longer if possible. EDIT: well I found this, where someone says "we use hibernate (and 4.3.x supports java 8)". So it could be that 4.3.x is needed.
answer count: 2
accepted answer: http://stackoverflow.com/a/25385198

http://stackoverflow.com/q/25234057
tagged with: mouseevent
type: AnsweredQuestion
downvote count: 4
has comment: http://stackoverflow.com/comment/39309048
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39309244
has comment: http://stackoverflow.com/comment/39309010
upvote count: 1
has comment: http://stackoverflow.com/comment/39309171
accepted answer: http://stackoverflow.com/a/25234259
favorite count: 0
type: Question
tagged with: buffer
has answer: http://stackoverflow.com/a/25234259
has body: How do I get the mouse position. I have tried: int mouseX = MouseInfo.getPointerInfo().getLocation().x; int mouseY = MouseInfo.getPointerInfo().getLocation().y; But that does it for the whole screen. Anyway to do it relative to the JPanel/JFrame If I'm only using Graphics JFrame and JPanel that is being repainted every millisecond, should I have buffers? Or will it be fine?
has comment: http://stackoverflow.com/comment/39309098
has title: How to get mouse position and buffer?
has comment: http://stackoverflow.com/comment/39309108
has comment: http://stackoverflow.com/comment/39309153
has comment: http://stackoverflow.com/comment/39309395
score: -3
tagged with: awt

http://stackoverflow.com/comment/39538028
score: 2
type: Comment
type: QuestionComment
has text: Have tried calling `Class.forName("com.mysql.jdbc.Driver")` _before_ calling `DriverManager.getConnection(url)`?
comment on: http://stackoverflow.com/q/25358141

http://stackoverflow.com/comment/39744126
score: 0
has text: @DaveSyer I implemented a custom grant type in Spring Oauth that utilizes limited number of logins attempts (6 tries). When the 6 tries are exceeded, the error response is states the account is locked and how many minutes remaining before the user retries.
comment on: http://stackoverflow.com/q/25354435
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25325016
answers question: http://stackoverflow.com/q/25324927
downvote count: 0
type: AcceptedAnswer
has body: add onItemClickListener to your listView, then start activity based on the clicked item. for example, list.setOnItemClickListener(new OnItemClickListener){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view,int position, long id) { String selected = parent.getAdapter().getItem(position).toString(); if(selected.equals("htc") { //start htc activity } } });
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25324927
score: 1
type: Answer

http://stackoverflow.com/comment/39555859
has text: I suspect not in the case of the `InvalidGrantException`. The `UsernameNotFoundException` is part of Spring Security core, so it might have some i18n. It might all depend on where you want to localize them - if it's in log files you are probably out of luck.
comment on: http://stackoverflow.com/q/25354435
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25267653
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25268047
type: Question
has title: Setting text color of EditText
tagged with: android
accepted answer: http://stackoverflow.com/a/25268047
has body: I have a dialog that triggers on EditText's context menu. Dialog sets the amount of red, green and blue of EditText. The problem is that runtime error occurs when I click positive button. Items above works fine, they set the color of text in EditText as it should, but rgbDialog don't. I think that the problem occurs here: etRed = (EditText)findViewById(R.id.etRed); etGreen = (EditText)findViewById(R.id.etGreen); etBlue = (EditText)findViewById(R.id.etBlue); But I don't know how to initialize etRed, etGreen and etBlue right. I think that I should place something before findView like etRed = (EditText)Dialog.findViewById(R.id.etRed); But don't know what, because everything is happening in the same method (onContextItemSelected) @Override public boolean onContextItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.white: temp.setTextColor(Color.WHITE); break; case R.id.red: temp.setTextColor(Color.RED); break; case R.id.green: temp.setTextColor(Color.GREEN); break; case R.id.rgb: AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle("choose the amount of red green and blue"); LayoutInflater inflater = this.getLayoutInflater(); dialogBuilder.setView(inflater.inflate(R.layout.colors, null)); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { etRed = (EditText)findViewById(R.id.etRed); etGreen = (EditText)findViewById(R.id.etGreen); etBlue = (EditText)findViewById(R.id.etBlue); red=etRed.getText().toString(); green = etGreen.getText().toString(); blue = etBlue.getText().toString(); intRed = Integer.parseInt(red); intGreen = Integer.parseInt(green); intBlue = Integer.parseInt(blue); temp.setTextColor(Color.rgb(intRed, intGreen, intBlue)); } }); dialogBuilder.setNegativeButton("CANCEL", null); AlertDialog alertDialog = dialogBuilder.create(); alertDialog.show(); break; default: break; } return super.onContextItemSelected(item); } Edi…

http://stackoverflow.com/comment/39510245
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25342055
has text: It worked. Move the getQuestionSetFromDb() method inside PracticeButton. Thanks a lot!
type: Comment

http://stackoverflow.com/comment/39579121
comment on: http://stackoverflow.com/a/25379033
score: 0
type: AnswerComment
has text: @MazerytFreager - please excuse my ignorance. Turns out that hibernate actually supports the `new map` syntax - see user3739160's answer
type: Comment

http://stackoverflow.com/a/25242234
has body: To accommodate for the new object's size, I remove some entries from my cache and I load in the new object. Will this possibly cause an OutOfMemory exception? As long as the garbage collector hasn't sweeped through my recently removed objects, the memory stays in use, so is the garbage collector smart enough to run a new sweep in order to accommodate the newly allocated object? By remove I understand you set them to null to make them eligible for GC. Although you have set them to null, the GC might decide not to do a memory sweep at all. Now you could explicitly call System.gc but then again the GC will be running in a separate low-priority thread. And collection of Objects will not be immediate. Now, once you try to load the large resource, the GC finds out that the memory is less, it starts its task to free as much memory as possible. But it will still throw OutOfMemory because you don't have memory when trying to load your resource.
type: Answer
answers question: http://stackoverflow.com/q/25242033
score: 0

http://stackoverflow.com/q/25236665
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25236759
accepted answer: http://stackoverflow.com/a/25236759
favorite count: 0
type: Question
has body: The org.apache.commons.math3.optimization.fitting.CurveFitter is deprecated. It was a useful class. Why was it deprecated? The docs don't say what we should use instead. What is the alternative class?
tagged with: curve-fitting
tagged with: apache-commons-math
has title: Alternative for deprecated apache commons CurveFitter class?
type: AnsweredQuestion
tagged with: deprecated
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25341555
tagged with: serialization
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25341871
answer count: 3
tagged with: java
has body: I'm trying my best to understand this concept. But I am not able to figure out this thing: If the parent has no no-arg constructor and also the parent does not implement Serializable interface how can a serialize a child class? Parent.java public class Parent { private String parentString; public Parent(String parentString) { this.parentString = parentString; parentString = "Parent"; } public String getParentString(){ return parentString; } } Child.java public class Child extends Parent implements Serializable{ private String childString; public Child(String childString) { super(childString); this.childString = childString; } public String getChildString(){ return childString; } } TestSerialization.java public class TestSerialization { public static void main(String[] args) throws IOException, ClassNotFoundException{ Child child = new Child("Child"); FileOutputStream fos = new FileOutputStream(new File("file.ser")); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(child); oos.close(); FileInputStream fis = new FileInputStream(new File("file.ser")); ObjectInputStream ois = new ObjectInputStream(fis); Object obj = ois.readObject(); ois.close(); Child castChild = (Child) obj; System.out.println(castChild.getParentString()); System.out.println(castChild.getChildString()); } } It gives me an Exception while reading the object, saying java.io.InvalidClassException: test.Child; no valid constructor. How can a serialize such objects?
has answer: http://stackoverflow.com/a/25341836
favorite count: 0
type: Question
score: 2
has answer: http://stackoverflow.com/a/25341845
upvote count: 2
has answer: http://stackoverflow.com/a/25341871
downvote count: 0
accepted answer: http://stackoverflow.com/a/25341845
has title: Serialization issue if the parent does not have a no-arg constructor

http://stackoverflow.com/a/25258101
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39370074
has body: The following code should fix your error and the comments should hopefully explain the reasons for the error. Default Constructor : /** Constructor */ public PlayerTableCardPane() { // Calling an overloaded constructor is a lot less // work than writing out two constructors with minor // differences. this(50, 5); } Overloaded Constructor : /** Constructor for setting custom height and X offset */ public PlayerTableCardPane(int height, int xOffset) { this.cardStack = new StackPane(); this.cardBack = new ImageView[5]; this.cardHeight = height; this.cardXOffset = xOffset; this.cardCount = 0; // There is no need to define the ImageView object // outside of the for loop unless you need to use // the ImageView object after the for loop. // ImageView tempCard = null; // I don't like using for-each unless I have to. for (int index = 0; index < 5; index++) { Image newImage = new Image("image/cardDown.png"); // The NullPointerException came from trying to // access the property of an uninstantiated // ImageViewer in the cardBack array. ImageView setCardBack = new ImageView(); setCardBack.setImage(newImage); setCardBack.setVisible(false); setCardBack.setFitHeight(cardHeight); setCardBack.setPreserveRatio(true); // this next line does what your conditional does without // the need for any conditional, also it avoids testing for // null, and removes the need for a tempCard variable. setCardBack.setX(index * cardXOffset); /* if (tempCard != null) { setCardBack.setX(tempCard.getX() + cardXOffset); } */ // There is no longer a need for the next line. // tempCard = setCardBack; // Add the dynamically created and instantiated ImageView // object to this.cardBack. this.cardBack[index] = setCardBack; } // You have to add the array of ImageViews to the StackPanel, // before adding the StackPanel to the Panel that this class // etends. this.cardStack.getChildren().add(this.cardBack); this.getChildren().add(this.cardStack); } Let me know if you need further help or if this code leads to m…
type: Answer
answers question: http://stackoverflow.com/q/25256725

http://stackoverflow.com/comment/39584687
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25382394
has text: Using a json library makes easier. `GSON`
type: Comment

http://stackoverflow.com/a/25277985
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25277895
type: Answer
has body: This is a feature of the SimpleFormatter class. You can replace the formatter in the default handler which will be found in the root logger that you can customize to format your log messages how ever you want. Java Loggers form a tree which all end at the root logger. Each logger can have zero or more Handlers which are responsible for outputting the log messages in some format. All builtin Handlers use a formatter to format each log message before outputting it. The root logger usually contains a default Handler that prints to stdout/stderr and uses a SimpleFormatter object as it's formatter. You can disable the use of the default handler, replace it's formatter, or disable the use of parent Loggers to stop output to console.

http://stackoverflow.com/comment/39372910
score: 0
comment on: http://stackoverflow.com/q/25268370
has text: you're going to have a problem any time `n` is odd because the resulting exponent will lose a 0.5
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25314004
downvote count: 2
tagged with: string
has body: I have a input file which looks like: 059790355;61033755;026466086;19 ;NOMBRE GENERICO APELLIDO GENERICO ;BAA;1CXX;1;2013-04-12;2014-02-12;352082056559802 ; When I run the program I get the output as: 059790355;61033755;026466086;19;NOMBREGENERICOAPELLIDOGENERICO;BAA;1CXX;1;2013-04-12;2014-02-12;352082056559802; But I require the output to be: 059790355;61033755;026466086;19;NOMBRE GENERICO APELLIDO GENERICO;BAA;1CXX;1;2013-04-12;2014-02-12;352082056559802; The name attribute should have white spaces. My program is: { System.out.println("Usage: APP &lt;INPUT_FILE&gt; &lt;OUTPUT_FILE&gt;"); return; } try { File fout = new File(args[1]); FileOutputStream fos = new FileOutputStream(fout); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos)); File file = new File(args[0]); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); StringBuffer stringBuffer = new StringBuffer(); String line= bufferedReader.readLine(); while ((line = bufferedReader.readLine()) != null) { line = line.trim(); line = line.replaceAll("\\s+", ""); bw.write(line); bw.newLine(); } bw.close(); fileReader.close(); } catch (IOException e) { e.printStackTrace(); } } How can this be fixed?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25314035
score: -2
tagged with: regex
has comment: http://stackoverflow.com/comment/39457518
has answer: http://stackoverflow.com/a/25314079
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25314079
answer count: 2
has title: Removed white spaces from a program but need to have white spaces at one point
accepted answer: http://stackoverflow.com/a/25314035
upvote count: 0
tagged with: java

http://stackoverflow.com/comment/39473910
score: 0
comment on: http://stackoverflow.com/a/25322576
type: AnswerComment
type: Comment
has text: @alfasin that is the main reason why they recommend it. It is meant that Objects that are equal according to equals() they must also have the same hashcode. The default implementation of Object.hashCode() does not guarantee that. Most implementations use the memory location of the Object as it's hashCode(), but we aren't supposed to know that.

http://stackoverflow.com/q/25297396
score: 0
tagged with: java
has title: Loading/unloading specific modules in jboss-7
answer count: 1
tagged with: jboss7.x
has body: I want my jboss-7 to be configured in such a way that it will not load some specified modules while starting up. Is this achievable? If so, what should I do to achieve it. Thanks
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25298066
tagged with: jboss

php
tags question: http://stackoverflow.com/q/25292969
tags question: http://stackoverflow.com/q/25241019
tags question: http://stackoverflow.com/q/25282738
tags question: http://stackoverflow.com/q/25362674
tags question: http://stackoverflow.com/q/25309741
tags question: http://stackoverflow.com/q/25337386
tags question: http://stackoverflow.com/q/25239319
tags question: http://stackoverflow.com/q/25388610
tags question: http://stackoverflow.com/q/25314183
tags question: http://stackoverflow.com/q/25284967
tags question: http://stackoverflow.com/q/25319343
tags question: http://stackoverflow.com/q/25349516
tags question: http://stackoverflow.com/q/25283975
tags question: http://stackoverflow.com/q/25370643
tag name: php
tags question: http://stackoverflow.com/q/25271262
tags question: http://stackoverflow.com/q/25378412
tags question: http://stackoverflow.com/q/25236201
tags question: http://stackoverflow.com/q/25242634
tags question: http://stackoverflow.com/q/25323202
type: Tag
tags question: http://stackoverflow.com/q/25287619
tags question: http://stackoverflow.com/q/25236281

http://stackoverflow.com/comment/39422824
comment on: http://stackoverflow.com/q/25295194
has text: Try and include some details about what exactly happens when you have a 100 or a 0 in the input. Do you get an error message? If so, what does it say? Which line of code does it point to? What is the message trying to tell you?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/25254480
type: Answer
answers question: http://stackoverflow.com/q/25251936
score: 1
downvote count: 0
has body: Not really an answer, but way too long for a comment. invoking the toString() method in Expr is very expensive for large constraints. I'd suggest to look at the toString implementation. There's one possible reason for it being slow: dumb String concatenation instead of using StringBuilder. If so, then you might want to provide a faster implementation. However, solving a CSP whose printing takes too long is pretty futile, anyway. How to check whether two constraints are syntactically identical efficiently in Z3 I'd bet that using toString is not the way to go as a &amp;&amp; b and b &amp;&amp; a are equivalent, but their string representations are not. You'd probably need to normalize the expressions using commutativity, associativity, and maybe also other rules. For this you need some arbitrary but equals-consistent ordering on the terms. You surely don't want to check all pairs of constraints for equality. Here, putting the constrains into buckets according to their hash code helps. No idea, if the provided hashCode is usable for this purpose. Then I have to design my own equal() and hashCode() functions. But I still can't figure out an efficient way so far. After the normalization it should be rather simple. If you do the normalization consequently and map each expression to a canonical representation (just like String#intern does), then you can use reference equality for equals. For hashCode you need a combining formula for each tree node, for example you could compute the hash code of a &amp;&amp; b as f(111 * ha + hb), where ha and hb are the hash codes of a and b, respectively, and f(x) = x ^ (x&gt;&gt;15) or something like this.
upvote count: 1

http://stackoverflow.com/a/25325779
type: Answer
answers question: http://stackoverflow.com/q/25325763
downvote count: 0
score: 3
upvote count: 3
has body: It is called default access modifier or package private modifier. It means that class is accessible only within the package it is in.

http://stackoverflow.com/comment/39454654
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25312296
has text: I am running a test. Do i need to annotate the test? like @ContextConfiguration in case of spring?
type: Comment

http://stackoverflow.com/a/25262221
answers question: http://stackoverflow.com/q/25262026
has body: In java you can use ProcessBuilder class to execute any process or executable.Syntax for ProcessBuilder is as follows: Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe","param1","param2").start(); Now as you want to run avast antivirus engine you can run its using ProcessBuilder as follows: Process process = new ProcessBuilder("C:\\Program Files\\AVAST Software\\avast\\ashCmd.exe","D:\\pathtoscan"); The above code will scan pathtoscan folder in D: Drive.Similarly you can pass different parameters for avast as mentioned on their website. Hope this answer your question.
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/39312144
type: AnswerComment
comment on: http://stackoverflow.com/a/25234710
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59078/discussion-between-askmaniac-and-madprogrammer).
score: 0

http://stackoverflow.com/comment/39423026
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25295003
has text: So you're saying every date column will need an additional original_timezone column, too?
type: Comment

http://stackoverflow.com/q/25268174
favorite count: 0
has body: I keep getting method must return result of type byte[] public class MyClass { public static byte[] someMethod() { try { ... byte[] someByte = .... ; return someByte; } catch (Exception e) { e.printStackTrace(); } return someByte; } } How can I properly return something if there is try/catch block?
has answer: http://stackoverflow.com/a/25268535
has answer: http://stackoverflow.com/a/25268241
type: Question
has title: What's the deal with Java's return type in this example
downvote count: 2
accepted answer: http://stackoverflow.com/a/25268241
has answer: http://stackoverflow.com/a/25268268
has comment: http://stackoverflow.com/comment/39372467
has answer: http://stackoverflow.com/a/25268209
possible better answer: http://stackoverflow.com/a/25268208
has answer: http://stackoverflow.com/a/25268245
has comment: http://stackoverflow.com/comment/39372503
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25268208
score: 1
has answer: http://stackoverflow.com/a/25268529
has comment: http://stackoverflow.com/comment/39372430
answer count: 7

http://stackoverflow.com/a/25275965
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25273808
has comment: http://stackoverflow.com/comment/39402493
answers question: http://stackoverflow.com/q/25273808
type: Answer
has comment: http://stackoverflow.com/comment/39394825
has comment: http://stackoverflow.com/comment/39400360
has comment: http://stackoverflow.com/comment/39391353
has body: As said, you could use Scala formating before passing to @Html to display it without escaping. &lt;!-- language: scala --&gt; @Html(names.mkString("[",",","]")) // Formats list by starting with '[', ending with ']', with ',' as separator // aka JS format for array @Html(names.mkString("""["""", """","""", """"]""")) // wraps array values with "" N.B. If your string values contain " character, extra formatting would be required.
score: 0

http://stackoverflow.com/a/25358317
answers question: http://stackoverflow.com/q/25358141
type: Answer
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25358141
has body: The basic problem is Your first step should be registering the Driver using this Class.forName("com.mysql.jdbc.Driver"); Then try to get connection from DriverManager using this conn = DriverManager.getConnection(url); I guess you are doing it the reverse way

http://stackoverflow.com/comment/41571125
type: Comment
has text: Thanks. I got your solution to work for me. FYI, I also found that XStream will correctly marshal `Resource` and `Resources` objects using resource assemblers without additional configuration or annotation, but they are still in atom format.
comment on: http://stackoverflow.com/a/25569051
type: AnswerComment
score: 0

http://stackoverflow.com/a/25352350
score: 7
answers question: http://stackoverflow.com/q/25352329
type: Answer
has body: You have to specify the class that defines that method: Assert.assertTrue(condition); Furthermore you're calling the method with 2 parameters which makes no sense. assertTrue expects a single boolean expression. Although you can also do this by using a static import: import static org.junit.Assert.*; which will allow you to call it as assertTrue(condition); instead.
downvote count: 0
upvote count: 7

http://stackoverflow.com/a/25380516
answers question: http://stackoverflow.com/q/25380101
type: Answer
has body: You don't appear to be using an EntityManager, rather straightforward Hibernate SessionFactory. Another answer, Hibernate/JPA - Entity listener not being called properly, seems to suggest that this will not work without manually setting up the listeners.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39413249
type: QuestionComment
score: 0
has text: have you attempted just a simple use of edit distance? note that ed(john,jon)=1 whereas ed(john,johann)=2
comment on: http://stackoverflow.com/q/25273963
type: Comment

http://stackoverflow.com/a/25270960
score: 2
has body: import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; public class Main { public static void main(String[] args) throws Exception { String fromFileName = "demo1.txt"; String toFileName = "demo2.txt"; BufferedInputStream in = new BufferedInputStream(new FileInputStream(fromFileName)); BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(toFileName)); byte[] buff = new byte[32 * 1024]; int len = 0; while ((len = in.read(buff)) &gt; 0) //If necessary readLine() out.write(buff, 0, len); in.close(); out.close(); } } This will do the job :). Just specify what kind of byte size you are looking at, and from there use a loop to continue to read the file.
downvote count: 0
has comment: http://stackoverflow.com/comment/39377913
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25270259
has comment: http://stackoverflow.com/comment/39378103

http://stackoverflow.com/q/25319343
has comment: http://stackoverflow.com/comment/39969943
answer count: 1
tagged with: character-encoding
tagged with: utf-8
linked to: http://stackoverflow.com/q/7703434
type: Question
has comment: http://stackoverflow.com/comment/39911881
accepted answer: http://stackoverflow.com/a/26476760
has body: I am gathering data using Jsoup from a webpage that includes a php script linked to my database. The data that I am getting includes Navigational Coordinates like this: 51°42’.41N 004° 54’.61W The data displays correctly on the webpage but when I parse it using jsoup and insert the resulting strings into my app they include the Replacement Character U+FFFD � at certain points in the string...like this: 51�42�.41N 004� 54�.61W I can remove those specials by using this: .replaceAll("\uFFFD", "") However this then results in this: 51 42 .41N 004 54 .61W This isn't very desirable as these are navigational coordinates. Is Jsoup responsible for this or is it purely that Android cannot display these characters? Is it possible to 'catch' those characters before they are made into the � so I could match them with something similar that Android would display? For Example the character displayed in the Navigational coordinates is a "Ordinal" symbol º and I could replace it with a "degree" symbol ° . Additional: Code I am using to collect the Data: //Get the Notices to Mariners Amount Element ntmNumber = tableRows.select("td:eq(0)").last(); String ntmAmt = ntmNumber.text(); System.out.println("NtmLoadingTask is Running"); //In-case Data does not exist... if (tableRows != null) {//Exists... //Convert Ntm Number to int for Gathering the Ntm List int ntmInt = Integer.parseInt(ntmAmt); for (int i = 0; i < ntmInt; i++) { //Get Ntm Titles Elements titles = tableRows.select("td:eq(1)"); String ntmTitle = titles.get(i).text() + "\n"; arr_dataNtmTitles.add(ntmTitle); //Get Ntm Dates Elements dates = tableRows.select("td:eq(2)"); String ntmDates = dates.get(i).text() + "\n"; arr_dataNtmDates.add(ntmDates); //Get Ntm Content Elements contents = tableRows.select("td:eq(3)"); String ntmContent = contents.get(i).text().replaceAll("\uFFFD", "") + "\n"; arr_dataNtmContents.add(ntmContent); System.out.println(ntmContent); } Update 1: I have tried: .replaceAll("\u00BA", "\u00B0") with no success…
has answer: http://stackoverflow.com/a/26476760
tagged with: php
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40014342
score: 0
has comment: http://stackoverflow.com/comment/39921896
has title: Characters and symbols replaced with �
tagged with: java

http://stackoverflow.com/comment/39538069
type: AnswerComment
has text: Thanks, that is exactly what I wanted, after reading both references I have tested and works perfectly. I'm going to put the popup in the position of the cursor and I'll show the solution. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/25357355
score: 0

http://stackoverflow.com/a/25270942
downvote count: 0
answers question: http://stackoverflow.com/q/25269763
accepted answer of: http://stackoverflow.com/q/25269763
upvote count: 5
has comment: http://stackoverflow.com/comment/39389933
type: Answer
has body: @MapsId will share main entity's primary key as the child entity's primary key no need to insert foreign key in child entity. Hibernate will map both entity's PK and return us a single object.
has comment: http://stackoverflow.com/comment/39378554
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/39522124
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25349164
has text: I have to admit I don't know much of Tables. So I erased this paragraph

http://stackoverflow.com/comment/39571706
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25374941
has text: pDialog.dismiss(); call this method before intenting activity...
type: Comment

http://stackoverflow.com/q/25380952
tagged with: javascript
has answer: http://stackoverflow.com/a/25389505
has comment: http://stackoverflow.com/comment/39617566
type: Question
has comment: http://stackoverflow.com/comment/39582828
tagged with: gwt
score: 0
tagged with: java
has body: I've this GWT code: Button button = new Button("Search"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadData(); } }); ... private native void loadData() /*-{ $wnd.loadGrid(); }-*/; and this Javascript code: ... loadGrid : function (){ alert("Testing JSNI"); }, ... It doesn't works and the error is: Uncaught com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : undefined is not a function This is an example code because my target is to pass parameters from js to GWT, but I don't understand why it doesn't run. What's wrong? Thanks.
has comment: http://stackoverflow.com/comment/39589399
has comment: http://stackoverflow.com/comment/39588123
type: UnansweredQuestion
has title: How to linking Javascript and GWT to passing parameter
answer count: 1
has comment: http://stackoverflow.com/comment/39595567
has comment: http://stackoverflow.com/comment/39583021
has comment: http://stackoverflow.com/comment/39617852

http://stackoverflow.com/a/25336587
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25336236
has comment: http://stackoverflow.com/comment/39500638
has body: If all you need is to show the matrix, is as simple as this: public static void main(String args[]){ int[][] matrix = { {1,2,3}, {4,5,6}, {7,8,9} } int[][] results = yourfunction(matrix); for(int i=0;i&lt;results.length;i++){ for(int j=0;j&lt;results[i].length;j++){ System.out.print(results[i][j]+" "); } System.out.println(); } }
upvote count: 0
downvote count: 1

http://stackoverflow.com/q/25247569
tagged with: jdbc
has body: The movie which is inputted is successfully saved to moviesTbl table but then when I try to display the autonumber field 'MovieID' I retrieve errors. public void updateMovies(String update, String title, java.sql.Date releaseDate, String genre) throws SQLException { Connection connection = dc.DatabaseConnection(); PreparedStatement statement = connection.prepareStatement(update); //the insert statement is prepared statement.setString(1, title); //each attribute is set individually statement.setDate(2, releaseDate); statement.setString(3, genre); statement.executeUpdate(); statement.close(); ResultSet ID = dc.query("Select * from moviesTbl where title = " + title + " and genre = " + genre + " and releaseDate = " + releaseDate); //a ResultSet is prepared for the ID of the movie while(ID.next()) { //the ResultSet is prepared for display int movieID = ID.getInt("MovieID"); JOptionPane.showMessageDialog(null, "The movie's ID is " + movieID + ". Please record it on the DVD for future reference."); } } Errors: Exception in thread "main" net.ucanaccess.jdbc.UcanaccessSQLException: user lacks privilege or object not found: HARRY at net.ucanaccess.jdbc.UcanaccessConnection.prepareStatement(UcanaccessConnection.java:462) at movierentalstore.DatabaseConnection.query(DatabaseConnection.java:63) at movierentalstore.QueryingTheDatabase.updateMovies(QueryingTheDatabase.java:181) at movierentalstore.MovieRentalStore1.&lt;init&gt;(MovieRentalStore1.java:77) at movierentalstore.MovieRentalStore1.main(MovieRentalStore1.java:25) Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: HARRY at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCPreparedStatement.&lt;init&gt;(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source) at net.ucanaccess.jdbc.UcanaccessConnection.prepareStatement(UcanaccessConnection.java:460) ... 4 more Caused by: org.hsqldb.HsqlE…
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39334408
answer count: 1
has comment: http://stackoverflow.com/comment/39336068
tagged with: ms-access
accepted answer: http://stackoverflow.com/a/25248455
type: Question
has answer: http://stackoverflow.com/a/25248455
tagged with: resultset
has title: Error displaying the autonumber field from a ResultSet
tagged with: java

http://stackoverflow.com/comment/39576956
type: QuestionComment
comment on: http://stackoverflow.com/q/25376221
score: 1
type: Comment
has text: Java guarantees each class will be initialised once when it is first needed, which gives you all you need for once only initialisation.

http://stackoverflow.com/comment/39320956
score: 0
has text: i have also checked http://stackoverflow.com/q/24100615/3472378 but no answer.
type: QuestionComment
comment on: http://stackoverflow.com/q/25240548
type: Comment

http://stackoverflow.com/a/70787108
answers question: http://stackoverflow.com/q/25258529
score: 0
has body: If what you want is just to convert a primitive integer array to a JSONArray, cut the long story short. JSONArray jsonArray = new JSONArray(Arrays.asList(longArray).get(0)); * You will need a try/catch block
type: Answer

http://stackoverflow.com/comment/39360306
type: Comment
type: QuestionComment
has text: Should I just have the client upload JSON with the fields encoded in base64, and take the 25% hit? Or should I have the JSON object being represented as some sort of "json" variable in a Multipart/form-data request, and have the binary files to be uploaded as another variable or separate JSON file not together with the JSON data to reduce the overhead?
score: 0
comment on: http://stackoverflow.com/q/25259259

http://stackoverflow.com/comment/48302207
has text: Still a problem for me using Windows 2008 Server 64Bit
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25357704
type: AnswerComment

http://stackoverflow.com/comment/39391057
type: Comment
comment on: http://stackoverflow.com/a/25278207
type: AnswerComment
score: 0
has text: Same as before. If the code throws and NPE, the handler will catch it. The only possible difference is that the new call *might* throw an exception. If that happened, you wouldn't *attempt* to call the `getBusinessKey` method.

http://stackoverflow.com/comment/39562421
score: 0
comment on: http://stackoverflow.com/q/25370751
type: Comment
type: QuestionComment
has text: @nikpon we don't know if there's a Servlet that handle the calls. Note that you can have a servlet which URL can be the exact URL for a valid JSP but the servlet will handle the request, not the JSP.

http://stackoverflow.com/q/25381228
type: AnsweredQuestion
score: 0
tagged with: oop
tagged with: java
answer count: 1
tagged with: decorator
accepted answer: http://stackoverflow.com/a/25391394
type: Question
has comment: http://stackoverflow.com/comment/39581440
has answer: http://stackoverflow.com/a/25391394
has comment: http://stackoverflow.com/comment/39585855
has title: Decorator pattern: Is it required that all decorators add value despite the sequence of initialization
tagged with: design-patterns
has body: I have a question about the decorator and his sequence of initializing. Is it required the each decorator can be extended by each other decorator, or is it also oke if there are restrictions with extending the decoraters. For example: Subject subject = new Subject(); decorator = new ErrorHandlingDecorator(subject); //Extends for error handling, when error is detected it interupt the current thread. decorator = new ExecuteFunctionDecorator(decorator); //Execute a function and run the executeFunction() on his parent. decorator.executeFunction(); Here the ExecuteFunctionDecorator can pass the result to the ErrorHandlingDecorator because it first execute the function. But when you initialize it like the code below the ErrorHandlingDecorator is useless because it first checks the error and then execute the function. Subject subject = new Subject(); decorator = new ExecuteFunctionDecorator(subject); //Execute a function and run the executeFunction() on his parent. decorator = new ErrorHandlingDecorator(decorator); //Extends for error handling, when error is detected it interupt the current thread. So my question is: is this example still a decorator or is it required that all decorators add value despite the sequence of initialization, or is ok that a decorator can be meaningless after a 'incorrect' initialization? Any related information is welcome. Regards,

http://stackoverflow.com/comment/70146597
type: QuestionComment
comment on: http://stackoverflow.com/q/25373053
score: 3
has text: Spring security not necessarily means OAuth, you can do Basic Auth for example.
type: Comment

http://stackoverflow.com/a/25310547
type: Answer
answers question: http://stackoverflow.com/q/25306545
score: 0
has body: A better and cleaner approach would be to encapsulate the 'field' field. class Foo{ private static Set field; private static Set field() { // &lt;- may need to change to protected or public of default visibility depending on your use case if (field == null) { // Double-checked locking works perfectly, no need to mark 'field' volatile. synchronized(Foo.class) { if (field == null) { field = Operation.getInstance(); } } } return field; } void bar(){ // use Foo.field() everywhere instead of Foo.field; } }

focus
tags question: http://stackoverflow.com/q/25274566
tags question: http://stackoverflow.com/q/25254769
type: Tag
tag name: focus
tags question: http://stackoverflow.com/q/25317684

http://stackoverflow.com/comment/39334298
type: Comment
type: AnswerComment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
comment on: http://stackoverflow.com/a/25246732
score: 0

http://stackoverflow.com/q/25274828
tagged with: java
has answer: http://stackoverflow.com/a/25275053
has comment: http://stackoverflow.com/comment/39392407
has comment: http://stackoverflow.com/comment/39392071
has comment: http://stackoverflow.com/comment/39392346
has comment: http://stackoverflow.com/comment/39392513
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39392556
accepted answer: http://stackoverflow.com/a/25279281
linked to: http://stackoverflow.com/q/16558869
answer count: 2
score: 5
upvote count: 5
has body: I need to know the clients ip addresses, Here is my cod public static void main(String[] args) throws Exception { server = HttpServer.create(new InetSocketAddress(8000), 0); server.createContext("/", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); System.out.println("Client ip is: " + server.getAddress().getAddress()); } handler: public static class MyHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { t.getRemoteAddress().getAddress(); // t is 0:0:0:0:0:0:0: } } Result: Client ip is: /0:0:0:0:0:0:0:0 Why i cant get real clients ip?
has title: Get client ip from HttpServer
possible better answer: http://stackoverflow.com/a/25275053
linked to: http://stackoverflow.com/q/1840420
has comment: http://stackoverflow.com/comment/39392421
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25279281
has comment: http://stackoverflow.com/comment/39392308
has comment: http://stackoverflow.com/comment/39385208
has comment: http://stackoverflow.com/comment/39385304
downvote count: 0
has comment: http://stackoverflow.com/comment/39385167

http://stackoverflow.com/a/25378831
has body: The error is pretty clear here: you cannot access a external variable inside an inner class without making it final. So just add final in front of TextField franchSize = new TextField();
type: Answer
answers question: http://stackoverflow.com/q/25378772
score: 0

apache
tags question: http://stackoverflow.com/q/25283257
tags question: http://stackoverflow.com/q/25376841
tag name: apache
tags question: http://stackoverflow.com/q/25380835
tags question: http://stackoverflow.com/q/25301195
tags question: http://stackoverflow.com/q/25345401
tags question: http://stackoverflow.com/q/25284617
tags question: http://stackoverflow.com/q/25299119
type: Tag
tags question: http://stackoverflow.com/q/25289279
tags question: http://stackoverflow.com/q/25239260
tags question: http://stackoverflow.com/q/25372852
tags question: http://stackoverflow.com/q/25280891
tags question: http://stackoverflow.com/q/25298537
tags question: http://stackoverflow.com/q/25279190
tags question: http://stackoverflow.com/q/25338592
tags question: http://stackoverflow.com/q/25258153
tags question: http://stackoverflow.com/q/25359748
tags question: http://stackoverflow.com/q/25249893
tags question: http://stackoverflow.com/q/25323314
tags question: http://stackoverflow.com/q/25385350

http://stackoverflow.com/q/25345171
has comment: http://stackoverflow.com/comment/39562509
favorite count: 0
type: Question
tagged with: timer
has comment: http://stackoverflow.com/comment/39515064
has body: Below is a pretty simple method that takes a Date and an id for an alarm to be fired which starts a countdown. For some reason I don't understand, if I call it once with one date and id 0 and call it again with another date and id 1 (i.e., two different countdowns), Android will fire both alarms at the same time (specifically the first date passed with id 0) so both countdowns start at the same time. Can anyone tell me why and how to fix it? Thanks! public void setCountdownAlarm(Date fireTime, int id) { // startCountdown will be called at fireTime BroadcastReceiver startCountdown = new BroadcastReceiver() { @Override public void onReceive( Context context, Intent theIntent ) { countdownTimer = new Timer(); countdownTimer.schedule(new TimerTask() { @Override public void run() { onSecondTick(showtime); } }, 0, 100); // call every 10th of a second } }; this.registerReceiver( startCountdown, new IntentFilter("com.counter.app.CountActivity.COUNT") ); Intent intent = new Intent("com.counter.app.CountActivity.COUNT"); PendingIntent pintent = PendingIntent.getBroadcast( this, id, intent, 0 ); AlarmManager manager = (AlarmManager)(this.getSystemService( Context.ALARM_SERVICE )); if (Build.VERSION.SDK_INT &gt;= 19) manager.setExact(AlarmManager.RTC_WAKEUP, fireTime.getTime(), pintent); else manager.set(AlarmManager.RTC_WAKEUP, fireTime.getTime(), pintent); } Editing to say that when I waited for the second alarm to fire, Android actually calls startCountdown twice -- once again for each alarm. Help!
has comment: http://stackoverflow.com/comment/39592260
has comment: http://stackoverflow.com/comment/39515485
tagged with: android
has title: Why do Android alarms fire at the same time?
tagged with: alarm
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25386784
downvote count: 0
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25386784

http://stackoverflow.com/q/25385905
has comment: http://stackoverflow.com/comment/39593469
duplicate of: http://stackoverflow.com/q/2808535
tagged with: double-precision
has comment: http://stackoverflow.com/comment/39591619
answer count: 5
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/39591564
duplicate of: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/39608802
linked to: http://stackoverflow.com/q/2808535
score: -1
has answer: http://stackoverflow.com/a/25386098
has answer: http://stackoverflow.com/a/25385975
upvote count: 1
has title: Java Double object storing till two decimal places
has answer: http://stackoverflow.com/a/25386013
has answer: http://stackoverflow.com/a/25385992
linked to: http://stackoverflow.com/q/14845937
has answer: http://stackoverflow.com/a/25386070
has body: Is it possible to store java.lang.Double to exactly two decimal places Ex : 0.2 becomes 0.20 I modified the code to following Double correlation = getSomeDoubleValue(label, key, date); DecimalFormat df = new DecimalFormat("0.00"); correlation = Double.valueOf(df.format(correlation)); but when function getSomeDoubleValue() returns 0.2 , df.format(correlation) makes it 0.20 but as i need java.lang.Double , then Double.valueOf("0.20") gives me 0.2 back. I am not sure how to achieve this or if its achievable at all.
linked to: http://stackoverflow.com/q/8819842
has comment: http://stackoverflow.com/comment/39590915
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39590682
favorite count: 0
type: Question

http://stackoverflow.com/comment/39359971
comment on: http://stackoverflow.com/a/25250095
score: 0
type: Comment
type: AnswerComment
has text: This is not said anywhere in the Javadoc. Plus, if you set up a custom `ServerSocketFactory`, you have not guarantee that `new ServerSocket(32768)` will listen on 0.0.0.0

http://stackoverflow.com/comment/39566875
comment on: http://stackoverflow.com/a/25372559
type: AnswerComment
score: 0
type: Comment
has text: and the funny thing, even when I have double, and input a double, I get inputmismatchexception.. which is the same thing I get as if I have int

http://stackoverflow.com/comment/39517914
type: Comment
type: QuestionComment
has text: I had thought Java generally ran in a single process. Do you mean two different threads?
comment on: http://stackoverflow.com/q/25346804
score: 0

http://stackoverflow.com/comment/39431096
comment on: http://stackoverflow.com/a/25298611
score: 0
type: Comment
has text: And when putting a breakpoint on .registerTypeAdapter line you see it getting there? I tried this with main() and it worked for me.
type: AnswerComment

http://stackoverflow.com/a/25329434
downvote count: 0
answers question: http://stackoverflow.com/q/25329413
has body: You have references not pointers, and a method cannot update the callers reference without an assignment in the caller - so this public App() { Thing t = null; doStuff(t); System.out.println(t); } public void doStuff(Thing a) { a = new Thing(); } Would work if you did, public App() { Thing t = null; t = doStuff(t); System.out.println(t); } public Thing doStuff(Thing a) { a = new Thing(); return a; }
score: 3
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25329413
type: AcceptedAnswer

http://stackoverflow.com/a/25369494
score: 1
answers question: http://stackoverflow.com/q/25369416
type: Answer
has body: It is a anonymous class which will allow you to implement an interface. From the Oracle docs: The anonymous class expression consists of the following: The new operator The name of an interface to implement or a class to extend. In this example, the anonymous class is implementing the interface HelloWorld. Parentheses that contain the arguments to a constructor, just like a normal class instance creation expression. Note: When you implement an interface, there is no constructor, so you use an empty pair of parentheses, as in this example. A body, which is a class declaration body. More specifically, in the body, method declarations are allowed but statements are not.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25369416

http://stackoverflow.com/comment/39501695
comment on: http://stackoverflow.com/a/25337276
type: Comment
type: AnswerComment
has text: yes @StephenC you are right, i just conveyed both objects are different.
score: 0

http://stackoverflow.com/comment/39565601
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25371836
type: AnswerComment
has text: Yeah, I've also had a lot of trouble with it, especially now with streams (try filtering out null!). If nothing else, you definitely have to ignore "Unchecked conversion from non-annotated type to `@NonNull` type". I've managed to work around other warnings/errors so far with the help of a few utility methods to convert `@Nullable T` to `@NonNull T`, similar to Optional's "orElse" methods.

oauth-2.0
type: Tag
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/25302794
tags question: http://stackoverflow.com/q/25356146
tags question: http://stackoverflow.com/q/25255232
tags question: http://stackoverflow.com/q/25276771

http://stackoverflow.com/a/25261169
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25261069
has comment: http://stackoverflow.com/comment/39360586
type: AcceptedAnswer
score: 4
has body: Generally speaking, if a field is not present in your equals() method, you shouldn't reference it in your hashCode() method. This ensures your hashcode() result will not change more often that your equals() result does. Consider changing your method to: @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(17, 37); hcb.append(this.getName()); return hcb.toHashCode(); } That being said, it's rarely a good idea to create a non-intuitive equals() method. I would naturally assume your method would consider the password too, as might many of your future maintainers. Unit tests may be harder to write if true equality testing isn't conducted. Consider whether it would be better to create your own method, e.g. public boolean usernameEquals(User other) { ... }
downvote count: 0
answers question: http://stackoverflow.com/q/25261069

http://stackoverflow.com/comment/39357593
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25247418
type: Comment
has text: ok - your standalone example does not compile, but even though I decided to give it a try in my project. Funny thing - JetBrains IntelliJ marks this line I mentioned as an error, but whole projects compile (!), and even better - it's working :) I don't get it how, with marked error this is working, but it does :) and it's fast as hell:)

http://stackoverflow.com/comment/39439234
score: 0
type: Comment
has text: +1 [for example](http://stackoverflow.com/a/14980155/714968)
type: AnswerComment
comment on: http://stackoverflow.com/a/25304129

http://stackoverflow.com/a/25317193
has body: I think the problem is that is your ArrayList is just initially empty and unless you have something in your while loop that adds elements to that ArrayList, then you'll stay stuck in that loop. If you want to do something when two buttons are clicked, you could have two separate boolean variables that are each set to true once the button is clicked: // boolean instance variables boolean button1Clicked = false, button2Clicked = false; ... // set the OnClickListeners button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { button1Clicked = true; doSomething(); } }); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { button2Clicked = true; doSomething(); } }); ... // the method to be called every time you click either button private void doSomething(){ if (button1Clicked &amp;&amp; button2Clicked){ // but only executes what's inside here unless both buttons were clicked // do something } } Hope this helped!
downvote count: 0
answers question: http://stackoverflow.com/q/25316903
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/39576868
score: 0
comment on: http://stackoverflow.com/q/25378422
has text: I am not sure. The table is not created by my team. We only read the data in this table, and have no control over it.
type: Comment
type: QuestionComment

machine-learning
type: Tag
tags question: http://stackoverflow.com/q/25273963
tags question: http://stackoverflow.com/q/25377194
tag name: machine-learning

http://stackoverflow.com/q/25257392
has answer: http://stackoverflow.com/a/25257649
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39393520
has comment: http://stackoverflow.com/comment/39353480
score: -1
has title: Unable to start activity ComponentInfo ... java.lang.NullPointerException
upvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39436179
downvote count: 1
favorite count: 0
tagged with: admob
type: Question
has body: I am trying to use AdMob ads ina simple game I created with the help of this tutorial, but I am getting a NullPointerException error that I can't seem to figure out. Here is the AndroidGame class that I modified to include a linear layout (which I believe is necessary for AdMob ads) package com.kilobolt.framework.implementation; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.os.Bundle; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.view.Window; import android.view.WindowManager; import com.harryhochwarter.frugalfarminggame.R; import com.kilobolt.framework.Audio; import com.kilobolt.framework.FileIO; import com.kilobolt.framework.Game; import com.kilobolt.framework.Graphics; import com.kilobolt.framework.Input; import com.kilobolt.framework.Screen; public abstract class AndroidGame extends Activity implements Game { AndroidFastRenderView renderView; Graphics graphics; Audio audio; Input input; FileIO fileIO; Screen screen; WakeLock wakeLock; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; int frameBufferWidth = isPortrait ? 480: 800; int frameBufferHeight = isPortrait ? 800: 480; Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth, frameBufferHeight, Config.RGB_565); float scaleX = (float) frameBufferWidth / getWindowManager().getDefaultDisplay().getWidth(); float scaleY = (float) frameBufferHeight / getWindowManager().getDefaultDisplay().getHeight(); renderView = new AndroidFastRenderView(this, frameBuffer); graphics = new AndroidGraphics(getAss…
has comment: http://stackoverflow.com/comment/39393463

http://stackoverflow.com/q/25357672
upvote count: 3
tagged with: java
has body: StringBuilder sb = new StringBuilder(); for(int i =0; i&lt;8000; i++){ sb.append("5"); } BigInteger bi = new BigInteger(sb.toString()); System.out.println(bi); I'm unable to display such a huge number on console(Using eclipse). Also, getting timeout for huge numbers. Kindly help in displaying huge numbers on console.
downvote count: 1
tagged with: console
favorite count: 0
type: Question
has title: How to display 10000 digits in Eclipse console?
has answer: http://stackoverflow.com/a/25357691
type: UnansweredQuestion
answer count: 1
tagged with: biginteger
score: 2

http://stackoverflow.com/comment/39548332
comment on: http://stackoverflow.com/a/25363655
type: AnswerComment
score: 1
has text: They're not asking for an alternative, they're asking what the differences between the two implementations are.
type: Comment

http://stackoverflow.com/q/25271159
answer count: 1
accepted answer: http://stackoverflow.com/a/25282894
type: Question
has title: How to add custom label on axis in TeeChart Android?
has body: I'm trying to add a custom label on a vertical left axis on my chart: TChart chart = ... [...] Candle series = new Candle(chart.getChart()); series.fillSampleValues(50); chart.addSeries(series); [...] Axis leftAxis = chart.getAxes().getLeft(); TextShape label = new TextShape(chart.getChart()); leftAxis.drawAxisLabel(leftAxis.getPosition(), leftAxis.calcPosValue(500), 0, "CLOSE", label); [...] I'm getting an exception: Caused by: java.lang.NullPointerException at com.steema.teechart.android.Graphics3DAndroid.rectangle(Graphics3DAndroid.java:168) at com.steema.teechart.TextShape.internalDrawShape(TextShape.java:345) at com.steema.teechart.TextShape.drawRectRotated(TextShape.java:387) at com.steema.teechart.axis.Axis.drawAxisLabel(Axis.java:2915) at com.steema.teechart.axis.Axis.drawAxisLabel(Axis.java:2649) at com.forexite.chart.teechart.TeeChartFragment.addSeries(TeeChartFragment.java:102) at com.forexite.chart.teechart.TeeChartFragment.onCreateView(TeeChartFragment.java:43) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1504) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:571) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) at android.app.Activity.performStart(Activity.java:5241) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157) ... 11 more Here's an exampled that I found for the similar question: http://www.teechart.net/support/viewtopic.php?f=4&amp;t=8092&amp;p=32273&amp;hilit=drawAxisLabel#p32273 Could anyone suggest how to walkaround my issue?
tagged with: android
tagged with: teechart
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25282894
score: 0
tagged with: java

http://stackoverflow.com/a/25926141
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25276260
accepted answer of: http://stackoverflow.com/q/25276260
score: 1
type: Answer
has body: Everything throws DataAccessException. That is one of the fundamental points of Spring Data. We translate the C* exceptions into predictable, standard exceptions thrown by all Spring Data modules. http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/dao/DataAccessException.html?is-external=true
type: AcceptedAnswer

http://stackoverflow.com/q/25341477
has comment: http://stackoverflow.com/comment/39509211
score: 0
duplicate of: http://stackoverflow.com/q/13662001
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39509214
has body: My name is Nitin Nagpal. I am having a query which was given to me by my friend as a challenge to which I was not able to solve till yet even after expiration of given time period. static int expression("10+20+20+20") He want sum of this string ("10+20+20+20") = 70 without using default functions available in Java. We have to put logic only to solve this example.
has title: How to find sum of given string which is already having + operater through which it is jointed
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39458176
score: 0
has text: "*doesn't seem to work*" is not right problem description. Add more details about what you expected and what you got instead so we could help you easier and people with similar problem would also be able to find your question and read answers to it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25314324

http://stackoverflow.com/comment/39578204
score: 0
type: Comment
has text: No no, the WORK_QUEUE_SIZE determines how many pending Futures you can have at any point in time. You can put 1 there if you like.
comment on: http://stackoverflow.com/a/25378547
type: AnswerComment

http://stackoverflow.com/comment/39302094
score: 0
comment on: http://stackoverflow.com/q/25230753
type: QuestionComment
has text: by `Car myCar = new Car();` you create the instance of that class. Then you can execute methods of that class like `myCar.drive();` You could store the newly created instance in a data structure or an instance variable of the class your working with, for example. I really recommend completing some Java beginners tutorials. There are tons of them online. Good luck
type: Comment

http://stackoverflow.com/comment/39595679
score: 0
type: Comment
type: QuestionComment
has text: The "T extends Enum<T>" is the apparently the trick for this problem. Using implements gave me errors.
comment on: http://stackoverflow.com/q/25388044

http://stackoverflow.com/a/25244758
has body: The reason is that the both are different objects and they are not ==. You'll get "Same" when both instances pointing to same Object. A real world example might help you to understand: Take a ball having color red and say that is a redball1. Take another ball having color red and say that is a red ball2. Still both are different balls. :) And take a ball having color red and say that redball. Later you define that "A ball having color red is a redball"(which is implementing equals method of an Object in your class). Proper way to implement equals and it's effects of wrong implementation.
answers question: http://stackoverflow.com/q/25244725
score: 0
type: Answer

http://stackoverflow.com/comment/39459223
comment on: http://stackoverflow.com/a/25314840
type: AnswerComment
has text: I think it's not for me,I want to send custom objecto fragment don't want to get data from fragment.
score: 0
type: Comment

http://stackoverflow.com/comment/39336128
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25248147
type: Comment
has text: Yeah the size doesn't appear to be decreasing after the loop. Is there a way to get it to immediately remove the item?

http://stackoverflow.com/q/25297050
has title: Is there a way to list currently exported remote objects?
type: Question
tagged with: rmi
linked to: http://stackoverflow.com/q/9387203
accepted answer: http://stackoverflow.com/a/25297900
has answer: http://stackoverflow.com/a/25297900
type: AnsweredQuestion
has body: Remote objects extending UnicastRemoteObject are automatically exported to the RMI system after their creation. When the application is terminated, a thread will continue to run until all exported objects are collected by the remote garbage collector. This can be expedited by explicitely unexporting the objects before terminating the application (UnicastRemoteObject.unexportObject(obj, force)) I know how to maintain a list of remote objects created, for example this solution. I would like to know if the JVM maintains a user-accessible list of objects that have been exported, and are not yet unexported?
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/a/25328536
type: Answer
has body: You can use an Arraylist, it has a built in function called .contains() which checks if the arrayList contains a specific value. So you would create an arrayList of last names and if it doesn't exist in the array list, just add it. See http://docs.oracle.com/javase/1.5.0/docs/api/java/util/ArrayList.html#contains(java.lang.Object)
answers question: http://stackoverflow.com/q/25328454
score: 0

http://stackoverflow.com/comment/39346530
comment on: http://stackoverflow.com/a/25253793
has text: That's right, I should have clarified. nextLine should solve your issue.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39486895
has text: I still think you'd be better off storing anything that could be potentially that large as a CLOB (it should only be XMLTYPE if it represents a complete document). Downstream systems should be expecting something potentially huge and simply request it as such.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25329064

http://stackoverflow.com/comment/39419595
comment on: http://stackoverflow.com/q/25293368
type: Comment
type: QuestionComment
has text: @laune that aint true as long as the return is wrapped in a conditional block as is the case here
score: 0

http://stackoverflow.com/a/25257718
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25257513
has body: Most likely you pass an incorrect resource name, and since the class loader can't find it, getResource() will return null. Class.getResource(String name) expects a resource name relative to the location the class is loaded from. So if your resource is called image.jpg, then image.jpg must be in the same folder where the class is whose getResource() method you're calling. You can also specify an absolute folder inside the jar if you start it with the / character: getClass().getResource("/resources/images/image.jpg"); In this case the image.jpg must be in the /resources/images folder inside the jar or in your source folder (which will be copied to the bin folder by your IDE). You can also navigate up one (or more) folder compared to the folder of the class with the ".." literal, e.g.: getClass().getResource("../images/image.jpg"); In this case the image.jpg file must be in the images subfolder of the parent folder compared to the folder of the class. Note: The Class object whose getResource() method you call can be acquired like YourClassName.class or if you want to refer to the class of the current instance: getClass().
score: 3
type: Answer
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25257513

path-variables
tags question: http://stackoverflow.com/q/25302797
type: Tag
tag name: path-variables

http://stackoverflow.com/q/25323286
answer count: 1
downvote count: 0
tagged with: jar
upvote count: 1
tagged with: file-upload
has body: Does anyone know how to get Netbeans to auto transfer JAR files of standalone Java app to remote location? I've searched the web over but have found nothing for JAR files. I've looked into FTP Site Deployer plugin http://plugins.netbeans.org/plugin/39197/ftpsitedeployer, which is aimed at JSP and PHP. Another site I came across - http://ilite.wordpress.com/2013/06/18/using-ftp-from-within-netbeans/ - is also aimed at web development. The dream solution/plug-in would be when I click on "clean and build", it will auto trasnfer to remote location. If not, happy to do some more clicks after build to get it transferred. Would love to do everything in Netbeans. As to the method of transfer, am open to anything, whether it's via FTP or shell script (i'm using osx and remote location is a Debian box), or something else as long as it's open standard. Any suggestions folks? Thanks in advance. Cheers.
favorite count: 0
has comment: http://stackoverflow.com/comment/39475004
type: Question
has comment: http://stackoverflow.com/comment/39474883
has comment: http://stackoverflow.com/comment/39475326
has title: Netbeans: how to auto transfer standalone Java app's JAR file to remote location
accepted answer: http://stackoverflow.com/a/25323733
has answer: http://stackoverflow.com/a/25323733
type: AnsweredQuestion
tagged with: ftp
tagged with: netbeans
score: 1
tagged with: java

http://stackoverflow.com/comment/39566662
type: Comment
comment on: http://stackoverflow.com/a/25372559
score: 0
type: AnswerComment
has text: How is input an int? Isn't 1234,26 have a decimal value of "26"?

http://stackoverflow.com/q/25301819
downvote count: 4
has body: I am using isReachable() method of InetAddress class, to verify whether particular IPAddress is reachable or not. It is working fine when firewall is OFF, but why it is not functioning properly when I turned on firewall? Code is: InetAddress addr= InetAddress.getByName("192.168.100.5"); System.out.println(addr.isReachable(2000));
has comment: http://stackoverflow.com/comment/39440980
tagged with: java
has answer: http://stackoverflow.com/a/25301931
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39435202
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39435082
tagged with: network-programming
type: UnansweredQuestion
score: -3
has title: InetAddress.isReachable only works when firewall is turned off
has comment: http://stackoverflow.com/comment/39435003
has comment: http://stackoverflow.com/comment/39435147

http://stackoverflow.com/comment/39497395
score: 0
comment on: http://stackoverflow.com/a/25333876
type: AnswerComment
has text: Thanks, I have been overthinking things... I can tend to do that when I just think and think and never do. Thanks for the links, they should come in handy!
type: Comment

http://stackoverflow.com/comment/39392666
type: Comment
has text: u have posted 2 method to post cookies above?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25279129

http://stackoverflow.com/a/25373288
answers question: http://stackoverflow.com/q/25373220
type: Answer
accepted answer of: http://stackoverflow.com/q/25373220
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39567253
has body: It was really hard to understand your question but if you want to get the numbers after 3 spaces you can use this regex: ^(?:\S*\s+){3}(\d+) Working demo Match information: MATCH 1 1. [50-52] `78` MATCH 2 1. [114-116] `78`

http://stackoverflow.com/a/25384393
score: 0
has comment: http://stackoverflow.com/comment/39587869
has body: This is very simple if you use streams: final List&lt;String&gt; items = Arrays.asList("entry 1", "entry 2", "entry 3", "test 1", "test 2", "test 3"); final String searchString = "1"; final List&lt;String&gt; results = items.parallelStream() // work in parallel .filter(s -&gt; s.contains(searchString)) // pick out items that match .collect(Collectors.toList()); // and turn those into a result list results.forEach(System.out::println); Notice the parallelStream() which will cause the list to be filtered and traversed using all available CPUs. In your case you can use the results when the user expands the search term (while typing) to reduce the amount of items that need to be filtered, because if 's' matches all items in result, all those that match 'se' will be a sub-list of result.
has comment: http://stackoverflow.com/comment/39606242
type: Answer
has comment: http://stackoverflow.com/comment/39588133
answers question: http://stackoverflow.com/q/25384010

http://stackoverflow.com/comment/45379319
type: QuestionComment
comment on: http://stackoverflow.com/q/25345307
has text: Associated bug report was closed as cannot reproduce with the comment "Confirmed: Happens in 8, does not happen in 8u20 and 8u40 dev."
score: 0
type: Comment

http://stackoverflow.com/a/25258381
score: 0
has body: You can create the bean using a factory: &lt;bean id="bridgePropertyPlaceholderConfigurerFactory" class="foo.bar.BridgePropertyPlaceholderConfigurerFactory" /&gt; &lt;bean id="bridgePropertyPlaceholder" factory-bean="bridgePropertyPlaceholderFactory" factory-method="createBridgePropertyPlaceholderConfigurer" /&gt; Java factory: public class BridgePropertyPlaceholderConfigurerFactory { public BridgePropertyPlaceholderConfigurer createBridgePropertyPlaceholderConfigurer() { // your creation code .. return .. } } Have a look at the documentation for more details on factory methods.
type: Answer
answers question: http://stackoverflow.com/q/25258125

http://stackoverflow.com/comment/39509678
has text: Why would you want to do that? System L&F mimic quite closely what usually happens on the native L&F. On Windows, even if the menu is disabled, on windows it get still highlighted. Users will expect this to happen.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25341801

http://stackoverflow.com/comment/39304453
has text: @sanjeevmk I would still note that it's a bad idea to read a whole file into memory before processing it, unless your processing is mostly going to be random access (jumping around all over the file). As the file gets bigger you are going to increase memory consumption for no good reason. This can result in other memory pages being swapped out, lowering overall system performance. As a general rule, if you need to process the file sequentially then only read in what you need, and discard it when you are done with it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25231799
type: Comment

http://stackoverflow.com/a/25286862
answers question: http://stackoverflow.com/q/25286755
downvote count: 1
type: Answer
score: -1
has body: If you want to split by a single whitespace, why don't you do it? String[] line = parse.split(" ");
upvote count: 0

http://stackoverflow.com/q/25285656
tagged with: java
has comment: http://stackoverflow.com/comment/39404966
tagged with: ksoap2
downvote count: 1
has answer: http://stackoverflow.com/a/25285869
has comment: http://stackoverflow.com/comment/39404833
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39404495
upvote count: 0
type: UnansweredQuestion
has title: Create SOAP request header
tagged with: android
answer count: 1
tagged with: soap
score: -1
has body: I want to create SOAP request programatically having following structure by using the ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar : <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://www.google.com/Consumer/"> <soapenv:Header> <con:RequestHeader> CUSTREG MOBREG MOBREG LOGIN </con:RequestHeader> </soapenv:Header> <soapenv:Body> <con:Login> +911234567890 123456 </con:Login> </soapenv:Body> </soapenv:Envelope> Thanks in Advance.

http://stackoverflow.com/a/25250408
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25250367
has comment: http://stackoverflow.com/comment/39340562
has body: You populate a different object than you're displaying, so no wonder you get no values. You should change main to public static void main(String[] args) { // Instantiate classes ShippedOrder objShip=new ShippedOrder(); //Promt for data objShip.SetName(); objShip.SetNum(); objShip.SetPrice(); objShip.SetQuantity(); // Display objShip.Display(); } because every ShippedOrder is also an Order.
type: Answer
upvote count: 1

http://stackoverflow.com/q/25262994
has comment: http://stackoverflow.com/comment/39362904
score: 3
has comment: http://stackoverflow.com/comment/39363070
upvote count: 3
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/32946716
has answer: http://stackoverflow.com/a/25263195
has title: AsycTask Throwing IllegalStateException - Fragment Not Attached To Activity
favorite count: 0
type: Question
answer count: 2
tagged with: exception
type: UnansweredQuestion
tagged with: android
has body: I have the following AsyncTask in my Android application. This AsyncTask is contained with within the OnCreate() method of a class that extends PreferenceFragment. public class NotificationsPreferenceFragment extends PreferenceFragment { private static Context context; public NotificationsPreferenceFragment() { } public NotificationsPreferenceFragment(Context context) { this.context = context; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_notifications); getPreferenceManager().findPreference(getString(R.string.send_all_notifications)) .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { class NotificationSendTask extends DialogAsyncTask { public static final String TAG = "NotificationFragment"; public NotificationSendTask(Activity activity, String dialogMsg) { super(activity, dialogMsg); } @Override protected String doInBackground(String... params) { String url = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString(getString(R.string.notification_web_service_url), getString(R.string.default_notification_web_service_url)); if (NetworkingHelper.isNetworkAvailable(getActivity())) { NotificationDao notificationDao = new NotificationDaoImpl(DatabaseManager.getInstance(getActivity().getApplicationContext()), getActivity().getApplicationContext()); List&lt;Notification&gt; unsentNotificationList = notificationDao.findAllNotSent(); if (unsentNotificationList.size() != 0) { NotificationSenderTask ns = new NotificationSenderTask(url, context); try { if (ns.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (unsentNotificationList)).get()) { return getString(R.string.success); } } catch (InterruptedException e) { Log.e(TAG, e.getMessage()); } catch (ExecutionException e) { Log.e(TAG, e.getMessage()); } return getString(R.string.failed_to_send_notifications); } else { return getString…
tagged with: fragment

http://stackoverflow.com/a/25239149
score: 0
answers question: http://stackoverflow.com/q/25236748
has body: How about defining a bean in your Java config for this? @Bean public Map&lt;Integer, String&gt; myProps(Properties properties) { Map&lt;Integer, String&gt; map = new HashMap&lt;&gt;(); // implement logic to populate map from properties return map; } And in your class: @Autowirded Map&lt;Integer, String&gt; map;
has comment: http://stackoverflow.com/comment/39348072
type: Answer

http://stackoverflow.com/comment/39506605
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25338095
has text: Yes I got what you mean to say. I have made some changes in the code, and edited my post. Could you please check? I want to change the upper case values to lower case and dump the value present in source to a text file.
score: 0

http://stackoverflow.com/a/25356562
type: Answer
has comment: http://stackoverflow.com/comment/39535192
has comment: http://stackoverflow.com/comment/39555759
score: 0
has comment: http://stackoverflow.com/comment/39535397
has comment: http://stackoverflow.com/comment/39535424
answers question: http://stackoverflow.com/q/25356493
has body: There are probably any number of problems with this, but lets start with what seems obvious... ResultSet valeur1= stmtListeLivre.executeQuery("select id_groupe from groupe where libelle_groupe='"+combo_name.getSelectedItem().toString()+"'"); ResultSet valeur2= stmtListeLivre1.executeQuery("select id_statut from statut where valeur='"+jComboBox1.getSelectedItem().toString()+"'"); Number val1 = ((Number) valeur1.getObject(1)).intValue(); Number val2 = ((Number) valeur2.getObject(1)).intValue(); Neither valeur1 or valeur2 have been primed to the first (possible) record. When a ResultSet is returned, it's cursor (which record it's currently pointing to) is set to before the first record. You need to check if the ResultSet has a next record or not. Doing so will, if possible, move the cursor to the next record (or return false indicating it's reached the end of the ResultSet) Number val1 = null; Number val2 = null; if (valeur1.next()) { val1 = ((Number) valeur1.getObject(1)).intValue(); } if (valeur2.next()) { val2 = ((Number) valeur2.getObject(1)).intValue(); }
has comment: http://stackoverflow.com/comment/39535137
has comment: http://stackoverflow.com/comment/39535123
has comment: http://stackoverflow.com/comment/39535496
has comment: http://stackoverflow.com/comment/39535161
has comment: http://stackoverflow.com/comment/39565375

http://stackoverflow.com/comment/39553221
score: 0
type: AnswerComment
has text: "how??" what? Do you want me to make for you the code?
comment on: http://stackoverflow.com/a/25365832
type: Comment

http://stackoverflow.com/q/25362086
favorite count: 0
type: Question
has title: Java, generics mismatch
has answer: http://stackoverflow.com/a/25362244
answer count: 5
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25362259
has answer: http://stackoverflow.com/a/25362246
has body: Im new to JAVA programming, but used to programmed in Delphi/Pascal so I know about types. A domain class: public class Domain extends BaseObject { the BaseObject is just an abstract class: public abstract class BaseObject { There is a function which has to accept a domain: final Class&lt;BaseObject&gt; objectType = new Domain("1"); // here is an error something.load2(objectType); The load2 is public &lt;T extends BaseObject&gt; T load2 (Class&lt;T&gt; objectType, Object... parameters) { The problem is with the line in comment: Type mismatch: cannot convert from Domain to Class I thought the load2() may accept anything which extends BaseObject, so Domain too. Or am I wrong?
has answer: http://stackoverflow.com/a/25362218
score: 1
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25362209

http://stackoverflow.com/comment/39407308
type: Comment
type: QuestionComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ No not now.I have searched over it but dint get post related to it.Now I am going to understand contacts table structure.May be that can help.
score: 0
comment on: http://stackoverflow.com/q/25287175

http://stackoverflow.com/comment/39587309
type: AnswerComment
has text: HashMap is not O(1) since hashvalues for different objects are not always different. HashMaps internally use LinkedLists for all cases where more then one value exists for the same hashvalue. Thats why you need to implement the equals()-method
type: Comment
comment on: http://stackoverflow.com/a/25384074
score: 0

http://stackoverflow.com/q/25385880
has comment: http://stackoverflow.com/comment/39590817
tagged with: delimiter
has comment: http://stackoverflow.com/comment/39590561
has comment: http://stackoverflow.com/comment/39590720
has title: Using _ in number presentation in Java
has comment: http://stackoverflow.com/comment/39591362
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/39591004
tagged with: java
has comment: http://stackoverflow.com/comment/39592760
has comment: http://stackoverflow.com/comment/39590939
has comment: http://stackoverflow.com/comment/39592469
has body: There became available from Java 1.7 ability to use _ (underscore) character within numbers, to improve readability, like delimiting thousands in decimal: 123_456_789 or displaying conveniently credit card number: 1234_5678_9012_3456. I've just installed latest Java 8.0 (Eclipse IDE). And to support such a way - there is error advising me to redefine whole project as JRE1.7 (which is Java 7). Was this feature removed from Java 8 or am I missing any point here ?
has comment: http://stackoverflow.com/comment/39590680
has comment: http://stackoverflow.com/comment/39590594
tagged with: eclipse
type: Question
type: UnansweredQuestion

http://stackoverflow.com/a/25262842
answers question: http://stackoverflow.com/q/25262727
type: AcceptedAnswer
has body: //This is the only way i didn't get errors xD public void panelSwap(JFrame z, JPanel x, JPanel y) { z.remove(x); z.add(y); } LayoutManager hasn't any notifier implemented in API(s) that notify about changes in visible Swing GUI, you have to notify programatically by calling z.revalidate() and z.repaint() there is shortcuts by calling JFrame.pack() in the cases when you need to change JFrames bounds too use CardLayout, with JFrame.pack() in the cases when you need to change JFrames bounds
has comment: http://stackoverflow.com/comment/39362486
type: Answer
accepted answer of: http://stackoverflow.com/q/25262727
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/25288764
downvote count: 0
has answer: http://stackoverflow.com/a/25289785
possible better answer: http://stackoverflow.com/a/25289785
tagged with: java
has answer: http://stackoverflow.com/a/25292284
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25288856
has comment: http://stackoverflow.com/comment/39410350
has body: I have the below code to get data from a database and update it. How ever, result set is getting updated but, I don't see the changes in the database. Even after I say commit(), database is not getting updated. What am I missing here? Connection connect = ConnectionManager.getInstance().getConnection(); Statement st = connect.createStatement(); st.execute("Select * from ..."); ResultSet rs = st.getResultSet(); ResultSetMetaData md = rs.getMetaData() ; rs.absolute(1); rs.updateObject("StepName","ABCD" ); connect.commit(); //connect.close(); EDIT: Now, i have the below method, but I get the error as indicated. rs.updateString("StepName", "ABCD"); rs.updateRow(); //rs.updateObject("StepName","ABCD" ); Error: com.jnetdirect.jsql.u: sp_cursor: The cursor identifier value provided (0) is not valid. OK I have it working now. Below is the way I had to change. Working solution: Connection connect = ConnectionManager.getInstance().getConnection(); Statement st = connect.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); st.execute("Select * from ..."); ResultSet rs = st.getResultSet(); String queuename = "apples"; String updatedname = "bananas"; while(rs.next()) { if(rs.getString(3).equals(queuename)) { rs.updateString(3, updatedname ); System.out.println("updated: " + rs.getString(3)); rs.updateRow(); }else { System.out.println(rs.getRow() + ": " + rs.getString(3)); } } connect.commit(); rs.close(); connect.close(); }
has title: Updating database after updating resultset
tagged with: jdbc
upvote count: 2
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25288856
answer count: 3

http://stackoverflow.com/comment/39392732
score: 0
type: Comment
type: QuestionComment
has text: why service, service will be expensive alarm manager is best option.
comment on: http://stackoverflow.com/q/25279077

http://stackoverflow.com/a/25371132
downvote count: 0
score: 1
upvote count: 1
has body: Thanks Henrique Ordine. Thats right, the facet box had to be checked for the categoryPath in the SOLR Item types of the HMC
type: Answer
accepted answer of: http://stackoverflow.com/q/25335303
answers question: http://stackoverflow.com/q/25335303
type: AcceptedAnswer

http://stackoverflow.com/q/25319033
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25319145
has comment: http://stackoverflow.com/comment/39467074
type: UnansweredQuestion
has title: Read Multiple Files in ascending order File Name
answer count: 1
tagged with: file
has body: I dont know what is happening to me. I want to access a directory with multiple files in it suppose: folder\\1.txt 2.txt 3.txt.... now I want to read them according to their occurrence I mean first comes the lowest simply I want to read them in ascending order! My code is: File f=new File("xxx"); File[] files = f.listFiles(); for (File ff : files) { if(ff.isFile()) { System.out.println(ff.toString()); } } so far the code works fine but it takes the files as 1.txt 10.txt 11.txt 9.txt 8.txt ... so what is going wrong i want to read them orderly in ascending order
score: 0
has comment: http://stackoverflow.com/comment/39468864

http://stackoverflow.com/comment/39591698
type: Comment
comment on: http://stackoverflow.com/a/25385198
score: 0
type: AnswerComment
has text: @EmmanuelTouzery I don't know, we don't even use OpenJPA but just raw hibernate so it isn't a problem for us at least.

http://stackoverflow.com/q/25279423
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/25279774
type: Question
has title: How to connect postgresql in hibernate.cfg.xml
tagged with: database
tagged with: spring
possible better answer: http://stackoverflow.com/a/25279713
answer count: 6
accepted answer: http://stackoverflow.com/a/25279598
has answer: http://stackoverflow.com/a/50703937
has body: I am trying to insert some data into postgresql through hibernate. However, there are not much tutorial about configurate hibernate with postgresql (I know, it should be similar to mysql =)) src/main/resources/hibernate.cfg.xml <hibernate-configuration> org.postgresql.Driver jdbc:postgresql://127.0.0.1:5432/myDatabase myUser myPassword 1 org.hibernate.dialect.PostgreSQLDialect org.hibernate.cache.HashtableCacheProvider org.hibernate.transaction.JDBCTransactionFactory thread true </hibernate-configuration> src/main/java/ package com.hib.init; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; public class Hibernateutil { private static final SessionFactory sessionF; private static final ServiceRegistry serviceR; static { Configuration conf = new Configuration(); conf.configure(); System.out.println("Begin"); serviceR = new ServiceRegistryBuilder().applySettings(conf.getProperties()).buildServiceRegistry(); System.out.println("Ready???"); try { sessionF = conf.buildSessionFactory(serviceR); System.out.println("Success??"); }catch(Exception e) { throw new ExceptionInInitializerError(e); } } public static SessionFactory getSeeionFactory() { return sessionF; } } src/main/java package com.hib.entities; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table public class Student { @Id @GeneratedValue private Integer id; private String firstName; private Integer age; public Student() {} public Student(Integer id, String firstName, Integer age) { super(); this.id = id; this.firstName = firstName; this.age = age; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public Integer getAge() { return age; …
has answer: http://stackoverflow.com/a/25279713
has answer: http://stackoverflow.com/a/25279558
has answer: http://stackoverflow.com/a/25279598
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 0
score: 7
upvote count: 7
has answer: http://stackoverflow.com/a/38745267

http://stackoverflow.com/q/25381420
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25381584
score: 1
tagged with: java
has title: issue creating .PFX file using keytool.exe
answer count: 1
has body: I've just downloaded Java and have created a keystore file (.ks) and certificate (.cer), and now want to create a .PFX using the .ks file. However, when I type the below at a command prompt, i get the error message shown. c:\Program Files\Java\jre7\bin&gt;keytool.exe -importkeystore -srckeystore C:\clien ts\Client.ks -srcstorepass Password1 -destkeystore c:\private key file\Testfile.pf x -deststorepass Password1 -deststoretype PKCS12 -srcalias Testfile Illegal option: key keytool -importkeystore [OPTION]... Imports one or all entries from another keystore Options: -srckeystore &lt;srckeystore&gt; source keystore name -destkeystore &lt;destkeystore&gt; destination keystore name -srcstoretype &lt;srcstoretype&gt; source keystore type -deststoretype &lt;deststoretype&gt; destination keystore type -srcstorepass &lt;arg&gt; source keystore password -deststorepass &lt;arg&gt; destination keystore password -srcprotected source keystore password protected -srcprovidername &lt;srcprovidername&gt; source keystore provider name -destprovidername &lt;destprovidername&gt; destination keystore provider name -srcalias &lt;srcalias&gt; source alias -destalias &lt;destalias&gt; destination alias -srckeypass &lt;arg&gt; source key password -destkeypass &lt;arg&gt; destination key password -noprompt do not prompt -providerclass &lt;providerclass&gt; provider class name -providerarg &lt;arg&gt; provider argument -providerpath &lt;pathlist&gt; provider classpath -v verbose output Use "keytool -help" for all available commands Can anyone see what I'm doing wrong? I'm using 64bit Windows Server 2008 R2. Many thanks Paul
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39477909
score: 0
type: Comment
type: AnswerComment
has text: Thanks Nick! great suggestions. I will recommend option1 to my clients. Option3 seems also very attractive as it adds security. I'll test it out and provide more feedback.
comment on: http://stackoverflow.com/a/25323473

http://stackoverflow.com/comment/72630474
type: Comment
has text: Come to think of it, @Controller does the same as it take hte produces and consumes mime types JSON/XML or otherwise...@ResponseBody tells Controller to behave like REST endpoint without producing a View. RestController implicitly does that.
type: AnswerComment
comment on: http://stackoverflow.com/a/42685724
score: 0

http://stackoverflow.com/comment/39334650
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25242570
type: Comment
has text: Thanks @MarkVedder. You've touched one presumably key aspect - I have noticed that JDK8 gave me an option to install JRE8, but did not ask where to do it and installed it in a different location. I will clear it up and reinstall JDK8.

http://stackoverflow.com/a/25297438
type: Answer
has comment: http://stackoverflow.com/comment/39427512
score: 0
answers question: http://stackoverflow.com/q/25297412
has body: Most (all?) sorting algorithms need to know only whether a is smaller/bigger/equal to b for each element in the set that we are sorting. Therefore you only need to return a negative, 0, or positive (in many cases -1, 0, and 1) value from compare(). If you read about different sorting algorithms, you'll notice that they're built on this, from the simple bubble sort to quicksort, mergesort and others.
has comment: http://stackoverflow.com/comment/39444271

http://stackoverflow.com/comment/39417997
score: 2
type: Comment
type: QuestionComment
has text: Because Java doesn't work that way. Also, those are [raw types](http://stackoverflow.com/q/2770321/2970947). Don't do that.
comment on: http://stackoverflow.com/q/25292890

http://stackoverflow.com/q/25241150
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Android: Show a non predetermined number of fragments in a tab View
tagged with: tabs
score: 0
has body: I am getting from JSON some data that I would like to display in a tab view. From the JSON (let's talk about venues), I can retrieve anywhere between 1 and 25 venues. They all follow the same architecture, and the JSON is converted to an Venues = ArrayList&lt;Venue&gt;. What I would like to do is that for each Venue in Venues, add a tab that follow only one type of xml and one type of Java, but still are independant. How can I do that? Thanks
has comment: http://stackoverflow.com/comment/39322217
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39322176
type: Question
tagged with: android-fragments

http://stackoverflow.com/comment/39339444
score: 1
type: Comment
type: QuestionComment
has text: You are calling `nextLine()` twice in the condition and in the body of the while loop. I believe you want to either look for `QUIT` *or* store the name, but not add some random non-quit text and then enter the input.
comment on: http://stackoverflow.com/q/25250181

http://stackoverflow.com/a/25369190
answers question: http://stackoverflow.com/q/25354328
has body: Thanks for all, the code is working now, i delete all code and make all of new and now all is working, here is my new code: //Creamos el panel que contendra los botones de cada producto diferente package com.foolsrecords.tpv.tablaproductos.vista; //Hacemos todas las importaciones necesarias import com.foolsrecords.tpv.modelo.Producto; import com.foolsrecords.tpv.modelo.eventos.ControladorEventListener; import com.foolsrecords.tpv.modelo.eventos.ProductoSeleccionadoListener; import com.foolsrecords.tpv.servicios.ServicioItemVenta; import com.foolsrecords.tpv.servicios.ServicioProducto; import com.foolsrecords.tpv.vista.componentes.JProductoButton; import java.awt.Color; import java.awt.Image; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.SwingConstants; import javax.swing.UIManager; //Creamos la clase principal public class TablaProductos extends javax.swing.JPanel { //Creamos las variables y objetos necesarios para poder trabajar private Map&lt;Integer, JProductoButton&gt; mapaProductos; ProductoSeleccionadoListener objEven = new ProductoSeleccionadoListener(this); ServicioItemVenta servItemVenta = new ServicioItemVenta(); //Creamos el constructor public TablaProductos() { initComponents(); inicializarPanelProductos(0); //con los subproductos de tipo 1 } //Inicializamos el panel de productos y le pasamos la familia de los productos como parametro para mostrar los botones correctos public void inicializarPanelProductos(int tipoProducto) { //Creamos un objeto para conectar con la base de datos a traves de la clase servicioproducto ServicioProducto servicio = new ServicioProducto(); //Conectamos con la base de datos y cojemos los productos de la familia enviada como parametro List&lt;Producto&gt; productos = servicio.getProductos(tipoProducto); //Creamos un mapaproductos para poder crear los botones dinamicamente mapaProductos = new HashMap(); //Borramos el panel jpanelproductos para montarlo de nuevo como nosotros queremos j…
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39616920

http://stackoverflow.com/comment/39588407
has text: Maybe there's nothing to iterate over.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25384741
type: QuestionComment

http://stackoverflow.com/q/25253121
has answer: http://stackoverflow.com/a/25253153
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25253763
upvote count: 2
score: 2
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25254865
favorite count: 0
type: Question
has title: Android split by ' '
answer count: 5
possible better answer: http://stackoverflow.com/a/25253257
tagged with: android
has body: I want split a string for example: 5121321 in 5 121 321, every 3 is a ' '. I have that code: private void compor() { String dinheiro="5121321"; char aux[]= new char[dinheiro.length()]; for(int i=0;i&lt;dinheiro.length();i++) { aux[i]=dinheiro.charAt(i); } int flag=0; String total=""; for(int i=0;i&lt;dinheiro.length();i++) { if(flag==3) { total+=' '; flag=0; } total += String.valueOf(aux[i]); flag++; } TextView txt = (TextView) findViewById(R.id.textView3); txt.setText(String.valueOf(total)); } The problem is the output of this is: 512 132 1 and i want 5 121 321. Sorry my english. Somebody can help me?Thanks.
accepted answer: http://stackoverflow.com/a/25253153
has answer: http://stackoverflow.com/a/25253257
has answer: http://stackoverflow.com/a/25253162
has comment: http://stackoverflow.com/comment/39345368

http://stackoverflow.com/comment/39334652
type: QuestionComment
has text: A Thread is an object, and you can't set an object to null. All you can do is set references to null.
comment on: http://stackoverflow.com/q/25247340
score: 1
type: Comment

http://stackoverflow.com/comment/39546576
has text: You're trying to assign values to a list member that doesn't exist. You cannot assign values to an index higher than actually exists. You need objects in your list to set values on.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25357899
score: 0

virtual-machine
tag name: virtual-machine
tags question: http://stackoverflow.com/q/25364940
tags question: http://stackoverflow.com/q/25268312
type: Tag

http://stackoverflow.com/q/25360672
type: Question
upvote count: 4
downvote count: 1
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37772288
tagged with: opencv
score: 3
has body: I'm getting this error when running my Java project I'm using NetBeans 8.0 on Max OS X. Please help me to fix! Error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1878) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1087) Any help is greatly appreciated.
tagged with: java
has title: Java opencv - Error - no jniopencv_core in java.library.path
answer count: 1
favorite count: 0

http://stackoverflow.com/a/25299651
has comment: http://stackoverflow.com/comment/39431215
has body: you need to increase the max threads in your tomcat server &lt;Connector port="8080" address="localhost" maxThreads="250" &lt;!-- here --&gt; maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /&gt; https://web.archive.org/web/20160410090326/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_tomcat_performance_in_production
has comment: http://stackoverflow.com/comment/39431269
has comment: http://stackoverflow.com/comment/39431259
has comment: http://stackoverflow.com/comment/39431207
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25299611
score: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25299611

file-upload
tags question: http://stackoverflow.com/q/25342264
tag name: file-upload
tags question: http://stackoverflow.com/q/25350732
tags question: http://stackoverflow.com/q/25327228
type: Tag
tags question: http://stackoverflow.com/q/25323286
tags question: http://stackoverflow.com/q/25323107
tags question: http://stackoverflow.com/q/25363689

http://stackoverflow.com/comment/39324839
has text: Well, your static method `Date7()` works fine although I would prefer small letter at start for example "dateOneWeekLater()". So your problem is on another location.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25241773
type: QuestionComment

http://stackoverflow.com/comment/39302384
type: Comment
comment on: http://stackoverflow.com/q/25230909
type: QuestionComment
has text: Welcome to Stack Overflow, please take the [Tour](http://stackoverflow.com/tour). Please place your code in the question (not as an offsite link) to avoid link rot which makes your question useless in the future.
score: 0

http://stackoverflow.com/comment/39531224
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25337184
has text: I also just added a description of what I'm seeing in the debugger.
type: Comment

http://stackoverflow.com/comment/39523311
type: QuestionComment
has text: No. Just using the basic TransportClient()
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25349947

http://stackoverflow.com/a/26037785
downvote count: 0
upvote count: 1
score: 1
has body: Here is an array with the 255 EBCDIC characters: var ebcdic = [ 'NUL', // Null 'SOH', // Start of Heading 'STX', // Start of Text 'ETX', // End of Text 'PF', // Punch Off '\t', // Horizontal Tab 'LC', // Lower Case 'DEL', // Delete ' ', ' ', 'SMM', // Start of Manual Message '\v', // Vertical Tab '\f', // Form Feed 'CR', // Carriage Return 'SO', // Shift Out 'SI', // Shift In 'DLE', // Data Link Escape 'DC1', // Device Control 1 'DC2', // Device Control 2 'TM', // Tape Mark 'RES', // Restore '\n', // New Line '\h', // Backspace 'IL', // Idle 'CAN', // Cancel 'EM', // End of Medium 'CC', // Cursor Control 'CU1', // Customer Use 1 'IFS', // Interchange File Separator 'IGS', // Interchange Group Separator 'IRS', // Interchange Record Separator 'IUS', // Interchange Unit Separator 'DS', // Digit Select 'SOS', // Start of Significance 'FS', // Field Separator ' ', 'BYP', // Bypass '\n', // Line Feed 'ETB', // End of Transmission Block 'ESC', // Escape ' ', ' ', 'SM', // Set Mode 'CU2', // Customer Use 2 ' ', 'ENQ', // Enquiry 'ACK', // Acknowledge 'BEL', // Bell ' ', ' ', 'SYN', // Synchronous Idle ' ', 'PN', // Punch On 'RS', // Reader Stop 'UC', // Upper Case 'EOT', // End of Transmission ' ', ' ', ' ', 'CU3', // Customer Use 3 'DC4', // Device Control 4 'NAK', // Negative Acknowledge ' ', 'SUB', // Substitute ' ', // Space ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '¢', '.', '&lt;', '(', '+', '|', '&amp;', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '!', '$', '*', ')', ';', '¬', '-', '/', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ',', '%', '_', '&gt;', '?', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ':', '#', '@', '\'','=', '\"',' ', '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', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '`', // Grave Accent ' ', ' ', ' ', ' ', ' ', '…
answers question: http://stackoverflow.com/q/25367120
type: Answer

http://stackoverflow.com/comment/39580812
type: QuestionComment
comment on: http://stackoverflow.com/q/25380329
has text: Thanks, LazyOne for your comment, I resolved my issue by this ticket http://youtrack.jetbrains.com/issue/WI-12925#comment=27-580440 I had the same problem with known_hosts file.
score: 0
type: Comment

http://stackoverflow.com/a/25389077
answers question: http://stackoverflow.com/q/25388989
type: Answer
has comment: http://stackoverflow.com/comment/39596800
has comment: http://stackoverflow.com/comment/39596856
score: 0
has body: In single thread environment you can use lazySet . getAndSet is mainly for multi thread enviroment

http://stackoverflow.com/comment/39305314
score: 7
type: QuestionComment
comment on: http://stackoverflow.com/q/25232318
type: Comment
has text: What output are you setting? I'm seeing " test 44" and then "44"... in other words, everything *is* printing.

http://stackoverflow.com/a/25264979
downvote count: 0
upvote count: 1
score: 1
has body: You must put your lasers into an array. They are getting out of scope and getting destroyed, but bodies stay alive. Bodies are recycled by box2d so that may cause issues. Creating them in the render like that is pretty bad as well. You should use pooling for anything that has short life cycle. Touching disposed body in any way will blow up the game, so its optimal to never dispose them during game play. Ive recently released libgdx/box2d game that uses pooling extensively. You can check out the code at GitHub. Also that endContact(), clean it up. Its impossible to read. Something like that maybe? @Override public void endContact(Contact contact) { Fixture fA = contact.getFixtureA(); Fixture fB = contact.getFixtureB(); if (isPlayerProjectile(fA) &amp;&amp; isEnemy(fB)) { Entity projectile = (Entity) contact.getFixtureA().getBody().getUserData(); Entity enemy = (Entity) contact.getFixtureB().getBody().getUserData(); solveProjectileEnemyContact(projectile, enemy); } else if (isPlayerProjectile(fB) &amp;&amp; isEnemy(fA)) { Entity projectile = (Entity) contact.getFixtureB().getBody().getUserData(); Entity enemy = (Entity) contact.getFixtureA().getBody().getUserData(); solveProjectileEnemyContact(projectile, enemy); } } private boolean isPlayerProjectile(Fixture fixture){ return fixture.getFilterData().categoryBits == Entities.CATEGORY_PLAYER_PROJECTILE; } private boolean isEnemy(Fixture fixture){ return fixture.getFilterData().categoryBits == Entities.CATEGORY_ENEMY; } private void solveProjectileEnemyContact(Entity projectile, Entity enemy){ projectile.isFlaggedForDelete = true; enemy.damage(projectile.damage); }
has comment: http://stackoverflow.com/comment/39367012
type: Answer
answers question: http://stackoverflow.com/q/25243532

http://stackoverflow.com/q/25262724
has body: I want to validate xml file contain namespace with xsd file. My xml file: <?xml version="1.0" encoding="UTF-8"?> 417 My xsd file: <xsd:element name="ArrayOfNumberOfCars"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" maxOccurs="1" ref="NumberOfCars" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="NumberOfCars"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" maxOccurs="1" ref="Number" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Number"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:minLength value="0" /> <xsd:maxLength value="15" /> </xsd:restriction> </xsd:simpleType> </xsd:element> Affer call method validate, I got exception bellow: org.xml.sax.SAXException: javax.xml.stream.XMLStreamException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 86; cvc-elt.1: Cannot find the declaration of element 'ArrayOfNumberOfCars'. Everyone know how to config validate for namespage in xsd file. Please help me. Thanks
has answer: http://stackoverflow.com/a/25283754
has answer: http://stackoverflow.com/a/25264377
tagged with: java
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39362452
answer count: 2
has comment: http://stackoverflow.com/comment/39368949
type: UnansweredQuestion
score: 1
tagged with: validation
has title: How to validate xml file against xsd with namespace
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/15732
favorite count: 0

http://stackoverflow.com/comment/39542633
score: 1
comment on: http://stackoverflow.com/a/25359902
type: Comment
type: AnswerComment
has text: Thank you very much. This solved it. For some reason, I wasn't fully aware of how arrays were treated, as object.

http://stackoverflow.com/comment/39538018
type: AnswerComment
comment on: http://stackoverflow.com/a/25358174
type: Comment
has text: I am asking where is "apcha-maven-directory" located in eclipse maven. I don't want to install maven again, since it's already part of eclipse as a plugin.
score: 0

http://stackoverflow.com/comment/39483697
has text: Thank you for your help. I will make the changes .
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25320039

http://stackoverflow.com/q/25270111
type: UnansweredQuestion
has title: Change Activity Class to Fragment
has comment: http://stackoverflow.com/comment/39376419
has body: I'm pretty new new Android development. I have a class that extends Activity and I'd like to change to to a Fragment. I know as a fragment it would use onCreateView(LayoutInflater, ViewGroup, Bundle) but I'm not sure how to change my working activity to a fragment. EDIT: I have gotten it kind of working. The problem now is that my list from the RSS feed isn't showing. I get my loading indicator and it stops once it's finished but the list doesn't show. EDIT: Actually the list is showing, but the text is the same color as the background so I couldn't see it. Here is my existing Activity: import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageView; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; public class ActionAlerts extends Activity { ListView listFeed; ProgressBar prgLoading; TextView txtAlert; ActionAlertsAdapter la; static String[] title; static String[] pubDate; static String[] link; String URLFeed; URL Feed; DocumentBuilder db; Document doc; NodeList nodeList; Bundle rssBundle = new Bundle(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.actio…
has answer: http://stackoverflow.com/a/25287830
tagged with: android-fragments
score: 0
tagged with: java
tagged with: android-activity
type: Question
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/25286812

http://stackoverflow.com/q/25380984
has comment: http://stackoverflow.com/comment/39581777
favorite count: 0
accepted answer: http://stackoverflow.com/a/25388068
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25381379
has answer: http://stackoverflow.com/a/25388068
type: Question
linked to: http://stackoverflow.com/q/28084064
tagged with: java
has answer: http://stackoverflow.com/a/73699514
has title: How to sort by multiple properties in Spring Data (JPA) derived queries?
answer count: 4
type: AnsweredQuestion
has body: I'm looking at the examples giving on this page (https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.repositories) about method naming, is it possible to create a complex chain method name such as findByProgrammeAndDirectorAndProgDateBetweenOrderByProgDateStartTimeAsc In the example they give, they are only doing an OrderBy on one value. In the example above ProgDate and StartTime would be two separate values.
possible better answer: http://stackoverflow.com/a/65897809
tagged with: jpa
tagged with: spring-data
downvote count: 0
upvote count: 105
score: 105
tagged with: spring
has answer: http://stackoverflow.com/a/65897809

http://stackoverflow.com/comment/39426597
type: QuestionComment
comment on: http://stackoverflow.com/q/25290915
type: Comment
has text: Read about MixIn - http://wiki.fasterxml.com/JacksonMixInAnnotations. Also see this tutorial: http://wiki.fasterxml.com/JacksonInFiveMinutes
score: 1

http://stackoverflow.com/a/25501965
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25385352
has body: The Maven Site plugin looks under src/site for documentation. By default it expects the documentation to be written using the Doxia Markup language. The project structure you reference is written using this markup. You can find it in the source code of src/site/apt/index.apt in the Maven archetypes project. The markup for the project structure you mention is defined there: 34 +----+ 35 36 project 37 |-- pom.xml 38 `-- src 39 `-- site 40 |-- apt 41 | |-- format.apt 42 | `-- index.apt 43 |-- fml 44 | `-- faq.fml 45 |-- fr 46 | |-- apt 47 | | |-- format.apt 48 | | `-- index.apt 49 | |-- fml 50 | | `-- faq.fml 51 | `-- xdoc 52 | `-- xdoc.xml 53 |-- xdoc 54 | `-- xdoc.xml 55 |-- site_fr.xml 56 `-- site.xml 57 58 +----+ It should be fairly obvious looking at that, how to write the markup for your own such structure. If you wish to auto-generate such a structure, then I suspect that you may need to write a simple Maven plugin to iterate through your project directories. I'm not aware of any preexisting plugins, but I wouldn't be surprised to find one out there.
answers question: http://stackoverflow.com/q/25385352
type: Answer

http://stackoverflow.com/q/25310703
upvote count: 3
tagged with: java
favorite count: 0
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25310948
tagged with: android
score: -3
downvote count: 6
duplicate of: http://stackoverflow.com/q/25310948
tagged with: thread-sleep
answer count: 0
has title: Code not executed in expected order?
has body: Can someone please explain to me why the code via the link below isn't getting executed as expected? I think I'm ignorant to something about how threads execute but obviously I don't know what. any assistance is greatly appreciated. Visually, I'm expecting it to show four Toasts in the following order: 1. createToast("start of delayed RandomCue Method"); 2. createToast("start of delay"); 3. createToast("end of delay"); 4. createToast("end of delayed RandomCue Method"); However, the resulting order is: 1. createToast("start of delayed RandomCue Method"); 2. createToast("end of delayed RandomCue Method"); 3. createToast("end of delay"); 4. createToast("start of delay"); My overall goal is to have a program that displays an image and changes ever 3 seconds. The player can press a button and the image changes for 1.5 seconds. Therefore, there are two methods, one to change picture using countdowntimer and another to change picture using onClick method corresponding to imagebutton. The problem I'm running into is the code provided in the link (method called from within an onclick method) is supposed to change the image, set a bool value to false, wait 1.5 seconds, and then change the same bool value back to true. While the bool value is true, the method that changes the pictures is supposed to be skipped but that's not the case and I don't know why but i think it's something to do with the code in the gists I created below. So the issue I have is when the button is clicked, the image changes as expected but it sometimes changes again too quickly due to the first method not recognizing that the player responded and thus shouldn't change image yet. Please let me know if any further details or anything is needed and thank you again for time and help!! https://gist.github.com/cjayem13/d32446ceb8c6d9626c68#file-easyfragment-java https://gist.github.com/cjayem13/d32446ceb8c6d9626c68 https://gist.github.com/cjayem13/d0a0b124dfe17666be25#file-easyfragment-java https://gist.githu…

http://stackoverflow.com/a/25254335
has body: There's two steps here: get information about the current user ("Gender" and "Looking_Gender") find other users that have compatible data Unless the current user is being updated elsewhere, you can just do the following to get their details: String userGender = ParseUser.getCurrentUser().getString("Gender"); String userLookingGender = ParseUser.getCurrentUser().getString("Looking_Gender"); Now you want to find other users who's gender matches what the current user is looking for, and who are looking for people of the current user's gender: ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); 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); Of course, you're currently only handling hetrosexual and homosexual desires, what about bisexual people? To handle this, you would need to change your Looking_Gender column into an array and call it Looking_Genders. You can then modify the code to handle that. Change the code that gets what genders the current user is looking for: JSONArray userLookingGenders = ParseUser.getCurrentUser().getJSONArray("Looking_Genders"); Change the query: // users with Gender contained in currentUser.Looking_Genders query.whereContainedIn("Gender", userLookingGenders); // users with Looking_Genders contains currentUser.Gender // NOTE: no change other than column name is now plural (Looking_Gender vs Looking_Genders) query.whereEqualTo("Looking_Genders", userGender); I've never actually written any Android code, so you might need to do something like convert the JSONArray to some type of list to get the above working.
accepted answer of: http://stackoverflow.com/q/25249164
type: Answer
has comment: http://stackoverflow.com/comment/39349665
answers question: http://stackoverflow.com/q/25249164
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/25294535
has comment: http://stackoverflow.com/comment/39421444
answers question: http://stackoverflow.com/q/25294433
score: 0
type: Answer
has body: sed -e 's/\\:start$//' And a sample run: % echo "reference\:file\:org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354.jar@3\:start" | sed -e 's/\\:start$//' reference\:file\:org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354.jar@3 The '$' matches only at the end of the line. Hope that helps...
has comment: http://stackoverflow.com/comment/39421703

http://stackoverflow.com/a/25265394
score: 3
has comment: http://stackoverflow.com/comment/39368127
has comment: http://stackoverflow.com/comment/39373812
has comment: http://stackoverflow.com/comment/48347072
answers question: http://stackoverflow.com/q/25262580
type: Answer
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/48347280
has body: The operation you are performing is called Mutable reduction. Pshemo’s answer shows how you can implement such operation ad-hoc by providing the three necessary functions. However, when all three functions are implemented by a dedicated class it might be useful to implement these functions inside a class implementing Collector for easier reuse: public class Distance implements Collector&lt;Vector3D, Distance.Helper, Double&gt; { public static final Distance COLLECTOR = new Distance(); static final class Helper { private double sum = 0; private Vector3D first = null, previous = null; } public Set&lt;Characteristics&gt; characteristics() { return Collections.emptySet(); } public Supplier&lt;Helper&gt; supplier() { return Helper::new; } public BiConsumer&lt;Helper, Vector3D&gt; accumulator() { return (helper,vector3d)-&gt; { if (helper.previous != null) helper.sum += vector3d.distance(helper.previous); else helper.first = vector3d; helper.previous = vector3d; }; } public BinaryOperator&lt;Helper&gt; combiner() { return (h1,h2)-&gt; { h2.sum += h1.sum; if(h1.previous!=null &amp;&amp; h2.first!=null) { h2.sum += h1.previous.distance(h2.first); h2.first=h1.first; } return h2; }; } public Function&lt;Helper, Double&gt; finisher() { return helper -&gt; helper.sum; } } You will recognize the three function from the ad-hoc version. New is a fourth function, finisher which allows to specify how the final result can be extracted from the mutable container so we don’t need the getSum() call. The use case simplifies to: List&lt;Vector3D&gt; list; //… double distance=list.stream().collect(Distance.COLLECTOR);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25262580

http://stackoverflow.com/comment/39613271
type: Comment
type: QuestionComment
has text: @Guillaume Polet The statement is already available in setOvertypeMode(boolean isOvertypeMode) method belongs to the above program.Please check it once.
score: 0
comment on: http://stackoverflow.com/q/25305054

http://stackoverflow.com/a/25327809
type: Answer
has body: Solve it, i found out with this post. Just neede to change from dataType: 'jsonp', to dataType: 'json', Since jsonp, ignores the ajax request header.
score: 0
answers question: http://stackoverflow.com/q/25314176

http://stackoverflow.com/comment/39532486
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25355024
type: Comment
has text: @MadProgrammer but it will be closed at the end of the processes am I right? I never had any issue with it

http://stackoverflow.com/a/25358492
type: Answer
has body: I just write this following.And it working fine for me. I think the error is because of your syntax of loadUrl.Change like below hope it will work. package com.demoapp; import org.apache.cordova.DroidGap; import android.os.Bundle; public class EOSActivity extends DroidGap { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/index.html", 5000); } } Add the following code in your manifest. &lt;activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;/intent-filter&gt; &lt;/activity&gt;
score: 0
has comment: http://stackoverflow.com/comment/39542571
answers question: http://stackoverflow.com/q/25356467

switch-statement
tags question: http://stackoverflow.com/q/25277043
tags question: http://stackoverflow.com/q/25282833
tags question: http://stackoverflow.com/q/25234374
tag name: switch-statement
type: Tag

http://stackoverflow.com/a/25274000
score: 3
accepted answer of: http://stackoverflow.com/q/25273736
upvote count: 3
type: Answer
has body: In general, I prefer to configure the security provider in a lazy manner so that my code does not depend on the provider being previously initialized. If you are using dependency injection you can define a class like the following: public class SecurityProvider { public SecurityProvider() { if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { Security.addProvider(new BouncyCastleProvider()); } } And inject it into any object which requires the SecurityProvider to be initialized. The dependency injection container will instantiated the SecurityProvider as necessary. If you are using plain servlets you can register a ServletContextListener that initializes the SecurityProvider. public class SecurityProviderInitializer implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { Security.addProvider(new BouncyCastleProvider()); } } @Override public void contextDestroyed(ServletContextEvent event) {} }
answers question: http://stackoverflow.com/q/25273736
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25324000
has comment: http://stackoverflow.com/comment/39498796
score: 1
answers question: http://stackoverflow.com/q/25316761
has comment: http://stackoverflow.com/comment/39495243
has comment: http://stackoverflow.com/comment/39533416
downvote count: 0
type: Answer
upvote count: 1
has body: It seems that the problem is the CascadeType.ALL on the use relationship. What's going on ? You have one instance of HL7GeneralCode persistent in your db. Let's call it : code1. You create a new Address and define the use relation with something like : theNewAdress.setUse(code1); You call savehl7Address(theNewAddress) and since the address is new you made a call to persist. The problem is that the cascading rule CascadeType.ALL will force a call to persist(code1) and since code1 is already in the db : crash because of duplicate entry. Solution : Define no cascading rule for the use relationship : @ManyToOne(fetch=FetchType.EAGER) @JoinColumns({ @JoinColumn(name = "usecode", referencedColumnName = "code", insertable = false, updatable = false), @JoinColumn(name = "usecodesystem", referencedColumnName = "codesystem", insertable = false, updatable = false) }) public HL7GeneralCode use; But you must manage it by hand, especially if there is a use case where the HL7GeneralCode used by the address is not already in the db. Over-simplified solution (so that you can understand the problem) : @Override public void savehl7Address(HL7Address addr) { if(addr.use() != null &amp;&amp; addr.use().getId()==null){ //HL7GeneralCode is not persistent yet this.em.persist(addr.use()); //since there is a cascade ALL on the adresses relationship addr is now persistent return; } if ((Integer)addr.getId() == null) { System.out.println("about to persist address ]]]]]]]]"); this.em.persist(addr);} else { System.out.println("]]]]]]]]]]]]]]]]]] about to merge address [[[[[[[[[[[[[[[[[[[[["); this.em.merge(addr);} } As you can see this solution is certainly not the best and not production ready. The real solution is to study all your use-case and adapt the cascading rule (on both use and adresses relationships) accordingly. In my opinion, the best thing to do is to ensure that the HL7GeneralCode is already persistent when you call savehl7Address and so something like thi…
has comment: http://stackoverflow.com/comment/39493426

http://stackoverflow.com/a/25368035
score: 1
has body: You don't know if the problem is with your date parser or the SQL ResultSet. A debugger will tell you quickly where the problem lies. I strongly agree with those people who argue that you should not save a DATE in a CHAR column. I'd write it this way to give myself a chance. private static final DateFormat DEFAULT_DATE_FORMAT; static { DEFAULT_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy"); DEFAULT_DATE_FORMAT.setLenient(false); } // Your method snippet try { while (rs.next()) { String dateAsStr = rs.getString(2); Date date = DEFAULT_DATE_FORMAT.parse(dateAsStr); System.out.println(DEFAULT_DATE_FORMAT.format(date)); } } catch(ParseException e) { e.printStackTrace(); } finally { // Don't forget to close your resources in finally block. close(rs); close(statement); }
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25367900

http://stackoverflow.com/comment/39316144
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25237802
has text: I have just edited the question, I am looking for other ways rather than a manual checking.
type: Comment

http://stackoverflow.com/comment/39570862
has text: @Thilo `+` is overloaded in Haskell too, but that's still a type error.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25374472
type: AnswerComment

http://stackoverflow.com/comment/39411707
score: 0
comment on: http://stackoverflow.com/q/25289107
type: QuestionComment
has text: I would like with each new version my app remove database.
type: Comment

http://stackoverflow.com/q/25297022
tagged with: memory
tagged with: eclipse
has body: I'm trying to figure out the difference between the two since my eclipse sometimes experiences a "out of memory" error. I've got a lot of memory at my disposal so I'm trying to figure out which to increase or decrease and what they do to get it working properly. Here are the contents of the file: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20130807-1835 -clean -showsplash org.eclipse.platform --launcher.XXMaxPermSize 1024m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Xms256m -Xmx2000m
has comment: http://stackoverflow.com/comment/39426608
tagged with: jvm-arguments
type: Question
upvote count: 2
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25297104
has answer: http://stackoverflow.com/a/25297107
tagged with: jvm
has comment: http://stackoverflow.com/comment/39426539
favorite count: 0
has comment: http://stackoverflow.com/comment/39426503
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25297095
possible better answer: http://stackoverflow.com/a/25297095
tagged with: java
has comment: http://stackoverflow.com/comment/39426476
accepted answer: http://stackoverflow.com/a/25297107
has title: What is the difference between "XXMaxPermSize" and "xmx" in eclipse.ini?
has comment: http://stackoverflow.com/comment/39426428

http://stackoverflow.com/comment/39533945
type: Comment
type: AnswerComment
has text: Hi , copying file into SD card and send it to email, that solution is working, but still can not working good if I used file from the asset folder, even I used File Provider. Now the question is what if the user dont have SD card inserted into they are android device :)
comment on: http://stackoverflow.com/a/25302884
score: 0

http://stackoverflow.com/q/25322955
answer count: 4
has comment: http://stackoverflow.com/comment/39474307
has answer: http://stackoverflow.com/a/25323093
has body: How can i make my date "DAY" only auto increment by 1 every time I get the date value. Example my current expire date is 20141031, after increment it will changed to 20141101. SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat timestampFormat2 = new SimpleDateFormat("dd-MM-yyyy"); String EXPDATE = common.setNullToString((String) session.getAttribute("SES_EXPDATE")); // 31- 10-2014 String tempEXPDATE = timestampFormat.format(timestampFormat2.parse(EXPDATE)); //20141031 int intExpdate = Integer.parseInt(tempEXPDATE.substring(6,8)); //30
has answer: http://stackoverflow.com/a/25323133
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39474702
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25323079
has comment: http://stackoverflow.com/comment/39474229
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/428918
has answer: http://stackoverflow.com/a/25323079
tagged with: java
has comment: http://stackoverflow.com/comment/39500392
has answer: http://stackoverflow.com/a/25323255
accepted answer: http://stackoverflow.com/a/25323093
has title: Date "DAY" auto increment by 1

http://stackoverflow.com/comment/39481536
has text: if you use eclipse, it make you life easier. would you be able to use eclipse at all?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25326721

http://stackoverflow.com/a/25269082
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25265303
has body: It is important that the factored out methods will be either declared private or final. The just in time compiler in the JVM will then inline everything, which means there will be a single big method executed as result. However, always benchmark your code, when modifying it.
has comment: http://stackoverflow.com/comment/82056332

hikaricp
tags question: http://stackoverflow.com/q/25260811
tags question: http://stackoverflow.com/q/25354626
tag name: hikaricp
tags question: http://stackoverflow.com/q/25367261
type: Tag

http://stackoverflow.com/comment/39668552
has text: Thanks. Let me try it !!
type: Comment
comment on: http://stackoverflow.com/a/25415999
type: AnswerComment
score: 0

http://stackoverflow.com/a/25268709
has comment: http://stackoverflow.com/comment/39708924
answers question: http://stackoverflow.com/q/25259158
has comment: http://stackoverflow.com/comment/39424328
has comment: http://stackoverflow.com/comment/39500662
has comment: http://stackoverflow.com/comment/39664124
has comment: http://stackoverflow.com/comment/39692539
has comment: http://stackoverflow.com/comment/39392208
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25259158
score: 1
has comment: http://stackoverflow.com/comment/39434417
has body: In the "if" code you have a single statement. In the "else" statement you have 2 statements. Don't you think the code should be the same except for the text? Also, you should NOT be using a text field to display the text. Instead you should be using a panel with multiple labels. One label for the row/column position. Another label for the Caps Lock status. Then you only update the text for the label that changes. .Caps lock enable/disable not update the all the opened Documents. Then you have a couple of solutions: Your status bar should be common for the frame, not the Document. So the labels will be shared by all Documents. This means that whenever a Document gains focus you would need to update the caret position but the Caps Lock will still be correct from the last Document. Or, you could create the Caps Lock field as a non-editable JTextField. Then you can share the Document of the text field with all text field. This mean when you update the text field it will be reflected on all documents. So you would need to pass in the shared text field Document any time you create a new document for your application. Then to create the text field you would use: JTextField textField = new JTextField( sharedDocument ); Edit: When you create the component for the frame you would have code something like: StatusPanel status = new StatusPanel(); frame.add(status, ...); Then in this custom class you add the components to display the data you want displayed. You also need to add methods like setRowColumn(...) and setCapsLock(...) to display the text you want to see for those components. Then you need to create another custom class MyInternalFrame that extend JInternalFrame. Then when you create this class you use: MyInternalFrame internal = new MyInternalFrame(status); So now your custom internal frame has access to the status bar and you can update the status bar from any Document that your create. Another Edit: import java.awt.*; import java.awt.event.*; import javax.swing.*; …
type: Answer
has comment: http://stackoverflow.com/comment/39508730
has comment: http://stackoverflow.com/comment/39670449
has comment: http://stackoverflow.com/comment/39393410
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25347007
answers question: http://stackoverflow.com/q/25346929
has body: If you are trying to run your code on Eclipse IDE console then it'll not work. It is bug System.console() (Java 6.0) returns null when running inside Eclipse. You need to run from command prompt or teminal, etc. For more on this see these post :- Hide input on command line - stackoverflow Masking password input from the console - stackoverflow
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25241817
has body: I have the following list of JAR dependencies (the following is my entire build.gradle file): apply plugin: 'java' dependencies { compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3' compile 'com.wordnik:swagger-annotations:1.3.4' compile 'javax.validation:validation-api:1.0.0.GA' compile 'io.dropwizard:dropwizard-core:0.7.0' compile 'io.dropwizard:dropwizard-client:0.7.0' compile 'com.wordnik:swagger-jaxrs_2.10:1.3.4' compile 'org.eclipse.jetty:jetty-servlets:8.1.14.v20131031' } I would like to run Gradle and have it pull all of these JARs (and their transitive deps) from Maven and place the JARs in a local lib directory. When I run this I get a BUILD SUCCESSFUL message, but I don't see a lib directory under my main TestGradleroot` dir. I was expecting to see a directory that would contain all of these JARs as well as their transitive dependencies.
has title: Gradle to pull down dependencies into local lib dir
tagged with: java
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/25241905
type: UnansweredQuestion
answer count: 1
tagged with: maven
tagged with: dependency-management
score: 0

http://stackoverflow.com/comment/39473785
score: 23
comment on: http://stackoverflow.com/q/25322679
has text: 10 ms is hardly long enough for a benchmark - let alone a Java benchmark where you have JVM warmup effects. Can you post your exact test code? Also, try reversing the order of the benchmarks.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/51473366
type: Answer
score: 44
downvote count: 0
upvote count: 44
answers question: http://stackoverflow.com/q/25362540
has body: For your case, you can directly use JPA methods. That code is like bellow : Containing: select ... like %:place% List<Registration> findByPlaceContainingIgnoreCase(String place); here, IgnoreCase will help you to search item with ignoring the case. Using @Query in JPQL : @Query("Select registration from Registration registration where registration.place LIKE %?1%") List<Registration> findByPlaceContainingIgnoreCase(String place); Here are some related methods: Like findByPlaceLike … where x.place like ?1 StartingWith findByPlaceStartingWith … where x.place like ?1 (parameter bound with appended %) EndingWith findByPlaceEndingWith … where x.place like ?1 (parameter bound with prepended %) Containing findByPlaceContaining … where x.place like ?1 (parameter bound wrapped in %) More info, view this link (where the above quote is from), this link and this

http://stackoverflow.com/comment/39434517
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25301333
has text: Move the calls to `Integer.valueOf()` and the calculation for `totalTimeCountInMilliseconds` to the `onClick()` method for the `start_timer` Button.
type: Comment

http://stackoverflow.com/comment/63894230
has text: The new version with Reflections.collect(); makes sense to me. You may also want to mention the steps to integrate Reflections into the build cycle (which is what allows the use of the #collect API and reduces the runtime component of this solution drastically) with a link to some example.
comment on: http://stackoverflow.com/a/25271913
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39365566
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25264355
score: 0
has text: Most of the properties file gives the user location. Like `location=/users/batman/something.jar`. Now clearly, this wont work on others system. I'm totally worried about these things.

http://stackoverflow.com/q/25295505
has answer: http://stackoverflow.com/a/25295779
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has comment: http://stackoverflow.com/comment/39423772
has comment: http://stackoverflow.com/comment/39423868
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: awt
has comment: http://stackoverflow.com/comment/39423519
downvote count: 1
has answer: http://stackoverflow.com/a/25296113
favorite count: 0
has comment: http://stackoverflow.com/comment/39423930
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39424117
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39423634
has title: How can I access arraylist from one jframe to another jframe
has body: I am relatively new in Java. In one of my project I have three jframes. They are Menuframe,that has list of menus; LoadDatafromExcelframe, that is use to select and read data from Excel file; and ShowDataFrame, that is use to display data that I read in LoadDatafromExcelframe. Actually its part of a big project. not the whole project! At the beginning of my project I am reading Excel file and load all the data in arraylist. Till this point I am good. Now I want to click the ShowDataFrame from the menulist to display the data that I have read in the LoadDatafromExcelframe. If I can access the arraylist then I think I can move forward. My question is "How can I access arraylist from one jframe (ShowDataFrame) to another frame(LoadDatafromExcelframe)?"I am using Netbeans IDE. private void jMenuItemShowDataActionPerformed(java.awt.event.ActionEvent evt) { showDataFrame.setVisible(true); }
type: Question
tagged with: netbeans

http://stackoverflow.com/comment/39445081
score: 0
comment on: http://stackoverflow.com/q/25306454
type: Comment
type: QuestionComment
has text: better, faster more confortable will be to use DefaultTableModel, in all cases except largest tables and updated periodically,

http://stackoverflow.com/comment/39460419
score: 0
type: AnswerComment
has text: @SnakE, That is a fair point. I guess it depends on your use case.
type: Comment
comment on: http://stackoverflow.com/a/25297388

http://stackoverflow.com/q/25256402
type: Question
tagged with: android-service
has answer: http://stackoverflow.com/a/25256635
has title: Pass data between two Activities in different procceses
has answer: http://stackoverflow.com/a/25256974
type: UnansweredQuestion
tagged with: android
tagged with: aidl
score: 0
answer count: 2
tagged with: java
has body: I need to pass Objects between two different processes, I read all the materials about it but I still have some questions 1.I can pass objects between different processes through AIDL, but its complicated and messy, I also read about he Messenger to transfer messages, but cant I pass with it an Object that implements Parcelable like that? Bundle b = new Bundle(); b.putParcelable("MyObject", (Parcelable) object); msg.setData(b); handler.sendMessage(msg); And in the Handler to extract it? if yes so what is the advance of AIDL over Messenger...only the multithreading issue? 2.To work across different processes I can with Messenger and AIDL, but cant I use Bundle in Activities without all those services like some Android app work today that can get objects as input: intent.putExtra("MyParcelableObject", object);

http://stackoverflow.com/comment/39533075
score: 2
type: Comment
comment on: http://stackoverflow.com/q/25355379
type: QuestionComment
has text: Oh, I see it now. My first code wanted to use the text field before it actually existed. I just moved it up to where I make the ListenForKeys lines and it works now! Thanks for the help! I will definitely inspect my code when I get my next NPE!

http://stackoverflow.com/q/25235943
has comment: http://stackoverflow.com/comment/39313191
downvote count: 4
answer count: 3
type: UnansweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25235996
has comment: http://stackoverflow.com/comment/39312876
has answer: http://stackoverflow.com/a/25236268
favorite count: 0
has body: I would like to know how to write regular expression for a multiple number of 2 . For example : 2 4 6 8 10.. I want to ignore the odd number of "%" and I want to split ",". For example : String.split("(?&lt;!%{odd number}),");
type: Question
has comment: http://stackoverflow.com/comment/39312790
has title: Regular expression for multiple of 2 in java
has comment: http://stackoverflow.com/comment/39312913
score: -3
has answer: http://stackoverflow.com/a/25235966

http://stackoverflow.com/q/25274851
has title: Add AnimatorSet to a FragmentTransaction created dynamically
answer count: 1
has body: I've created a AnimatorSet s1. I want to use the s1 AnimatorSet instead of the R.anim.slide_in_top . How do I tell the transaction to use s1? private void showsystemerror(int i){ dialog.cancel(); Systemerror frag = new Systemerror(); Bundle bundle = new Bundle(); bundle.putInt("type", i); frag.setArguments(bundle); final AnimatorSet s1 = new AnimatorSet(); final ObjectAnimator anim = ObjectAnimator.ofInt(frag, "x", 150,0); anim.setDuration(500); s1.play(anim); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.anim.slide_in_top, 0); transaction.add(R.id.main, frag); transaction.commit(); }
downvote count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25276071
favorite count: 0
type: AnsweredQuestion
tagged with: fragmenttransaction
accepted answer: http://stackoverflow.com/a/25276071
tagged with: android-animation
tagged with: android
tagged with: java
type: Question

http://stackoverflow.com/comment/39699212
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25382023
score: 0
has text: you have to keep a uri where the taken picture saves... Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String fileName = TravellerUtils.generateUniqueID() + IMAGE_FILE_EXT; File file = new File(Environment.getExternalStorageDirectory(), TravellerConstants.IMAGE_PATH + fileName); Uri outputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, TAKE_PICTURE); dont know exact solution but you can get idea now

http://stackoverflow.com/q/25381886
answer count: 2
linked to: http://stackoverflow.com/q/8647371
has body: I would like to take multiple photos via Intent. I know how to make intent for taking just one image, but what if I would like to take e.g. 10 photos? static final int REQUEST_IMAGE_CAPTURE = 1; private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); } } Trivial solution is to make another intent after result but I think there must be better solution, isn't there?
has answer: http://stackoverflow.com/a/25382023
accepted answer: http://stackoverflow.com/a/25382023
has title: Taking multiple photos via Intent
tagged with: android-intent
linked to: http://stackoverflow.com/q/5336890
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: camera
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/54788731
possible better answer: http://stackoverflow.com/a/54788731
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/39587185
has text: My form extends `FormEditor` and my specific page extends `FormPage`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25372282

http://stackoverflow.com/comment/39459114
comment on: http://stackoverflow.com/q/25314402
type: Comment
has text: Think about the Single Responsibility Principle as well as the Law of Demeter, as well as simplified testing and debugging.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/39474550
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25323196
has text: you mean *should* be ignored

http://stackoverflow.com/comment/39427190
score: 0
comment on: http://stackoverflow.com/q/25297351
has text: If I misunderstand your question, please correct me, but as far as I can tell, you answered it yourself.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39880676
type: QuestionComment
has text: I guess it depends on your client. It might be easier to make modifications there, especially given that the server doesn't naturally know the right locale. On the server you could use controller advice but you might have to duplicate some of the native error handling code.
score: 0
comment on: http://stackoverflow.com/q/25354435
type: Comment

http://stackoverflow.com/comment/39569076
score: 0
comment on: http://stackoverflow.com/a/25374128
type: Comment
type: AnswerComment
has text: Depends on what needs to be achieved and this could go into totally tangent discussion so let's not discuss further. Note I already up voted your solution :-)

http://stackoverflow.com/comment/39377905
type: AnswerComment
comment on: http://stackoverflow.com/a/25247947
score: 0
type: Comment
has text: I really am confused as of what to do with ListView_CheckBoxActivity... but my adapter and xml files are fine

http://stackoverflow.com/q/25379397
has comment: http://stackoverflow.com/comment/39578451
tagged with: swing
has comment: http://stackoverflow.com/comment/39659616
has body: I am creating simple flowchart software.i want to create oval/parallelogram/diamond/rectangle shapes. I want to resize those shapes and drag those shapes.because of resizing I cant use images.I add drag events to rectangle shape japanel but I unable to create other shapes using jpanel. How to add parallelogram/diamond shapes to jpanel? given "Resizing issue with canvas within jscrollpane within jsplitpane" question not answered for parallelogram shape and diamond shape i want to create those shapes too /* ResizableComponent.java */ import java.awt.Color; import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; /* ResizableComponent.java */ public class ResizableComponent extends JFrame { private JPanel panel = new JPanel(null); private Resizable resizer; public ResizableComponent() { add(panel); JPanel area = new JPanel(); area.setBackground(Color.white); resizer = new Resizable(area); resizer.setBounds(50, 30, 200, 150); panel.add(resizer); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(new Dimension(350, 300)); setTitle("Resizable Component"); setLocationRelativeTo(null); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { requestFocus(); resizer.repaint(); } }); } public static void main(String[] args) { ResizableComponent rc = new ResizableComponent(); rc.setVisible(true); } } // Resizable.java import java.awt.BorderLayout; import java.awt.Component; import java.awt.Cursor; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import javax.swing.JComponent; import javax.swing.event.MouseInputAdapter; import javax.swing.event.MouseInputListener; // Resizable.java public class Resizable extends JComponent { public Resizable(Component comp) { this(comp, new ResizableBorder(8)); } public Resizable(Component comp, ResizableBorder border) { setLayout(new BorderLayout()); add(comp); addMouseListener(resizeListe…
type: Question
has comment: http://stackoverflow.com/comment/39653207
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39578497
linked to: http://stackoverflow.com/q/11942961
has comment: http://stackoverflow.com/comment/39652846
has comment: http://stackoverflow.com/comment/39580383
tagged with: paint
has title: How to create parallelogram/diamond shape jpanels?
tagged with: java
has comment: http://stackoverflow.com/comment/39578489
score: 0
tagged with: jpanel

http://stackoverflow.com/comment/39396128
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25266086
has text: Faults in the box2d library from Libgdx usually result from freeing objects multiple times, or re-adding the same object multiple times.

http://stackoverflow.com/comment/39393675
comment on: http://stackoverflow.com/q/25279839
has text: I am to remove the element actually. Doing request.remove(iterator.next()) would go wrong.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25261483
has body: Here is how your classes diagram looks like: What is wrong is that class C uses directly class A to retrieve data. It is violation of one of programming good practices, called Law of Demeter which states: Each unit should only talk to its friends; don't talk to strangers. So one should bypass this dependency, by using class B as a proxy. We wil create method getWhatINeed() in class B, which will delegate this call to class A. Here is how your code should look like: public class A { public String[] data; public B doFooB() { return new B(this); } public String[] getWhatINeed() { return data; } } class B { public A a; public B(A a) { this.a = a; } public getWhatINeed() { return a.getWhatINeed(); } public C doFooC() { return new C(this); } } class C { public B b; public C(B b) { this.b = b; } public String[] doFooC() { return b.getWhatINeed(); } } After this, dependencies between your classes will look like this:
type: Answer
accepted answer of: http://stackoverflow.com/q/25259312
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25259312
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25232990
has answer: http://stackoverflow.com/a/25233034
type: AnsweredQuestion
answer count: 3
has title: Which method should change the field, when calling a hierarcy of private methods?
upvote count: 3
downvote count: 0
tagged with: methods
tagged with: conventions
favorite count: 0
type: Question
has body: When a class' public method needs to call a private method that results in a field being changed, which method should change the field? Is there any common convention for this? Is one approach preferable over the other? Consider these two code snippets: public class boolHolder { private boolean theBool = false; public void doYourThing() { // Do a lot of other stuff setBool(); } private void setBool() { // Do a lot of other stuff, justifying a private method for this this.theBool = true; } } VS public class boolHolder { private boolean theBool = false; public void doYourThing() { // Do a lot of other stuff theBool = setBool(); } private boolean setBool() { // Do a lot of other stuff, justifying a private method for this return true; } } These two snipped of course being a very simple case, but I'm sure I'm not the only one ending up with public methods calling a huge tree of private methods. Should the field be set at the end of the branch, or should a value be passed back?
score: 3
has comment: http://stackoverflow.com/comment/39306788
tagged with: field
accepted answer: http://stackoverflow.com/a/25233008
possible better answer: http://stackoverflow.com/a/25233034
tagged with: java
has answer: http://stackoverflow.com/a/25233919
has answer: http://stackoverflow.com/a/25233008

http://stackoverflow.com/q/25321807
has answer: http://stackoverflow.com/a/25322123
type: Question
has body: I'm currently testing API performance and finding that the first few requests are always very slow. 1000ms to 3000ms for the same request. When running it in jMeter it eventually consistently responds around 300ms. The server is located halfway across the world if that makes a difference. It's a REST api coded in Java using Spring JSON response. GET Request Has an Authorization and accept/json header I've also noticed that there unsuccessful responses are on average slower than the successful ones. Could this be related to different performance for different status codes? Or more likely a code issue? Looking at my logs, all transactions complete in the server within 1 ms.
tagged with: rest
has comment: http://stackoverflow.com/comment/39472230
type: UnansweredQuestion
tagged with: spring
score: 0
tagged with: performance
has title: Normal behaviour for API performance?
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39492462
comment on: http://stackoverflow.com/q/25329588
score: 0
has text: `Mockito.verify(childSpy, times(1)).anotherMethod();`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25289591
score: 0
has body: You need to override toString() in ToDo For example: @Override public String toString() { return detail + "," + importance + "," + priority + "," + urgency; }
answers question: http://stackoverflow.com/q/25289461
type: Answer

http://stackoverflow.com/a/25253642
has comment: http://stackoverflow.com/comment/39346302
has comment: http://stackoverflow.com/comment/39353822
answers question: http://stackoverflow.com/q/25253435
type: Answer
has body: I think you cannot simply call "your method", because thats not the way inappbilling works. To activate your inappbilling process and listeners you have to call: m1Helper.launchPurchaseFlow(this, ITEM_SKU, 10001, mPurchaseFinishedListener, "mypurchasetoken"); Look at this: http://www.techotopia.com/index.php/Integrating_Google_Play_In-app_Billing_into_an_Android_Application_%E2%80%93_A_Tutorial
score: 0

http://stackoverflow.com/q/25259466
tagged with: java
has comment: http://stackoverflow.com/comment/39356546
has comment: http://stackoverflow.com/comment/39359206
favorite count: 0
type: Question
tagged with: ajax
has comment: http://stackoverflow.com/comment/39543244
type: UnansweredQuestion
has body: My question is relating to the server side using java servlet, I have an ajax post with event listner like here: What is the cleanest way to get the progress of JQuery ajax request? How do I process this event listener in a java servlet, and what version of java I need for that
has comment: http://stackoverflow.com/comment/39357001
answer count: 0
downvote count: 0
linked to: http://stackoverflow.com/q/19126994
has title: how to use ajax events in java
score: 1
upvote count: 1

http://stackoverflow.com/q/25339025
linked to: http://stackoverflow.com/q/31564215
type: Question
tagged with: phantomjs
score: 3
has body: is there a way i can download a file from server using PhantomJS with selenium?? please help. i have hear that this feature is not presently there in PhantomJS. but is there a workaround for this?? i have seen an issue that is open on #10052 which states that there is no feature yet in phantomJS for downloading or uploading files to server UPDATE refer - https://github.com/ariya/phantomjs/issues/10052 is there a work around?
tagged with: java
favorite count: 0
has title: Java - Selenium with PhantomJS for downloading a file from server
has comment: http://stackoverflow.com/comment/51735374
answer count: 0
upvote count: 3
type: UnansweredQuestion
downvote count: 0
tagged with: selenium

http://stackoverflow.com/a/25245070
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25244976
score: 1
has body: if (size == 0) { System.out.println("Queue is empty "); head = node; } You don't increase size when inserting first node. So when trying to insert the next one, size is still = 0 and thus you are only replacing the head. Just put the size++ outside (after) the IF-Statement and it should work as you expect. And I just saw, there is another issue with tail and head. So the if-clause should be: if (size == 0) { System.out.println("Queue is empty "); head = node; tail = head; } else { // your code here } size++;

http://stackoverflow.com/q/25266718
answer count: 1
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39369852
has title: java8 lambda grouping with condition
has comment: http://stackoverflow.com/comment/39378992
accepted answer: http://stackoverflow.com/a/25266906
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25266906
has body: Java8 and Lambdas - that's my play for now. And another problem/question. I got grouping made with lamda that look like this: Map&lt;Question, List&lt;Answer&gt;&gt; temp = foo.stream().flatMap(x -&gt; x.getValue().stream()).flatMap( x -&gt; x.getAnswers().stream()).collect( Collectors.groupingBy( zz -&gt; zz.getQuestion(), Collectors.mapping(z -&gt; z, Collectors.toList()) ) ); I got myself here from a list of Foo, a map of Question with aggregated List of Answers that users made. QUESTION is it possible to add condition while grouping? In this example, my Question.class has a Double field called Weight, and some Questions got this field null or with a value of 0.0. I don't need them in my aggregated Map, so I was wondering can I add condition here, or do I need to iterate through resulting Map? EDIT foo is a list of Result.class, x.getValue() returns a List of AnswerSet.class, and x.getAnswers() return a list of Answer.class. Answer.class has a Question.class as a field
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25270664
has comment: http://stackoverflow.com/comment/39378656
has title: Bounce balls from each other (LibGDX)
has comment: http://stackoverflow.com/comment/39379262
has comment: http://stackoverflow.com/comment/39410839
has comment: http://stackoverflow.com/comment/39378302
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39392879
tagged with: java
has comment: http://stackoverflow.com/comment/39392829
type: Question
tagged with: libgdx
has body: I'm developing an Android game with the game development framework libgdx. I would like to bounce multiple balls from each other. My method isCircleCollision works fine. But when I try this code, the balls sometimes appear in a collsion at a random place. They wouldn't set to the minimum translation distance. public void moveBalls(float t) { // loop through all balls for(int i = 0; i &lt; balls.size(); i++) { Ball ballA = balls.get(i); float vx = ballA.getVx(); // velocity x float vy = ballA.getVy(); // velocity y float x = ballA.getX(); // position x float y = ballA.getY(); // position y // check if ball collide with other ball for (int j = i + 1; j &lt; balls.size(); j++) { Ball ballB = balls.get(j); float radius = BALL_SIZE / 2; float pointXA = x + radius; float pointYA = y + radius; float pointXB = ballB.getX() + radius; float pointYB = ballB.getY() + radius; if(Collision.isCircleCollsion(pointXA, pointYA, pointXB, pointYB, radius, radius)) { // vector between pointA and pointB Vector2 delta = ballA.getPosition().sub(ballB.getPosition()); float distance = delta.len(); // calculate minimum translation distance vector Vector2 mtd = delta.scl(((radius + radius) - distance) / distance); // add mtd x += mtd.x * 0.5f; y += mtd.y * 0.5f; ballB.setX(ballB.getX() - mtd.x * 0.5f); ballB.setY(ballB.getY() - mtd.y * 0.5f); } } vx = vx + Gdx.input.getAccelerometerX() * ACCEL_X_FACTOR; x -= t * vx; y -= t * vy; ballA.setVx(vx); ballA.setVy(vy); ballA.setX(x); ballA.setY(y); } } Variable f is the frame delta time. vy is set to 60f. All the balls have the same size. Here is an example with two balls with a radius of 2: ballAPoint = (2;2) ballBPoint = (5;4) radius = 2 distance = sqrt((5-2)^2 + (4-2)^2) = 3,61 delta = (3;2) // delta * ((radius + radius) - distance) / distance mtd = delta * ((2 + 2) - 3,61) / 3,61 = (0,324, 216) mtd.x / 2 -&gt; x intersection mtd.y / 2 -&gt; y intersection This seems to be working, but sometimes a ball appear on a random place on the screen. What …
tagged with: android

http://stackoverflow.com/q/25347903
has comment: http://stackoverflow.com/comment/39519584
has comment: http://stackoverflow.com/comment/39522415
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39519729
has comment: http://stackoverflow.com/comment/39519836
has comment: http://stackoverflow.com/comment/39519791
score: 0
has body: The problem im having is that the first image in images array doesn't get drawn sometimes? Any ideas why? Here is my code in Java: The gui class has the main method. Also ive tried reading in the images in the GUI class and passing the images in the constructor of imagesPanel. In that case nothing at all gets drawn. import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import javax.imageio.ImageIO; import javax.swing.JPanel; public class ImagePanel extends JPanel implements MouseMotionListener { int posX=0; int posY=0; ArrayList&lt;Image&gt; images = new ArrayList&lt;Image&gt;(); Image image; public ImagePanel() { this.addMouseMotionListener(this); } public void paintComponent(Graphics g) { try { images.add(ImageIO.read(new File("lion.jpeg"))); images.add(ImageIO.read(new File("monkey.jpg"))); } catch (IOException e) { } super.paintComponent(g); for(int i=0;i&lt;images.size();i++){ g.drawImage(images.get(i), posX, posY,100,100, this); posX=+120; } } @Override public void mouseDragged(MouseEvent arg0) { // TODO Auto-generated method stub // posX = arg0.getX(); // posY = arg0.getY(); // System.out.println(posX + " " + posY); // repaint(); } @Override public void mouseMoved(MouseEvent arg0) { // TODO Auto-generated method stub } } import javax.swing.JFrame; import javax.swing.SwingUtilities; public class GUI { public GUI() { createAndShowGUI(); } private static void createAndShowGUI() { JFrame f = new JFrame("Image Viewer"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800, 800); f.setVisible(true); ImagePanel imagePanel = new ImagePanel(); f.add(imagePanel); } public static void main(String[] args) { new GUI(); } }
has comment: http://stackoverflow.com/comment/39522433
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39519670
has title: Image disappears sometimes
has comment: http://stackoverflow.com/comment/39519599
has comment: http://stackoverflow.com/comment/39519565
has comment: http://stackoverflow.com/comment/39519681
type: Question
has comment: http://stackoverflow.com/comment/39519561

http://stackoverflow.com/comment/39429115
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25298524
score: 0
has text: @user3847203 You need to check your DateFormat, and adjust it to suit your actual input string

http://stackoverflow.com/q/25250077
has comment: http://stackoverflow.com/comment/39339546
type: UnansweredQuestion
has body: I would like to use JavaFX's web browser in an application I am developing for a client. The problem is my client's server runs on a JDK 6 environment and it has a lot of burocracy and paper to ask him to either update Java SDK or to install JavaFX SDK as the Oracle's guide suggests. So I would like to know if there's a way to import JavaFX JAR's into my project instead of having to install it. Thanks a lot.
has comment: http://stackoverflow.com/comment/39341920
score: 2
upvote count: 2
answer count: 0
downvote count: 0
tagged with: java
tagged with: javafx
has title: Using JavaFX without "installing" it
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39362790

http://stackoverflow.com/a/25268385
type: Answer
answers question: http://stackoverflow.com/q/25268312
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25268312
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39373090
has comment: http://stackoverflow.com/comment/39373257
has comment: http://stackoverflow.com/comment/39373039
has comment: http://stackoverflow.com/comment/39372957
has body: java.exe is the Java launcher. It's a very small program that loads jvm.dll, and uses JNI (Java Native Interface, an interface inside jvm.dll that is used to connect C and Java code) to start up the JVM. The difference between the client and server versions is in the warmup time and optimisation strategy (client takes less time to start up than server, but performs less optimisations). So -server is generally better for long-running processes, where the longer startup time is amortised, and -client is generally better for short-lived ones.

http://stackoverflow.com/comment/39588231
score: 0
has text: another usefull hint. getField("...") works for public Fields. If you are using private fields with getter/setter methods (as usual) you need the method getDeclaredField("...")
comment on: http://stackoverflow.com/a/25366838
type: Comment
type: AnswerComment

jca
tag name: jca
type: Tag
tags question: http://stackoverflow.com/q/25257022

http://stackoverflow.com/comment/39588555
has text: okay, just mentioned that to make sure it wasn't the case, most of the times it is
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25384741
type: QuestionComment

http://stackoverflow.com/q/25252171
score: 1
tagged with: java
tagged with: nio
has title: Why do I see NullPointerException when I search files by mask under the root folder ?(windows)
tagged with: search
tagged with: nio2
type: Question
downvote count: 0
has body: I investigate java nio2 possibilities. I knew that I can search files using FileVisitor interface. To achieve this functionality I use glob pattern. code of my example: visitor interface realization: class MyFileFindVisitor extends SimpleFileVisitor&lt;Path&gt; { private PathMatcher matcher; public MyFileFindVisitor(String pattern){ try { matcher = FileSystems.getDefault().getPathMatcher(pattern); } catch(IllegalArgumentException iae) { System.err.println("Invalid pattern; did you forget to prefix \"glob:\"? (as in glob:*.java)"); System.exit(1); } } public FileVisitResult visitFile(Path path, BasicFileAttributes fileAttributes){ find(path); return FileVisitResult.CONTINUE; } private void find(Path path) { Path name = path.getFileName(); if(matcher.matches(name)) System.out.println("Matching file:" + path.getFileName()); } public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes fileAttributes){ find(path); return FileVisitResult.CONTINUE; } } main method: public static void main(String[] args) { Path startPath = Paths.get("E:\\folder"); String pattern = "glob:*"; try { Files.walkFileTree(startPath, new MyFileFindVisitor(pattern)); System.out.println("File search completed!"); } catch (IOException e) { e.printStackTrace(); } } This variant of main method works properly but if I change: Path startPath = Paths.get("E:\\folder"); with Path startPath = Paths.get("E:\\"); I see following stacktrace: Exception in thread "main" java.lang.NullPointerException at sun.nio.fs.WindowsFileSystem$2.matches(WindowsFileSystem.java:312) at io.nio.MyFileFindVisitor.find(FileTreeWalkFind.java:29) at io.nio.MyFileFindVisitor.preVisitDirectory(FileTreeWalkFind.java:33) at io.nio.MyFileFindVisitor.preVisitDirectory(FileTreeWalkFind.java:13) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:192) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69) at java.nio.file.Files.walkFileTree(Files.java:2600) at java.nio.file.Files.walkFileTree(Files.java:2633) at io.n…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25254268
accepted answer: http://stackoverflow.com/a/25254268
favorite count: 0
type: AnsweredQuestion
tagged with: nullpointerexception

http://stackoverflow.com/comment/39349291
type: Comment
score: 0
type: QuestionComment
has text: do you want to break the list from ,, and get 2 arrays?
comment on: http://stackoverflow.com/q/25255227

http://stackoverflow.com/comment/39648783
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25375647
has text: Perhaps they let the user choose the files and they're in a reasonable data structure that just so happens to be hard to read from. For instance, a tree: The IOException might've come from a file, but all you see is its grandparent directory.
type: Comment

http://stackoverflow.com/comment/39570814
type: Comment
type: QuestionComment
has text: @LittleChild Even worse, teaching myself IOS/Objective C
score: 0
comment on: http://stackoverflow.com/q/25374941

http://stackoverflow.com/comment/39347121
type: Comment
comment on: http://stackoverflow.com/a/25254130
has text: Note that you can still add `Object` elements in `array2` and make it w/o a compiler exception nor a runtime exception, no reflection involved.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25237222
type: Answer
score: 0
has body: Not sure if you can make a .exe of your sprid web-application. I suggest you create a small awt/swing wrapper and use the web-view to display the web-application in the simple broswer. You can then package it as jar and run. Not tried anytime but should help.
answers question: http://stackoverflow.com/q/25237132

http://stackoverflow.com/comment/39383964
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25271596
has text: I guess this helped, thanks for accepting it, if its not too much to ask could u upvote it, I would like the rep, thx :P
score: 0

http://stackoverflow.com/comment/39579332
comment on: http://stackoverflow.com/a/25379819
type: Comment
type: AnswerComment
has text: sorry I mean `read()`. It just reads the file and turns it a `DefaultTableModel`
score: 0

http://stackoverflow.com/comment/39551367
has text: Thanks for the effort. It's not critical as long as I can continue sending data during a rehandshake. Is this possible in Java?
score: 0
comment on: http://stackoverflow.com/a/25365200
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25280929
downvote count: 1
has body: You haven't initialized those variables, that's why it is returning default value for those variables. In java following are default values for variables. int -&gt; 0 String -&gt; null (because String is Object in Java)
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25280863
upvote count: 0

http://stackoverflow.com/a/25305015
downvote count: 1
answers question: http://stackoverflow.com/q/25304990
type: Answer
score: 6
has body: You are using wrong syntax. You can use this way for(int i=1, c=4;i&lt;1;i++)
upvote count: 7

http://stackoverflow.com/q/25307460
has body: I am making a game in LibGDX, and I have noticed that when my game is launched a black screen is shown for a few moments before the white screen of my game is drawn. this is the code for my Splash Screen class: public class SplashScreen extends Activity { private final int welcomeScreenDisplay = 500; private Intent intent = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentView(R.layout.main_view); Thread welcomeThread = new Thread() { int wait = 0; @Override public void run() { try { super.run(); while (wait &lt; welcomeScreenDisplay) { sleep(100); wait += 100; } } catch (Exception e) { System.out.println("EXc=" + e); } finally { finish(); intent = new Intent(SplashScreen.this, MainActivity.class); startActivity(intent); } } }; welcomeThread.start(); } } Main Activity: public class MainActivity extends AndroidApplication implements RequestHandler { private int idScreen = 0; Context mContext; Dialog dialog; Button btn_no, btn_yes; RelativeLayout rltMain; View gameView; private WebView ads; ImageView img; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; Bundle bundle = new Bundle(); bundle = this.getIntent().getExtras(); if (bundle != null) { idScreen = bundle.getInt("idScreen"); } ads = new WebView(this); ads.getSettings().setJavaScriptEnabled(true); ads.loadUrl("file:///android_asset/ads.html"); ads.setBackgroundColor(0x00000000); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); rltMain = new RelativeLayout(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_TOP); gameView = initializeForView(new LettreGame(MainActivity.this, idScreen, this), false); rltMain.addView(gameView); rltMain.setLayoutPara…
has comment: http://stackoverflow.com/comment/39445274
has comment: http://stackoverflow.com/comment/39445394
type: Question
tagged with: android
answer count: 0
type: UnansweredQuestion
has title: black screen before startup android game
has comment: http://stackoverflow.com/comment/39445793
score: 0
tagged with: java

http://stackoverflow.com/q/25389463
tagged with: android
tagged with: java
tagged with: android-networking
has comment: http://stackoverflow.com/comment/39599195
favorite count: 0
type: Question
has title: Redo previous request when the first fails with 401 Unauthorized
has answer: http://stackoverflow.com/a/29161905
score: 5
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28195499
has answer: http://stackoverflow.com/a/26152051
answer count: 3
tagged with: retrofit
downvote count: 0
has body: I'm building an Android application that will fetch data from a REST API. To make the requests I'm using Retrofit together with Otto. For all my requests I add a RequestInterceptor that will add a header (Authorization) to all my requests. In the RequestInterceptor I'm calling a method to the my current access_token then I populate the header to the request. RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { Token token = TokenPreferences.getToken(); request.addHeader("Authorization", token.getTokenType() + " " + token.getAccessToken()); } }; RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("https://example.com") .setRequestInterceptor(requestInterceptor) .build(); ... This works fine until the access_token has expired, then the request will fail with HTTP status 401 Unauthorized. When this happens, I want to make a new request to get a new access_token from my refresh_token I got and then do the first request again. I'm not really sure how to make that work.

http://stackoverflow.com/q/25324898
has answer: http://stackoverflow.com/a/25325417
has comment: http://stackoverflow.com/comment/39477766
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39477719
has title: Converting integer to character in java display un readerble wrong values
score: 0
has body: I use simple method to change string values without changing original length of string.then back convert change the text back into pure string(into Original text). My code : String someText = "abcdefgHIJKLMN"; char[] data = someText.toCharArray(); int LEN = someText.length(); char[] datas = new char[LEN]; System.out.println("Original Text ("+String.valueOf(LEN)+"): "+someText); for (int i = 0; i &lt; LEN; i++) { data[i] = Character.valueOf((char) i); System.out.println(String.valueOf(i) + " = " + String.valueOf((char) i)); } System.out.println("Add 10 into each charactor : "); // ex a =1 , a+10 : now it's 'k' for (int i = 0; i &lt; LEN; i++) { char c = Character.valueOf((char) (Character.getNumericValue(Character.valueOf(data[i])) + 10)); datas[i] = c; System.out.print(String.valueOf(c)); } System.out.println("Subtract 10 from each charactor : ");// ex k =11 , k-10 : now it should be 'a' for (int i = 0; i &lt; LEN; i++) { char c = (char) (Character.getNumericValue(Character.valueOf(datas[i])) - 10); System.out.print(String.valueOf(c)); } But after adding and subtracting that loops dose not display anything. If there is any solution to achieve this type of things without changing original length of text? This is the thing I want to do: Let say character value of a is 97 then we add 10 into it:(97+10) = 107 now it's not a it's should be different letter such as k because 107 character value is :K
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39533938
has comment: http://stackoverflow.com/comment/39477855
type: Question

http://stackoverflow.com/a/25267605
score: 4
accepted answer of: http://stackoverflow.com/q/25267497
type: Answer
upvote count: 4
has body: How about this: String.format("%010d", 123456); Details: Formatter or org.apache.commons.lang.StringUtils.leftPad("123456", 10, "0"); Details: StringUtils
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25267497

http://stackoverflow.com/comment/39408399
comment on: http://stackoverflow.com/q/25287722
type: Comment
type: QuestionComment
has text: Why haven't you shown us the crucial declaration and initialization of `dateFormat`?
score: 1

http://stackoverflow.com/q/25285095
has title: Java Garbage Collector Class A -> Class B -> Class C-> Class B And Cyclic Reference
has answer: http://stackoverflow.com/a/25285161
has comment: http://stackoverflow.com/comment/39403776
has answer: http://stackoverflow.com/a/25285354
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39403616
has body: I have a question related to Garbage Collection in Java Let us thought of a situation There are three classes Class A,Class B,Class C Now A has B B has C Now say A=null; (I assign null to A) Will A be eligible for Garbage Collection ? If yes, What will happen to C then ?
tagged with: java
has comment: http://stackoverflow.com/comment/39403511
has comment: http://stackoverflow.com/comment/39403954
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/39404127
downvote count: 1
linked to: http://stackoverflow.com/q/1910194
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25285161
accepted answer: http://stackoverflow.com/a/25285354

http://stackoverflow.com/comment/39360814
has text: did you tried with odbc connector?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25261785
score: 0

http://stackoverflow.com/a/25377688
type: Answer
has body: This is not thread-safe without a further synchronization guarantee. Basically, one cannot be sure of consistent visibility between threads without proper synchronization - such as synchronized, or other happens-before guarantees of the JLS. That is, even though there may be no "concurrent modifications", there is no guarantee that the non-writer thread sees the modifications to said object.
answers question: http://stackoverflow.com/q/25377608
score: 5
downvote count: 0
upvote count: 5

http://stackoverflow.com/a/25328724
score: 1
type: Answer
has body: You could use capturing groups also, String str = "\"sampleDay\": newDate(1402027200000)"; System.out.println(str.replaceAll(".*?newDate\\(([^\\)]*)\\).*", "$1")); // 1402027200000
answers question: http://stackoverflow.com/q/25328610
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25271919
upvote count: 1
has body: You can use a Map as a helper. iterate over the ArrayList Lets say the i'th element of the list contains the number n. If map.containsKey(n), map.get(n) is the location in the list of the previous occurrence of n. remove both the i'th element and the map.get(n)'th element from the list. remove the key n from the map. Else map.put (n,i) Implementation note : Don't use an enhanced for loop to iterate over the list (since it doesn't allow removal of elements). Iterate over the indices of the list. This will allow you to remove the elements by their index (but remember that when you remove the i'th element, the previous i+1 element becomes the new i'th element).
type: Answer
answers question: http://stackoverflow.com/q/25271785
score: 1
downvote count: 0

http://stackoverflow.com/a/25231207
type: Answer
answers question: http://stackoverflow.com/q/25231196
score: 1
downvote count: 0
has body: use a StringBuilder to join all the words. List&lt;String&gt; words; //assume words have 5 elements StringBuilder summary = new StringBuilder(); for (String word : words){ summary.append(word); } Finally, get the joined String with summary.toString(). Note : If you have an idea of the number of characters that would be appended to the StringBuilder, it will be more efficient to use the constructor that gets an initial size : summary = new StringBuilder(size);.
upvote count: 1

http://stackoverflow.com/q/25335795
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25336497
favorite count: 0
type: Question
answer count: 2
tagged with: polling
tagged with: interrupted-exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25335920
downvote count: 0
has title: InterruptedException thrown from futures
has body: Suppose I have a method as follows: public void poll(Callable&lt;Boolean&gt; callable) { ScheduledExecutorService service = Executors.newSingleThreadedScheduledExecutor(); Future&lt;Boolean&gt; future = service.schedule(callable, 0L, TimeUnit.MILLISECONDS); try { while (!future.get()) { future = service.schedule(callable, 5L, TimeUnit.MINUTES); } } catch (ExecutionException e) { // ... } catch (InterruptedException e) { // ... } finally { service.shutdown(); } } How does an InterruptedException ever get thrown (and caught in poll())? Anything thrown by the callable (including InterruptedException, right?) would be an ExecutionException, we never cancel any futures, and the service's shutdownNow() is never called. Aside: being what it is, is it possible to make this polling method more bulletproof against things like InterruptedException?
upvote count: 1
tagged with: scheduledexecutorservice

http://stackoverflow.com/q/25319590
score: 1
has comment: http://stackoverflow.com/comment/39468587
downvote count: 0
has answer: http://stackoverflow.com/a/25319944
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25319617
accepted answer: http://stackoverflow.com/a/25319619
tagged with: java
has title: current modification exception in java while removing from array list
has answer: http://stackoverflow.com/a/25319619
possible better answer: http://stackoverflow.com/a/25319617
type: Question
answer count: 3
has body: public void removeVehicle(String licenseNum){ for (Vehicle vehicle : vehicleLot){ String flag = vehicle.getLicenseNumber().toString(); if(flag.compareTo(licenseNum) == 0){ int num = vehicleLot.indexOf(vehicle); vehicleLot.remove(num); } I am getting this exception, I am trying to remove a vehicle from a array list where it matched the license number like above. my array list is like this private List&lt;Vehicle&gt; vehicleLot = new ArrayList&lt;Vehicle&gt;();

http://stackoverflow.com/comment/39422570
score: 0
comment on: http://stackoverflow.com/q/25294836
type: Comment
has text: @JBNizet - Thanks for correcting. That was a typo.
type: QuestionComment

http://stackoverflow.com/q/25270939
tagged with: jbutton
has comment: http://stackoverflow.com/comment/39381544
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25271925
answer count: 1
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/39378764
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39377973
type: UnansweredQuestion
has body: I have a custom control extending JPanel with a couple of JButtons inside. When I see them from the NetBeans Designer, they look with a given size. But when I put them on a form and I put the form in runtime, the size looks smaller. This is how it looks in the NetBeans Designer, and how it looks in runtime. Same for text onside TextArea controls. Why does it happen? The meaning of having a design interface is to design something in a given way. If it looks different at runtime, there is no meaning :-)
has title: JButton and text smaller at Runtime

http://stackoverflow.com/q/25340834
downvote count: 0
has answer: http://stackoverflow.com/a/26386922
has comment: http://stackoverflow.com/comment/39508378
has comment: http://stackoverflow.com/comment/39508914
has comment: http://stackoverflow.com/comment/39510238
score: 1
tagged with: java
answer count: 1
upvote count: 1
tagged with: parsing
has body: I am using Java ASTParser to parse my java code. I am using following code. Using this code I am able to extract "if" &amp; "try" statements. But I am not able to extract "catch clause". Does any one have any idea how to extract catch-clause separately in this. Following code is not giving any error, but its not printing anything in catch clause. public static void methodVisitor(String content) { //debug("entering met visitor", "1"); ASTParser metparse = ASTParser.newParser(AST.JLS3); metparse.setSource(content.toCharArray()); metparse.setKind(ASTParser.K_STATEMENTS); Block block = (Block) metparse.createAST(null); block.accept(new ASTVisitor() { public boolean visit(IfStatement myif) { System.out.println("myif="+myif.toString()); return false; } public boolean visit(TryStatement mytry) { System.out.println("mytry="+mytry.toString()); return false; } public boolean visit(CatchClause mycatch) { System.out.println("mycatch="+mycatch.toString()); return false; } }); } Following is the example code that I am trying to query: public class Clock2 extends Applet implements Runnable { private static final long serialVersionUID = 1L; Thread timer; // The thread that displays clock int lastxs, lastys, lastxm, lastym, lastxh, lastyh; // Dimensions used to draw hands SimpleDateFormat formatter; // Formats the date displayed String lastdate; // String to hold date displayed Font clockFaceFont; // Font for number display on clock Date currentDate; // Used to get date to display Color handColor; // Color of main hands and dial Color numberColor; // Color of second hand and numbers @Override public void init() { lastxs = lastys = lastxm = lastym = lastxh = lastyh = 0; formatter = new SimpleDateFormat ("EEE MMM dd hh:mm:ss yyyy", Locale.getDefault()); currentDate = new Date(); lastdate = formatter.format(currentDate); clockFaceFont = new Font("Serif", Font.PLAIN, 14); handColor = Color.blue; numberColor = Color.darkGray; try { setBackground(new Color(Integer.parseInt(getParameter("b…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39509119
type: UnansweredQuestion
has title: Extracting Catch Clause Using ASTParser in Java Source code

http://stackoverflow.com/q/25347121
downvote count: 0
score: 1
upvote count: 1
has body: I am using Gson API 2.4.2 for parsing json data.Please find below my json data var data = { "timezoneId" : timezoneId, "companyId" : companyId, "testId" : testId, "graphType" : graphType, "locationId":locationId }; here values of timezoneId,companyId etc are dynamically generated from java script file thats why they are not hardcoded and i have inspect from my browser that values are comming properly.Now,In backed I have a JSF bean class as follows: package com.edfx.warm.bean; import java.io.Serializable; public class ResponseInfoForJSON implements Serializable { private static final long serialVersionUID = -40538895168761693L; private String timezoneId; private String companyId; private String testId; private String graphType; private String locationId; public String getTimezoneId() { return timezoneId; } public void setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; } public String getCompanyId() { return companyId; } public void setCompanyId(String companyId) { this.companyId = companyId; } public String getTestId() { return testId; } public void setTestId(String testId) { this.testId = testId; } public String getGraphType() { return graphType; } public void setGraphType(String graphType) { this.graphType = graphType; } public String getLocationId() { return locationId; } public void setLocationId(String locationId) { this.locationId = locationId; } public static long getSerialversionuid() { return serialVersionUID; } } here is my code for converting json to java object public void deserializeObjectCollection(String jsonData){ ResponseInfoForJSON[] responseInfoForJSON=new Gson().fromJson(jsonData, ResponseInfoForJSON[].class); } during conversion I am getting the following error Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 2 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveType AdapterFactory.java:176) [gson-2.2.4.jar:] at co…
favorite count: 0
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
possible better answer: http://stackoverflow.com/a/35408434
accepted answer: http://stackoverflow.com/a/25585063
has answer: http://stackoverflow.com/a/35408434
has answer: http://stackoverflow.com/a/25585063
has title: Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 2
answer count: 2
has comment: http://stackoverflow.com/comment/39518376
type: AnsweredQuestion

http://stackoverflow.com/comment/60724566
type: AnswerComment
comment on: http://stackoverflow.com/a/25395106
score: 1
type: Comment
has text: Very impressive Sir... and this has helped me multiple times

http://stackoverflow.com/a/25364844
has comment: http://stackoverflow.com/comment/39550692
score: 5
has body: This should handle the cases where files don't exist: try { // most of your stuff } catch (NoSuchFileException ex) { return null; }
answers question: http://stackoverflow.com/q/25364766
downvote count: 0
has comment: http://stackoverflow.com/comment/39551218
has comment: http://stackoverflow.com/comment/39551069
has comment: http://stackoverflow.com/comment/39551164
upvote count: 5
type: Answer

http://stackoverflow.com/comment/39853242
comment on: http://stackoverflow.com/a/25526519
type: Comment
has text: ya i have implement all steps in app.but can not call custom function and through exception (does not found function)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39380482
type: AnswerComment
score: 1
has text: Ah, of course, because everything gets shifted over. This works flawlessly (as far as I've tested it) and looks to be the simplest code to me. Thank you so much for the help, I greatly appreciate it!
comment on: http://stackoverflow.com/a/25272190
type: Comment

http://stackoverflow.com/q/25334426
tagged with: inheritance
has comment: http://stackoverflow.com/comment/40496155
has answer: http://stackoverflow.com/a/25334560
has body: I have an array of objects from one class that I made, which includes both objects of that type and objects that extend the first object. I want to access a variable that the extending object has that the first object does not, once I know that the object I am talking about is the extending one. A simplified example of this is shown below: public class Parent { public boolean isChild=false; } public class Child extends Parent { public int i=5; public Child() { isChild=true; } } public class main { public static void main(String[] args) { Parent x=new Child(); if (x.isChild) { System.out.println(x.i); //this is what I want to do... //... but I get an error because Parent doesn't have a variable called i. } } } So, is there any way for me to get around this? (I looked at making a protected static variable but that didn't seem to be what I wanted because I need multiple copies of it.) Okay, as for how this is actually being used (which I incorrectly didn't include the first time) I am making my own computer programming language for fun. I have an ArrayList of objects that have been created, and allow users of this language to make their own objects as well as use ones that I have made with both java code and code in my language. I make strings (aka child) in java and have them extend my wafl_object class (parent). This way they can be carried around in that ArrayList without me having to go around with a different array for every object I make. However, I want to accept a String as a parameter for a different class, and I cannot see its value because it is in an object array and I was treating it like an object. I have now fixed this problem by casting it as a String, once I know that it really is one, and then looking at its value. In this situation, it was easier to just cast it, but in others abstactness may have been more usefull.
has comment: http://stackoverflow.com/comment/39496578
has title: Can I reasonably access a variable of an extending class?
score: 0
has answer: http://stackoverflow.com/a/25334449
possible better answer: http://stackoverflow.com/a/25334485
has answer: http://stackoverflow.com/a/25334537
has comment: http://stackoverflow.com/comment/39496679
has answer: http://stackoverflow.com/a/25334594
tagged with: java
answer count: 7
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39497514
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25334457
type: AnsweredQuestion
tagged with: extends
has answer: http://stackoverflow.com/a/25334454
has answer: http://stackoverflow.com/a/25334485
accepted answer: http://stackoverflow.com/a/25334449

http://stackoverflow.com/comment/39306788
type: QuestionComment
score: 0
has text: in general it is better to use public setters and keep fields private, thus setting the field would be possible from any where the class accessible. your doYourThing() method looks to me that it is not actually a setter; it could also contain other logic. feels like not a good place to perform the set.
type: Comment
comment on: http://stackoverflow.com/q/25232990

http://stackoverflow.com/comment/39354824
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25257904
score: 0
has text: brother try new answer !!

http://stackoverflow.com/comment/39568995
has text: Not sure that `WHERE artist = ?` is right, shouldn't it be `WHERE artist LIKE ?`?? - Otherwise, yes, that's the way it should be done ;)
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25374186
type: Comment

http://stackoverflow.com/q/25287329
has body: Hi I need to make some widgets with Processing, for which I'm considering wrapping things together with a customized subclass of PGraphics. Then I'll be able to drag them around. The current problem is, how do I get the position of a PGraphics object? PGraphics widg; void setup(){ widg=createGraphics(50,50); drawWidg(); image(widg,10,10); } void draw(){ } void mouseClicked(){ //PGraphics doesn't have x, y properties. How to get the position of widg? if(mouseX-widg.x&gt;0 &amp;&amp; mouseX-widg.x&lt;widg.width &amp;&amp; mouseY-widg.y&gt;0 &amp;&amp; mouseY-widg.y&lt;widg.height){ println("clicked!"); } } void drawWidg(){ widg.beginDraw(); ... widg.endDraw(); }
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25289606
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25289606
downvote count: 0
answer count: 1
upvote count: 1
has title: Processing: Get position of PGraphics object
tagged with: pgraphics
favorite count: 0
type: Question
tagged with: processing

http://stackoverflow.com/a/25341662
type: Answer
has body: The intern() method does not modify the string, it simply returns the corresponding string from the string pool. So, since you're not keeping the return values, your calls to intern() are meaningless. However, if you actually use them, you'll see that both point to exactly the same string: public static void main (String[] args) { String s1 = new String("hello"); String s2 = new String("hello"); s1 = s1.intern(); s2 = s2.intern(); System.out.println(s1 == s2); // will print true }
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25341634
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25341634
score: 4

http://stackoverflow.com/comment/39324008
comment on: http://stackoverflow.com/q/25241007
score: 0
has text: Yes, I tried that, posted wrong code, sorry.(doesn't work still)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39450973
type: QuestionComment
has text: It should be noted that some other regex engines have absolutely no problem with `{"nil":"true"}`, as it doesn't contain any number they just don't see it as a quantifier. It' a... feature... of the java regex parser.
comment on: http://stackoverflow.com/q/25309979
score: 0
type: Comment

http://stackoverflow.com/comment/39349276
comment on: http://stackoverflow.com/q/25254055
type: Comment
type: QuestionComment
has text: This means that this is not a JPA issue, it is a JAXB issue. You need to customise your JAXB parsing to ignore the time zone information in the date. It would be better if the sender excluded the time zone in the first place.
score: 2

http://stackoverflow.com/q/25340231
tagged with: interface
has answer: http://stackoverflow.com/a/25340541
tagged with: java
tagged with: generics
favorite count: 0
type: Question
has body: I'm trying to wrapp two interfaces in one to not have to rewrite each method using each interface. I searched a lot but I don't know how can I do this: class ApplyFilter { public static File[] filter (File directory, FileFilterORFilenameFilter filterWrapper) { return directory.listenFiles(filterWrapper); } } I tried it creating a class that implements both interfaces but then I need to cast the variable. I also tried using java generics using a class like this: public class CustomFilter&lt;T&gt; { /* Where we store our filter */ private T filter = null; /* The method to return it */ public T getFilter () { return filter; } /* The constructor to define the filter */ public CustomFilter (T filt) { if ( !(filt instanceof FileFilter) || !(filt instanceof FilenameFilter) ) throw new IllegalArgumentException("The argument must be an instance of FilenameFilter or a FileFilter."); this.filter = filt; } } Then I used it like this and it worked: class test { public static void main (String[] args) { CustomFilter&lt;FileFilter&gt; onlyShowFolders = new CustomFolder&lt;FileFilter&gt;(new FileFilter () { @Override public boolean accept (File file) { return file.isDirectory(); } }); File root = new File("/"); for (File folder : root.listFiles(onlyShowFolders.getFilter())) { System.out.print(folder.toPath()); } } } But when I use it in the ApplyFilter class it doesn't work. class ApplyFilter { /* DOESN'T WORK :( */ public static File[] filter (File directory, CustomFilter filterWrapper) { return directory.listenFiles(filterWrapper.getFilter()); } } Thanks in advance.
answer count: 2
possible better answer: http://stackoverflow.com/a/25340541
has answer: http://stackoverflow.com/a/25340590
upvote count: 1
downvote count: 1
has title: How to use two interfaces as argument using generics in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39507379
score: 0
accepted answer: http://stackoverflow.com/a/25340590

http://stackoverflow.com/a/25263253
type: Answer
score: 1
downvote count: 0
upvote count: 1
has body: You could use a Map (e.g. HashMap) with the key representing the name of the variable and the map's value representing the variable's value. This allows for having a flexible data structure where it is not necessary to know in before how many "variables" there will be.
answers question: http://stackoverflow.com/q/25263085

http://stackoverflow.com/comment/39325554
has text: You cannot nest a JSP tag in the attribute of another like that; this is basic JSP syntax.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25242569

http://stackoverflow.com/q/25370135
linked to: http://stackoverflow.com/q/3191837
score: 0
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/6432170
has body: I'm not sure how to ask this question, and I'm certain that there's some kind of other solution to the problem I'm having so if anyone can point me in the right direction, I'd appreciate it. In any case, the issue I'm having is that I have a String[] list (called "projects") that I'm using to populate a combo box. I want to use the selection from the combo box to dynamically change the form fields listed in a GUI panel. My approach, so far, isn't dynamic enough because I will have nearly 100 possible selections from the combo box when I'm done. So far, I've been testing with 3 options in the box, but scaling it up to 100 will involve a lot of code, and I think there MUST be some other solution, right? I just don't know what that solution is. String[] projects = {"Select a project...", "Option1", "Option2", "Option3"}; String[] Option1= {"phone", "maxphv"}; String[] Option2= {"address1", "address2", "house", "predir", "street", "strtype", "postdir", "apttype", "aptnbr" , "city", "state", "zip"}; String[] Option3= {"phone"}; ArrayList&lt;String&gt; fieldslist, fieldslbllist; Ideally, I'd like to take the name of the project selected from the projects String[] combo box and reference that name as the name of another list that contains the fields I want to display in the panel. But I gather from reading on other questions that the name of a variable is irrelevant once the code is compiled. At this point, I have a set of code to clear the panel and dynamically select the fields, but I still have to manually code the replacement for each of the 100 options. That's not terrible, I suppose, but I think that there is probably a better way that I am unaware of. public void resetFields() { fieldslist.clear(); fieldslbllist.clear(); } public void setFields() { if (project.getSelectedIndex() == 0) { resetFields(); } else if (project.getSelectedIndex() == 1) { resetFields(); for (int i = 0; i &lt;= Option1.length; i++) { fieldslist.add(Option1[i]); fieldslbllist.add(Option1[i]+"l…
type: Question
has answer: http://stackoverflow.com/a/25374650
type: UnansweredQuestion
tagged with: swing
tagged with: combobox
has title: Java Swing Dynamic Field Selection

http://stackoverflow.com/q/25387978
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39656183
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Saying I have an interface A, I want to use custom deserializer for all classes implement interface A, So I use code below but it doesn't work, While CustomAserializer works. So what should I do to deserialize all classes implement A using my custom deserializer. Thanks. module.addDeserializer(A.class, new CustomADeserializer()); module.addSerializer(A.class, new CustomASerializer())
tagged with: deserialization
favorite count: 0
type: Question
tagged with: serialization
has comment: http://stackoverflow.com/comment/39644133
has answer: http://stackoverflow.com/a/61775176
has answer: http://stackoverflow.com/a/34128468
tagged with: jackson
upvote count: 12
has title: How to add custom deserializer to interface using jackson
score: 12
has comment: http://stackoverflow.com/comment/39649549
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/39565733
has text: @shekharsuman I'm afraid defining `min` and `max` in terms of `abs` is a bit too much like code golf for me!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25372271

http://stackoverflow.com/q/25304787
has comment: http://stackoverflow.com/comment/39442524
has comment: http://stackoverflow.com/comment/41378635
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: wear-os
type: Question
has title: It is impossible Debugging over Bluetooth
has comment: http://stackoverflow.com/comment/39442573
accepted answer: http://stackoverflow.com/a/25305888
tagged with: android
has answer: http://stackoverflow.com/a/25305888
has body: Trying to debug an application on wear. Prior to this, using the emulator, we now have the device. Following the instructions, stopped on the line In the Android Wear companion app, you should see the status change to: Host: connected Target: connected The phone status host: not connected target device is connected. what could be the problem? I have a feeling that it is impossible to connect device. P.s. USB debugging on my phone, and debugging via bluetooth on the clock included. App for my phone (for my model LG G Watch), also downloaded and installed.
type: AnsweredQuestion

http://stackoverflow.com/a/25377332
has comment: http://stackoverflow.com/comment/39575466
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25377175
has body: Use this dude ! :) You can use contextDescription to access the actual text textView.setText(yourText.replaceAll("[0-9]","")); textView.setContentDescription(yourText); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String str = ((TextView) v.getContentDescription()).toString(); } });
upvote count: 1

http://stackoverflow.com/q/25352904
has comment: http://stackoverflow.com/comment/39528437
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39528702
has body: For example, can I create List that will contain String and other List? And if I can do that, what is the specific of my List? I can just say that it contains data of type Object, right?
answer count: 3
duplicate of: http://stackoverflow.com/q/6231973
has title: Create collection in Java without knowing the type?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39528487
has comment: http://stackoverflow.com/comment/39528458
possible better answer: http://stackoverflow.com/a/25353028
accepted answer: http://stackoverflow.com/a/25352921
has answer: http://stackoverflow.com/a/25353028
has answer: http://stackoverflow.com/a/25352921
linked to: http://stackoverflow.com/q/6231973
has answer: http://stackoverflow.com/a/25353306
tagged with: collections

http://stackoverflow.com/comment/40209881
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25720438
has text: i want to page size as it is ex.. if the page size is **A4** then output page should be **A4**

http://stackoverflow.com/comment/39360219
type: Comment
score: 0
has text: what is catAddButton supposed to do?
comment on: http://stackoverflow.com/q/25261190
type: QuestionComment

http://stackoverflow.com/comment/39437088
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25302797
type: QuestionComment
has text: Can you print the whole URL

http://stackoverflow.com/q/25241768
has comment: http://stackoverflow.com/comment/39324042
has comment: http://stackoverflow.com/comment/39323801
accepted answer: http://stackoverflow.com/a/25242171
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39323413
has answer: http://stackoverflow.com/a/25242171
possible better answer: http://stackoverflow.com/a/25241997
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39323177
has answer: http://stackoverflow.com/a/25242475
favorite count: 0
has comment: http://stackoverflow.com/comment/39323170
has comment: http://stackoverflow.com/comment/39323733
type: Question
downvote count: 4
upvote count: 2
has comment: http://stackoverflow.com/comment/39323200
has comment: http://stackoverflow.com/comment/39323657
has answer: http://stackoverflow.com/a/25241997
score: -2
tagged with: arrays
has body: I am practicing for my programming test and I came to a problem where I have to remove preceding 0's in my array. Suppose I have an array of [0, 0, 6, 7, 0, 3]. My result array should be [6, 7, 0, 3]. My program should only remove preceding 0's only. I cannot use any inbuilt methods like array shift etc. Please suggest! boolean var=true; int len = a.length,counter=0; //length of main array int reslen = resultArr.length; int [] arr = new int[len]; // new array for(int i =0; i&lt;len ; i++){ if(a[i]==0 &amp;&amp; counter==0){ continue; }else{ arr[counter] = a[i]; counter++; } }
has comment: http://stackoverflow.com/comment/39323481
has title: How to remove preceding zeros in an array

http://stackoverflow.com/a/25385945
has comment: http://stackoverflow.com/comment/39591929
has comment: http://stackoverflow.com/comment/39619860
type: Answer
has body: The version of the Apache classes you compiled with doesn't match the version you are executing with, and specifically they are not the same. Compare your DefaultHttpClient class imported in your jar project with the android implementation of DefaultHttpClient. I would also suggest to build a android library project with same functionality to avoid such errors as not all classes are implemented the same way in android as in java.To learn more on how to build android library project refer-http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject
score: 0
has comment: http://stackoverflow.com/comment/39630145
has comment: http://stackoverflow.com/comment/39592022
answers question: http://stackoverflow.com/q/25385350

http://stackoverflow.com/comment/39480143
score: 0
has text: refer http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
type: Comment
comment on: http://stackoverflow.com/q/25326176
type: QuestionComment

http://stackoverflow.com/a/25347342
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39530129
accepted answer of: http://stackoverflow.com/q/25347100
has comment: http://stackoverflow.com/comment/39530070
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: You are experiencing the effects of "Eventual Consistency", which is a side effect of using the High Replication Datastore. Basically, you are calling the query before the data has time to replicate across data centres. You can avoid this, by using "Ancestor Queries", which always results in "Strongly Consistent" queries. Suggest you read this, which explains it in detail.
answers question: http://stackoverflow.com/q/25347100

http://stackoverflow.com/q/25335954
has comment: http://stackoverflow.com/comment/39499701
score: 3
has title: Spring + Hibernate + postgresql
has answer: http://stackoverflow.com/a/25335997
answer count: 2
has comment: http://stackoverflow.com/comment/39499655
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39499645
downvote count: 0
has comment: http://stackoverflow.com/comment/39499670
has answer: http://stackoverflow.com/a/26793743
favorite count: 0
has body: I am a newb to java web. So I wanted to learn some new skills about Jsp + Spring 3 + Hibernate + postgresql. And I am having a very hard time to do the setup and configurate xml files in eclipse maven project. Wish that some body will help to guide me to a right direction. So my web.xml contains a very basic setting: org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:/spring/applicationContext.xml, classpath:/spring/hibernateContext.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation 1 appServlet / My resources/spring/applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.isad"/> <mvc:annotation-driven /> <!-- <mvc:view-controller path="/login" view-name="login" /> --> my resources/spring/hibernateContext.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> classpath:database.properties classpath*:hbm/Book.hbm.xml org.hibernate.dialect.MySQLDialect true <tx:annotation-driven transaction-manager="transactionManager"/> My resources/database.properties jdb…
type: Question
has comment: http://stackoverflow.com/comment/39499823
has comment: http://stackoverflow.com/comment/39499505
tagged with: postgresql
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/39499653
tagged with: spring

http://stackoverflow.com/comment/39433267
type: AnswerComment
has text: Note that `DateTime` objects are immutable. Your call to `dt.plusMonths(6);` does not affect the `dt` object. You need to capture the result using, e.g. `dt = dt.plusMonths(6);`
comment on: http://stackoverflow.com/a/25300162
type: Comment
score: 0

http://stackoverflow.com/comment/39499645
has text: yep, my exception is changed. Now the first one is: SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/hibernateContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
comment on: http://stackoverflow.com/q/25335954
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25374113
favorite count: 0
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25374128
accepted answer: http://stackoverflow.com/a/25374128
type: AnsweredQuestion
upvote count: 3
score: 0
downvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39568948
has comment: http://stackoverflow.com/comment/39568914
has body: Using Java program I need to run/open/edit any file. This should have similar effect of double clicking file in File Explorer and OS will execute file if it an executable OR open/edit it in it's respective registered program. I have tried the Runtime.exec() method (See down there) but that method only runs executable files. I need mine to run any file. This includes text files, audio files, pictures, anything. I have tried the following: Runtime.getRuntime().exec("README.txt");
has title: Java: Run/Open/Edit any file
has comment: http://stackoverflow.com/comment/39568752

http://stackoverflow.com/a/25371331
answers question: http://stackoverflow.com/q/25371274
has body: In SQL, string values must be quoted: String query = "..." + COL_FB_COMMENTS+"= 'HELLO' WHERE ..."; Anyway, formatting problems such as this (which get worse when the string itself contains quotes) can be avoided by using parameters: String query = "... SET " + COL_FB_COMMENTS+"= ? WHERE " + COL_FB_ID+"="+id; db.execSQL(query, new Object[] { "HELLO" });
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/39301153
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25230257
has text: Oops, I thought I had taken that line out. That fixed it.
score: 0

http://stackoverflow.com/comment/39396380
has text: http://stackoverflow.com/questions/13074459/javafx-2-and-css-pseudo-classes-setting-hover-attributes-in-setstyle-method
comment on: http://stackoverflow.com/q/25279967
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/25260083
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25258432
has body: AFAIK, a spring application context uses only one PropertySourcesPlaceholderConfigurer. As, the @PropertySource(value = { "classpath:db.properties" }) does not seem to populate the environment, I can see only one other solution : explicitely add it to the list of locations in AppConfig.java : props.setLocations(new Resource[] { new ClassPathResource( "application.properties"), new ClassPathResource("db.properties")}); But I must admit this is more a workaroud than a clean solution. EDIT : But normally, is DataSourceConfig.java is scanned by spring configuration machinery, the @PropertySource(value = { "classpath:db.properties" }) should populate the environment.

http://stackoverflow.com/comment/39445097
comment on: http://stackoverflow.com/q/25307340
type: Comment
type: QuestionComment
has text: maybe try to figure out why your mailserver is rejecting connections... Check logs...
score: 0

http://stackoverflow.com/q/25363027
tagged with: wrapper
tagged with: java
has answer: http://stackoverflow.com/a/25363953
has comment: http://stackoverflow.com/comment/39547330
has title: JNI GetMethodID not working for constructor of inner class
favorite count: 0
type: Question
tagged with: constructor
has comment: http://stackoverflow.com/comment/39547555
has body: I have a class with a private subclass. I want to create an instance of that subclasss in a JNI wrapper and return it. I've googled and tried to make it work but with no success (methodID is null). Any suggestions? JNIEXPORT jobject JNICALL Java_some_Class_some_Jni_Method(JNIEnv *env, jobject this) { jclass cls = (*env)-&gt;FindClass(env, "someClass$someSubclass"); if (cls == NULL) printf("jclass error."); jmethodID methodID = (*env)-&gt;GetMethodID(env, cls, "&lt;init&gt;", "()V"); // -&gt; problem! if (methodID == NULL) printf("jmethodID error."); jobject obj = (*env)-&gt;NewObject(env, cls, methodID); if (obj == NULL) printf("jobject error."); return obj; } EDIT1: adding class definition: public class someClass { private class someSubclass { public someSubclass() { } ... } ... } EDIT2: Ok I figured out you need parent class in the GetMethodID signature, so in my example: jmethodID methodID = (*env)-&gt;GetMethodID(env, cls, "&lt;init&gt;", "(LsomeClass;)V"); But now I get EXCEPTION_ACCESS_VIOLATION with NewObject function. EDIT3: I also needed to add calling class object/pointer to the NewObject function: jobject obj = (*env)-&gt;NewObject(env, cls, methodID, this); Constructor of nested class is now called properly.
upvote count: 12
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/28137717
tagged with: http://stackoverflow.com/tag/c
score: 11
has answer: http://stackoverflow.com/a/64038086
downvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/39383460
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25363953
possible better answer: http://stackoverflow.com/a/28137717

http://stackoverflow.com/comment/94521062
type: AnswerComment
has text: What is the difference between `adb shell rm` + `adb shell pm clear` combo and [`adb uninstall`](https://android.stackexchange.com/a/92130/78385)?
comment on: http://stackoverflow.com/a/25301226
score: 1
type: Comment

http://stackoverflow.com/comment/39412860
type: Comment
comment on: http://stackoverflow.com/a/25283829
type: AnswerComment
has text: @Thomas - Oh, I agree :)
score: 0

http://stackoverflow.com/comment/39538125
has text: Still got the same result. The checkbox not align to the left :(
comment on: http://stackoverflow.com/a/25357818
score: 0
type: Comment
type: AnswerComment

vote
type: Tag
tags question: http://stackoverflow.com/q/25363818
tag name: vote

http://stackoverflow.com/q/25298691
accepted answer: http://stackoverflow.com/a/25299575
downvote count: 0
possible better answer: http://stackoverflow.com/a/25298748
has answer: http://stackoverflow.com/a/25298730
has answer: http://stackoverflow.com/a/25299575
has answer: http://stackoverflow.com/a/25298719
has body: How can I check whether the file version is .gz or .bzip2. I searched in File Java docs but couldn' find any method. Can you please let me know? My requirement is to show the file on the UI , if .txt doesn't exist then check if .gz exists and if that doesnt exist then check if .bzip2 file exists and hence I am looking to check the extension of the file. I am assuming that I need to be looking at the Type of file.
tagged with: file-type
has answer: http://stackoverflow.com/a/25298748
has comment: http://stackoverflow.com/comment/39450529
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39432897
answer count: 5
has title: How to check the File Type in java
score: 6
has answer: http://stackoverflow.com/a/41363032
upvote count: 6
has comment: http://stackoverflow.com/comment/39429408
has comment: http://stackoverflow.com/comment/39429483
has comment: http://stackoverflow.com/comment/39429425
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39450120
has comment: http://stackoverflow.com/comment/39429560
tagged with: java

http://stackoverflow.com/a/25251935
type: Answer
has comment: http://stackoverflow.com/comment/39343262
has comment: http://stackoverflow.com/comment/39343474
answers question: http://stackoverflow.com/q/25251781
downvote count: 0
has comment: http://stackoverflow.com/comment/39343680
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39343581
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39343960
accepted answer of: http://stackoverflow.com/q/25251781
has body: Try this code to get data about you're inventory. Nice article to read: http://developer.android.com/training/in-app-billing/purchase-iab-products.html How to call method: mHelper = new IabHelper(this, base64EncodedPublicKey); mHelper.enableDebugLogging(true); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { return; } if (mHelper == null) return; List&lt;String&gt; st = new ArrayList&lt;String&gt;(); st.add(ITEM_SKU); mHelper.queryInventoryAsync(true,st,mGotInventoryListener); } }); How to query inventory for the items. IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() { public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (mHelper == null) return; if (result.isFailure()) { return; } if(inventory.hasPurchase(ITEM_SKU)) { Intent intent = null; intent = new Intent(getActivity(), Ce.class); startActivity(intent); } } };
has comment: http://stackoverflow.com/comment/39343746
has comment: http://stackoverflow.com/comment/39342892

http://stackoverflow.com/comment/39580435
type: AnswerComment
has text: What path have you set? Can you share some details of the same
type: Comment
comment on: http://stackoverflow.com/a/25379392
score: 0

http://stackoverflow.com/q/25284104
has comment: http://stackoverflow.com/comment/39404900
has answer: http://stackoverflow.com/a/25284448
tagged with: jython
type: UnansweredQuestion
has title: change size for BorderLayout in Java/Jython
tagged with: swing
has body: I am trying to create a GUI for a small command line program. I am doing it in Jython as I am more comfortable with Python than Java. A pear of my code looks like: self.f = JFrame("Demultiplex the data") self.f.setSize(900, 500) self.f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) #Create a Text Area self.txtArea = JPanel(GridLayout(15,0)) self.txtArea.setPreferredSize(Dimension(150, 150)) self.textAreaForSheet = JTextField(30) self.textAreaInputForFolder = JTextField(30) self.textAreaOutPutFolder= JTextField(30) self.txtArea.add(self.textAreaForSheet) self.txtArea.add(self.textAreaInputForFolder) self.txtArea.add(self.textAreaOutPutFolder) #Create Buttons self.buttonArea = JPanel(GridLayout(15,15)) self.buttonArea.setPreferredSize(Dimension(150, 150)) self.sampleSheetBtn = JButton("SampleSheet", actionPerformed=self.onClickSample) self.runOutPutFolder = JButton("RUN Folder",actionPerformed=self.onClickRun) self.DemultiplexOutPutFolder = JButton("Output Folder",actionPerformed=self.onClickOut) self.buttonArea.add(self.sampleSheetBtn) self.buttonArea.add(self.runOutPutFolder) self.buttonArea.add(self.DemultiplexOutPutFolder) #Create Check Boxes self.CheckBox = JPanel(GridLayout(15,15)) self.buttonArea.setPreferredSize(Dimension(150, 150)) self.Iter1 = JCheckBox("01_0M_NY", True,) self.Iter2 = JCheckBox("02_0M_N", True,) self.Iter3 = JCheckBox("03_1M_NY", True,) self.Iter4 = JCheckBox("04_1M_N", True,) self.CheckBox.add(self.Iter1) self.CheckBox.add(self.Iter2) self.CheckBox.add(self.Iter3) self.CheckBox.add(self.Iter4) #Create a Run button "Demultiplex" self.ExecutePanel = JPanel() self.console=JTextArea(10,80) self.RunBtn = JButton("Demultiplex",actionPerformed= self.performDemultiplex) self.ExecutePanel.add(self.RunBtn) self.ExecutePanel.add(self.console) #Add everything to JFrame self.f.add(self.txtArea, BorderLayout.CENTER) self.f.add(self.buttonArea, BorderLayout.WEST) self.f.add(self.CheckBox, BorderLayout.EAST) self.f.add(self.ExecutePanel, BorderLayout.SOUTH…
score: 0
tagged with: border-layout
tagged with: java
tagged with: user-interface
answer count: 1
linked to: http://stackoverflow.com/q/7229226
type: Question

http://stackoverflow.com/comment/39312253
score: 0
has text: @ccjmne I changed to \s as you suggested, it printed out ok but at the same time the same InputMismatchException is still displayed.
comment on: http://stackoverflow.com/q/25235475
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39518412
comment on: http://stackoverflow.com/a/25347125
type: Comment
has text: Two notices: 1. `StringBuilder` IS mutable, it stores the added content as characters, that's why its recomended for string concatenation. 2. What if the string doesn't contain `"&*("`? Then nothing gets added to the `sbuild`.
type: AnswerComment
score: 2

http://stackoverflow.com/a/26197220
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25352995
has body: the following method public static void display(int x[][]) { for (int row=0;row&lt;x.length;row++) { for (int column=0;column&lt;x[row].length;column++) { System.out.println(x[row][column]+"\t"); } } } is similar to the following method public static void display(int x[][]) { //x is an array with two dimensions, so its elements are arrays with one dimension for (int row=0;row&lt;x.length;row++) { //x.length returns the count of all stored arrays in the array x int[] rowArray_ = x[row];//x[row] is an array with one dimension for (int column=0;column&lt;rowArray_.length;column++) { System.out.println(rowArray_[column]+"\t"); } } } @Cole Riggle: in your code, you have: int secondarray[][]={{30,31,32,33},{43},{4,5,6}}; so secondarray is componed of three arrays which are: {30,31,32,33} {43} {4,5,6} so in your static method, you process on the arrays in the following order {30,31,32,33} {43} {4,5,6} I hope you will understand my explanation. If not, see multidimensional-arrays-lengths-in-java

http://stackoverflow.com/comment/39332724
comment on: http://stackoverflow.com/q/25246646
score: 0
has text: ok. I though you had a more complex expression and you wrote it this way to make it simple.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25273210
tagged with: java
possible better answer: http://stackoverflow.com/a/54402013
downvote count: 0
has comment: http://stackoverflow.com/comment/39382075
score: 19
favorite count: 0
has answer: http://stackoverflow.com/a/70646894
type: Question
has title: Why is a singleton class hard to test?
accepted answer: http://stackoverflow.com/a/25273286
has body: Effective Java Item 3 (Enforce the singleton property with a private constructor or an enum type) notes that: Making a class a singleton can make it difficult to test its clients, as it's impossible to substitute a mock implementation for a singleton unless it implements an interface that serves as its type. For testing purposes, why is it not sufficient to instantiate the one singleton instance and test its APIs? Isn't that what a client would be consuming? The quote seems to imply that testing the singleton would involve a "mock implementation," but why is that necessary? I've seen various "explanations" that are more or less rephrasings of the quote above. Can someone explain this further, preferably with a code example?
tagged with: singleton
has answer: http://stackoverflow.com/a/76366640
has answer: http://stackoverflow.com/a/25273286
has comment: http://stackoverflow.com/comment/39382078
has answer: http://stackoverflow.com/a/54402013
has comment: http://stackoverflow.com/comment/39382463
answer count: 4
has comment: http://stackoverflow.com/comment/39382653
type: AnsweredQuestion
upvote count: 19

http://stackoverflow.com/comment/39509107
type: QuestionComment
has text: I have post the exact question...
score: 0
comment on: http://stackoverflow.com/q/25341361
type: Comment

decode
tag name: decode
tags question: http://stackoverflow.com/q/25281839
type: Tag
tags question: http://stackoverflow.com/q/25304023

http://stackoverflow.com/comment/39554308
comment on: http://stackoverflow.com/a/25339411
type: Comment
score: 0
has text: Of course it mentions "audio interface" and "ASIO4ALL", without one of them, one would strive to get near-zero latency for monitoring MIDI input. That's what I'm talking about: http://johnrofrano.com/training/faq/how-do-i-remove-midi-keyboard-delay/
type: AnswerComment

build
tag name: build
tags question: http://stackoverflow.com/q/25322875
tags question: http://stackoverflow.com/q/25343278
tags question: http://stackoverflow.com/q/25353233
tags question: http://stackoverflow.com/q/25264355
type: Tag
tags question: http://stackoverflow.com/q/25302157
tags question: http://stackoverflow.com/q/25310004
tags question: http://stackoverflow.com/q/25372307
tags question: http://stackoverflow.com/q/25338362
tags question: http://stackoverflow.com/q/25309250
tags question: http://stackoverflow.com/q/25370810

http://stackoverflow.com/a/56734226
upvote count: 1
answers question: http://stackoverflow.com/q/25335495
score: 1
type: Answer
downvote count: 0
has body: You don't need retrolambda any more if you have already setup compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

http://stackoverflow.com/a/25355736
type: Answer
answers question: http://stackoverflow.com/q/25355711
has body: You've reversed the arguments here private double hourlyRate; public void setHourlyRate(double rateIn) { rateIn = hourlyRate; } Should be public void setHourlyRate(double rateIn) { this.hourlyRate = rateIn; }
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39488786
has text: Shouldn't use two Oracle driver JARs; just one. It should be ojdbc6.jar, because the "6" means "JDK6". Terrible code - you use the system password in an app? In plain text? Who closes this connection? Why aren't you using a JNDI connection pool, managed by your app server? Are you using Tomcat? The ojdbc6.jar should be in the Tomcat server /lib.
comment on: http://stackoverflow.com/q/25330493
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39550706
type: AnswerComment
has text: After reading the docs I see what you mean. Could you please provide a bare-bones example? just so i know what i'm doing and if im on the right track
comment on: http://stackoverflow.com/a/25364734
type: Comment
score: 0

http://stackoverflow.com/q/25379446
tagged with: casting
tagged with: decompiler
downvote count: 0
accepted answer: http://stackoverflow.com/a/25379502
tagged with: compilation
upvote count: 1
has answer: http://stackoverflow.com/a/25379497
has answer: http://stackoverflow.com/a/25379502
has title: Is this compilation or decompilation side effects?
has body: Were running a server . A guy got fired. He deleted source code. We must decompile....: I noticed several weird stuff: 1) The variable declerations are also in the middle of the program at random spots 2) No type safety of HashMaps e.g. HashMap&lt;Integer , Boolean&gt; s = new HashMap&lt;Integer , Boolean&gt;(); got turned into HashMap s = new HashMap(); the same thing happened to Lists and Collections generally. It also has some side effects that caused some exceptions ((Long) list.get(a_long).longValue()); The stuff added were the cast and the longValue call 3)I also noticed some trash coding Did these things happen because I decompiled the program , or did these things happen due to the compiler or stupidity of ex-developer?
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39580779
tagged with: java
tagged with: type-safety
possible better answer: http://stackoverflow.com/a/25379497
has comment: http://stackoverflow.com/comment/39578772
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39578485
answer count: 2

http://stackoverflow.com/q/25372312
tagged with: unit-testing
favorite count: 0
type: Question
has body: I have a GenericCreator, with the following method &lt;E extends Entity&gt; E create(E entity); I want to assert this method (where E = Foo) is only called once. I don't care if it's called with any other type parameter. The following assertion does not work for me: verify(genericCreator).create(any(Foo.class)); because in the following case: Foo foo = new Foo(); Bar bar = new Bar(); genericCreator.create(foo); genericCreator.create(bar); it throws org.mockito.exceptions.verification.TooManyActualInvocations: genericCreator.create(&lt;any&gt;); Wanted 1 time .... But was 2 times ... While in reality I don't care about the .create(bar) call and I don't want the test to fail because it is called. How can I achieve this?
has answer: http://stackoverflow.com/a/25372703
accepted answer: http://stackoverflow.com/a/25372703
tagged with: java
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39565504
has title: How can I make Mockito.verify ignore other type parameters?
tagged with: mockito
answer count: 1

http://stackoverflow.com/a/25275717
type: Answer
has body: Your class name should be "Entities.Users" and not "entities.User" in your mapping file. I would rather go with "Users" and specify package like &lt;hibernate-mapping package="Entities"&gt; But I highly doubt if this is causing the problem. Can you please provide the stacktrace of the error?
has comment: http://stackoverflow.com/comment/39394440
has comment: http://stackoverflow.com/comment/39386847
score: 0
has comment: http://stackoverflow.com/comment/39391086
answers question: http://stackoverflow.com/q/25275561

http://stackoverflow.com/a/25233867
has comment: http://stackoverflow.com/comment/39309251
answers question: http://stackoverflow.com/q/25233776
has body: In Chile, DST ends on September 7th at midnight. So the time jumps from 23.59 to 01:00 Thats why midnight doesnt 'exist'. As for solving it, you cant really. Anything that assumes that time exists is flawed. Ref: http://www.timeanddate.com/time/change/chile/santiago
upvote count: 3
score: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39309236

http://stackoverflow.com/comment/39388999
has text: Have you tried surrounding the path in quotes since there is a space between Start and Menu?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25277106
score: 0

http://stackoverflow.com/a/25352965
has comment: http://stackoverflow.com/comment/39528590
has comment: http://stackoverflow.com/comment/39528626
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25352888
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25352888
type: Answer
has body: Usually user data should be saved to a SQLite database, however in your case, since you're talking about a few variables, it'd be much easier for you to save these values in the application's SharedPreferences. For every value you'd like to save, add this line to your Chronometer's onChronometerTick() method: PreferenceManager.getDefaultSharedPreferences(this).edit().putInt("your_key", &lt;Your_value&gt;).commit(); This can later (whenever your application recovers from a crash, for example) be retrieved by: PreferenceManager.getDefaultSharedPreferences(this).getInt("your_key", &lt;Default_value&gt;); Regarding performance issues, if your Chronometer ticks once every second this should have no effect on your app's performances and is completely acceptable.

http://stackoverflow.com/comment/39352120
comment on: http://stackoverflow.com/a/25256618
type: Comment
has text: @LuiggiMendoza, is that replace all occurences of backslashes?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39372308
type: Comment
score: 1
type: QuestionComment
has text: This is not how a GUI-application works. You just start it and keep handling events that are dispatched to your listeners. So when actionperformed terminates nothing more happens beside your application waiting for the next event.
comment on: http://stackoverflow.com/q/25268040

http://stackoverflow.com/comment/39538852
has text: Please check question updates
comment on: http://stackoverflow.com/q/25341934
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25265430
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39408574
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25257119
has body: Actually, you get this exception either because you mapped this field as a date or ElasticSearch dynamically identified this field as a date (the first document you used to create the index had a date value for this field). You can't ignore this exception and index the other information as the document doesn't match the defined mapping. There are several cases : In fact, you don't have date values in this field : you can fix the mapping to what you really need. You have date values in this field, but it's not a valid date according to the elasticsearch date formats : you can add this format to the one used by default (using dynamic_date_formats) or define the specific format of this field. You have sometimes date values, sometimes string values : if it suits your need, you could set the mapping to string to prevent this exception from occuring. You won't get parsing exceptions as it won't get parsed as a date but it won't be possible to perform a range query on this field for example.

http://stackoverflow.com/comment/39364945
type: Comment
type: QuestionComment
score: 0
has text: Change `executeUpdate` to `executeQuery` I think?
comment on: http://stackoverflow.com/q/25264168

http://stackoverflow.com/q/25267086
has answer: http://stackoverflow.com/a/25267578
linked to: http://stackoverflow.com/q/7560721
favorite count: 0
type: Question
tagged with: static
answer count: 2
has body: I have two questions concerning objects and the use of static in Java. I found I could best explain my questions if I asked them with the same background: I have one main class in my program. First it initializes a lot of things and then it starts the run method which cycles through a while (true) loop. I also have a lot of other classes such as let's say a circle which I create during the initialization in my main class and save in a local variable along the lines of myCircle = new Circle(); . I have also made some classes of which all variables and methods are static. I've noticed that I don't have to create an object of such a class during initialization because everything in it is static. Whenever I need something from one of those classes, I can just call it like StaticClass.someMethod() or StaticClass.someVariable . This in contrast to the circle where I go myCircle.anotherMethod() . Had I made that method static I could have used Circle.anotherMethod() . Now my question is: Why create a new object and save it if I can just make everything in that class static (assuming that I'll only ever need ONE such object)? More importantly: One of my static classes has a ton of constants which are images that it reads from a file. Since I haven't made a constructor, I don't know when it is actually loading the images. There are several different occasions when I would call StaticClass.someImage and I'm wondering if it is now loading the images from a file multiple times. So my second question is: When does Java load all the variables of a static class which doesn't have a constructor? (in other words, when does it create that object?)
possible better answer: http://stackoverflow.com/a/25267456
has answer: http://stackoverflow.com/a/25267456
downvote count: 0
upvote count: 1
has title: Difference between creating object and keeping it static
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25267578
score: 1
tagged with: java

http://stackoverflow.com/q/25371387
favorite count: 0
type: Question
tagged with: junit4
tagged with: powermock
has body: I use JUnit4 with Mockito for Unit Testing, and now I'm trying to add PowerMock into my toolbox. And at once I'm facing a weird class loading behaviour of PowerMock. So, I use some code like that: @PrepareForTest(ClassToMock.class) public class MyTest { @Rule public PowerMockRule rule = new PowerMockRule(); @Test public void myTest() throws Exception { // some test code using ClassToMock MyHelper.staticMethod(param); // some other test code } } MyHelper is some class from another bundle, and staticMethod() is some method, which I don't need to be mocked. This method uses Google Gson and some my serializers (let's say - MySerializer class). And PowerMock throws me a javassist.NotFoundException for Google Gson and MySerializer. For example: Caused by: javassist.NotFoundException: com.google.gson.GsonBuilder at javassist.ClassPool.get(ClassPool.java:450) at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:220) I can add those classes to the classpath (to the Impored-Packages), but I don't want to. And why does PowerMock try to load classes, which are used inside some method, which supposed to be just a "black box", at the first place? Can anyone explain that, please? Also, I can get rid of loading Gson using @PowerMockIgnore("com.google.*") annotation, but it doesn't work for MySerializer. And it doesn't seem like a proper solution anyway. Thanks!
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27352621
has comment: http://stackoverflow.com/comment/43158870
has comment: http://stackoverflow.com/comment/39635006
score: 1
tagged with: mockito
answer count: 1
downvote count: 0
has title: Why does PowerMock try to load some classes, which are used in non-mocking class method?
upvote count: 1

http://stackoverflow.com/a/25316736
has comment: http://stackoverflow.com/comment/39465611
has comment: http://stackoverflow.com/comment/39465218
answers question: http://stackoverflow.com/q/25316695
has comment: http://stackoverflow.com/comment/39466594
score: 1
has comment: http://stackoverflow.com/comment/39462696
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39462746
type: Answer
has body: Just iterate over each message and print its contents. for (Message message : messages) { System.out.println(message.sender + " said: " + message.message); }
accepted answer of: http://stackoverflow.com/q/25316695

http://stackoverflow.com/q/25375408
has comment: http://stackoverflow.com/comment/39571259
has comment: http://stackoverflow.com/comment/39571248
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39571361
has title: Recursive call - getting stack overflow
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39582743
answer count: 1
has body: I am working on a project for school in Java. We are writing Hu's tree algorithm. I have written a recursive method to set the level of each node dependent upon the adjacency matrix. When I run the code I am getting a stack overflow error. My full code is below. I am having problems with the level() method. Please help package husalgo; import java.util.Arrays; import javax.swing.JOptionPane; public class HusAlgo { private static int numJobs; public static void main(String[] args) { input(); } public static void input() { int level = 0; int root = 0; numJobs = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter number of jobs: ")); int machines = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter number of machines: ")); int[] begin = new int[numJobs]; int[] end = new int[numJobs]; for (int i = 0; i &lt; numJobs - 1; i++) { begin[i] = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the begining arc for job " + (i + 1) + ": ")); end[i] = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter ending arc for job " + (i + 1) + ": ")); } int[][] adj = adjMatrix(begin, end, numJobs); level(adj, root, level); } public static int[][] adjMatrix(int[] begin, int[] end, int numJobs) { int[][] adj = new int[numJobs][numJobs]; for (int i = 0; i &lt; numJobs; i++) { for (int j = 0; j &lt; numJobs; j++) { adj[i][j] = 0; } } for (int i = 0; i &lt; numJobs; i++) { adj[begin[i]][end[i]] = 1; System.out.println(Arrays.toString(adj)); } return adj; } public static void level(int[][] adj, int root, int l) { int[] lev = new int[numJobs]; lev[0] = 0; for (int i = 0; i &lt; numJobs; i++) { if (adj[i][root] == 1) { lev[i] = l + 1; level(adj, i, l + 1); } } System.out.println(Arrays.toString(adj)); } }
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39571314
has comment: http://stackoverflow.com/comment/39584977
tagged with: recursion
has comment: http://stackoverflow.com/comment/39572145
has comment: http://stackoverflow.com/comment/39577891
has comment: http://stackoverflow.com/comment/39572194
accepted answer: http://stackoverflow.com/a/25385275
score: -1
has answer: http://stackoverflow.com/a/25385275

http://stackoverflow.com/a/25333424
has comment: http://stackoverflow.com/comment/39497104
score: 0
has body: Try this: (Client) sock.setKeepAlive(true);
answers question: http://stackoverflow.com/q/25328892
has comment: http://stackoverflow.com/comment/39498438
type: Answer
has comment: http://stackoverflow.com/comment/39593705

http://stackoverflow.com/comment/39488292
type: QuestionComment
comment on: http://stackoverflow.com/q/25330265
has text: see this: http://example.javamonday.com/Open-Source/Android/Timer/multitimer-android/com/cycleindex/multitimer/CountDownTimerWithPause.java.htm
type: Comment
score: 0

http://stackoverflow.com/comment/41906826
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25350724
has text: This is not a certificate issue, otherwise you could never get started. It seems to be that you're exceeding an upload limit imposed by the server somehow. All it can do when you exceed it is close the connection, which causes 'connection reset by peer'.

http://stackoverflow.com/q/25236817
type: Question
linked to: http://stackoverflow.com/q/4637215
accepted answer: http://stackoverflow.com/a/25240449
upvote count: 2
has comment: http://stackoverflow.com/comment/39319336
has comment: http://stackoverflow.com/comment/39319481
has comment: http://stackoverflow.com/comment/39319412
linked to: http://stackoverflow.com/q/13205251
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39319205
has answer: http://stackoverflow.com/a/25240449
tagged with: swing
has comment: http://stackoverflow.com/comment/39333770
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39319299
has body: I have xyline chart created using jfreechart inside netbeans swing. I have two files one is for getting values for x and y coordinates continuously and other is for display of them now I am creating the chart from constructor of the display file and it displays the chart using hard coded values but when I pass my incoming the chart is not updating accordingly. Please find below code for display file : public Display_Unit_Mod() { JPanel jPanel1 = createChartPanel(); } public JPanel createChartPanel() { String chartTitle = ""; String xAxisLabel = "x_value"; String yAxisLabel = "y_value"; XYDataset dataset = createDataset(); JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset); customizeChart(chart); return new ChartPanel(chart); } public XYDataset createDataset() { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series1 = new XYSeries(""); System.out.println(String.valueOf(test.x_value)); System.out.println(String.valueOf(test.y_value)); series1.add(test.x_value,test.y_value); -&gt;test is the object of other file and using it I am taking values from there //series1.add(7.0,8.0); //series1.add(3.0,4.0); -&gt; displays values and prints chart //series1.add(1.0,2.0); dataset.addSeries(series1); return dataset; } private void customizeChart(JFreeChart chart) { XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // sets paint color for each series renderer.setSeriesPaint(0, Color.RED); // sets thickness for series (using strokes) renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(3.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f)); // sets paint color for plot outlines plot.setOutlinePaint(Color.BLUE); plot.setOutlineStroke(new BasicStroke(2.0f)); // sets renderer for lines plot.setRenderer(renderer); // sets plot background plot.setBackgroundPaint(Color.DARK_GRAY); // sets paint color for the grid lines plot.setRangeGr…
has comment: http://stackoverflow.com/comment/39316098
has comment: http://stackoverflow.com/comment/39318643
has title: Want to update jfreechat xylinechart continuously
has comment: http://stackoverflow.com/comment/39319141
tagged with: java
has comment: http://stackoverflow.com/comment/39317947
has comment: http://stackoverflow.com/comment/39317900
linked to: http://stackoverflow.com/q/15707496
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/39321195
favorite count: 0

http://stackoverflow.com/comment/39435003
type: QuestionComment
comment on: http://stackoverflow.com/q/25301819
has text: What does it mean "it is not functioning properly"??
score: 0
type: Comment

http://stackoverflow.com/comment/39444723
score: 3
has text: [Just use Tooltips?](http://docs.oracle.com/javafx/2/ui_controls/tooltip.htm) If not, please edit your question and describe what you are asking and have tried more explicitly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25307080

http://stackoverflow.com/a/25239871
has comment: http://stackoverflow.com/comment/39322663
answers question: http://stackoverflow.com/q/25239720
has body: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button asc = (Button) findViewById(R.id.asc); Button desc = (Button) findViewById(R.id.desc); final ArrayList&lt;Location&gt; actorsList = new ArrayList&lt;Location&gt;(); Location loc = new Location(); loc.setName("1"); loc.setPrice("4000"); actorsList.add(loc); loc = new Location(); loc.setName("2"); loc.setPrice("8000"); actorsList.add(loc); loc = new Location(); loc.setName("3"); loc.setPrice("1000"); actorsList.add(loc); loc = new Location(); loc.setName("4"); loc.setPrice("16000"); actorsList.add(loc); asc.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Collections.sort(actorsList, new Comparator&lt;Location&gt;() { @Override public int compare(Location arg1, Location arg2) { Integer obj1 = new Integer(arg1.getPrice().replace(",","")); Integer obj2 = new Integer(arg2.getPrice().replace(",","")); return (Integer) (obj1).compareTo(obj2); } }); for (int i = 0; i &lt; actorsList.size(); i++) { System.out.println("monika 1233" + actorsList.get(i).getPrice()); } } }); } }
has comment: http://stackoverflow.com/comment/39320294
type: Answer
has comment: http://stackoverflow.com/comment/39319830
has comment: http://stackoverflow.com/comment/39320116
has comment: http://stackoverflow.com/comment/39320278
has comment: http://stackoverflow.com/comment/39320462
score: 1
accepted answer of: http://stackoverflow.com/q/25239720
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39322606
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39325629
score: 0
type: QuestionComment
has text: I'm seeing old notes on websites indicating a bug in some versions of unix related to files over 2Gb. How big is the file being downloaded?
comment on: http://stackoverflow.com/q/25242287
type: Comment

http://stackoverflow.com/a/25323905
has body: Turns out I compiled the program with a 1.8 version of the JDK and I was trying to execute it on a previous version of the JRE. I solved the problem by upgrading my JRE on the other computer. I did try to use the -target build parameter but it seemed not to work with BlueJ IDE (I tried to add this line : bluej.compiler.options=-source 1.8 -target 1.5 to the bluej.properties file). I'm sorry, the problem had nothing to do with Selenium whatsoever.
type: Answer
accepted answer of: http://stackoverflow.com/q/25323403
answers question: http://stackoverflow.com/q/25323403
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/39353969
has text: set up the PATH correctly. You should follow this link http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25257113
type: QuestionComment

ejb
tags question: http://stackoverflow.com/q/25282983
tags question: http://stackoverflow.com/q/25258969
tags question: http://stackoverflow.com/q/25382598
tags question: http://stackoverflow.com/q/25246022
type: Tag
tag name: ejb
tags question: http://stackoverflow.com/q/25332393
tags question: http://stackoverflow.com/q/25274688
tags question: http://stackoverflow.com/q/25241989
tags question: http://stackoverflow.com/q/25260490
tags question: http://stackoverflow.com/q/25301646

http://stackoverflow.com/a/25241030
answers question: http://stackoverflow.com/q/25239362
has comment: http://stackoverflow.com/comment/39322042
has body: You directly change java.util.Date.setTimeZone(TimeZone.getTimeZone("UTC"));? Your GregorianCalendar's timezone is CET and date's timezone is UTC. And you print it out. Change your GregorianCalendar instance with UTC timezone. //date.setTimeZone(TimeZone.getTimeZone("UTC")); &lt;- remove it. date.set(Calendar.HOUR_OF_DAY, 0); GregorianCalendar utcCAL = (GregorianCalendar) GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC")); utcCAL.setTimeInMillis(date.getTimeInMillis()); System.out.println(utcCAL.getTime().toGMTString() + " " + utcCAL.getTimeInMillis()); Output 25 Oct 2014 22:00:00 GMT 1414274400517 Update You can also use java.util.Date.UTC() function. //date.setTimeZone(TimeZone.getTimeZone("UTC")); date.set(Calendar.HOUR_OF_DAY, 0); Date utcDate = date.getTime(); utcDate.UTC(2014, 9, 1, 26, 1, 0); System.out.println(utcDate.toGMTString() + " " + date.getTimeInMillis());
has comment: http://stackoverflow.com/comment/39322118
type: Answer
has comment: http://stackoverflow.com/comment/39322636
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/102941214
type: Comment
has text: It’s actually not ignored, just the default spring naming strategy is applied on the given name attribute. Read @PhilWebb answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26546541

http://stackoverflow.com/a/25308498
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25308155
has comment: http://stackoverflow.com/comment/39447247
type: Answer
has body: A file name of "C:\Atlassian\bamboo-home\xml-data\build-dir\CMPT-CMPTP-JOB1\test.java" is valid on Windows but is invalid on Unix operating systems. You won't be able to create a (temp) file like that, either as specified as the absolute name/path or the file nor just relative to another folder. If your OS is Windows, you still can't use a full path (starting with drive specification like "C:") to be created as a child of another folder.
score: 1
accepted answer of: http://stackoverflow.com/q/25308155
type: AcceptedAnswer

http://stackoverflow.com/comment/39531570
score: 0
has text: Please try to format your question appropriately and use proper punctuation/grammar. Doing so will make your question a lot easier to read and understand.
comment on: http://stackoverflow.com/q/25354356
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25323388
tagged with: javascript
tagged with: spring
score: 0
tagged with: java
answer count: 1
has body: What would the reasons be for a link failing in a 400 error when being clicked. The link also works in the other following situations Clicked open in new tab Clicked open in new window Clicked open in incognito or private I've taken apart the requests, and when requesting each request path on its own, each URL appears to work. The click link is invoked by Javascript on the front-end and makes requests to Java Spring back-end to push data to a RDb. Could this be a header issue? I cannot release the links or the code for this unfortunately due to its confidential nature, but can provide any publicly available information for debugging.
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/25330188
has title: Link (with redirects) opens in incognito or when open in new tab, or new page is explicitly declared. Doesn't work when just clicked
type: UnansweredQuestion

http://stackoverflow.com/q/25365089
score: 0
answer count: 3
tagged with: java
tagged with: spring-hateoas
has comment: http://stackoverflow.com/comment/39551230
has answer: http://stackoverflow.com/a/25569051
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25368550
has body: I am trying to support XML responses for my Spring HATEOAS based application. JSON responses work fine as well as XML for a single resource. The problem starts with the list of the resources. Spring MVC controller cannot serialize the list built with help of ResourceAssemblerSupport derived class. The controller throws "org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation" for the curl command curl -k -i -H "Accept:application/xml" -H "Media-Type:application/xml" -X GET http://127.0.0.1:8080/admin/roles* My HATEOAS resource is a wrapper around entity class: @XmlRootElement @XmlSeeAlso(RoleModel.class) public class RoleResource extends ResourceSupport { public RoleModel role; } The controller is simple: @RequestMapping(method = RequestMethod.GET) public @ResponseBody HttpEntity&lt;List&lt;RoleResource&gt;&gt; getAllRoles() throws ObjectAccessException, ObjectNotFoundException { List&lt;RoleModel&gt; resp = rolesManagement.getRoles(); return new ResponseEntity&lt;List&lt;RoleResource&gt;&gt;(roleResourceAssembler.toResources(resp), HttpStatus.OK); } Resource assembler class: @Configuration public class RoleResourceAssembler extends ResourceAssemblerSupport&lt;RoleModel, RoleResource&gt; { public RoleResourceAssembler() { super(RolesRestController.class, RoleResource.class); } @Bean public RoleResourceAssembler roleResourceAssembler(){ return new RoleResourceAssembler(); } @Override public RoleResource toResource(RoleModel role) { RoleResource res = instantiateResource(role); res.role = role; try { res.add(linkTo(methodOn(RolesRestController.class).getRole(role.getRoleId())).withSelfRel()); } catch (ObjectAccessException | ObjectNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return res; } } When I avoid ResourceAssemblerSupport and build my resources manually like this: @XmlRootElement @XmlSeeAlso(RoleModel.class) public class RolesList { private List&lt;Resource&lt;RoleModel&gt;&gt; rol…
has title: Spring hateoas xml serialization for list of resources built with ResourceAssemblerSupport
tagged with: spring-mvc
tagged with: jaxb2
has answer: http://stackoverflow.com/a/28838201

http://stackoverflow.com/q/25258167
tagged with: java
tagged with: javafx
tagged with: bundle
has answer: http://stackoverflow.com/a/25265137
has title: ControlsFX 8.0.6 dialogs java.util.MissingResourceException
favorite count: 0
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: controlsfx
has body: I'm a new user of ControlsFX and I have an issue that I don't understand: My code: Dialogs.create() .owner(mainStage) .title("Information Dialog") .masthead("Test masthead") .message("Test message") .showInformation(); And I obtain an exception: Exception in thread "JavaFX Application Thread" java.util.MissingResourceException: Can't find bundle for base name impl.org.controlsfx.dialog.resources.oxygen.dialog-resources, locale fr_FR Does anybody have an idea why this happens? Thank you.
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/comment/39557225
type: AnswerComment
type: Comment
has text: What is a `Manifest` and what's its purpose? Couldn't it be simply replaced with a `.property` file?
comment on: http://stackoverflow.com/a/25365380
score: 0

http://stackoverflow.com/comment/115320123
comment on: http://stackoverflow.com/a/26963594
score: 4
type: AnswerComment
type: Comment
has text: So I know this is an old thread but just wanted to add comments for people like me who still end up visiting this thread. SortedDictionary.Keys.ToList() is **O(n)** operation. Meaning it would gather all the keys and return them. After getting the list of Key if we do a binary search then yes it would be **O(log n)** operation but we have already paid the upfront cost in getting all the keys. Hence, unfortunately, this is not really equivalent of Treemap floorEntry or ceilingEntry

http://stackoverflow.com/comment/39440110
comment on: http://stackoverflow.com/a/25300500
type: Comment
has text: org.springframework.orm.hibernate4.HibernateQueryException: could not resolve property: student_id
type: AnswerComment
score: 0

http://stackoverflow.com/a/25255876
has comment: http://stackoverflow.com/comment/39350502
answers question: http://stackoverflow.com/q/25255806
type: Answer
has comment: http://stackoverflow.com/comment/39351392
accepted answer of: http://stackoverflow.com/q/25255806
score: 0
has body: I don't know why you would call an InputStream 'writeIn', but the problem is that the client is reading the socket until end of stream, and the server is never closing the accepted socket, so end of stream never occurs.
type: AcceptedAnswer

http://stackoverflow.com/a/25366220
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25366121
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25366121
upvote count: 4
has body: panel.add(showTable(), "growx, wrap"); Note the comma.
type: AcceptedAnswer

http://stackoverflow.com/a/25234048
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39317271
answers question: http://stackoverflow.com/q/25233186
accepted answer of: http://stackoverflow.com/q/25233186
type: Answer
has comment: http://stackoverflow.com/comment/39313753
score: 1
has body: Showing the task tags did work in the past but it has been broken at some point. It is still not fixed, see this ticket for any progress on this feature.

http://stackoverflow.com/comment/39773247
has text: Again, don't. It is a cardinal requirement of third normal form that rows do not contain arrays. Reconsider, redesign.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25340013

http://stackoverflow.com/comment/39462931
has text: Design patterns are nothing but widely accepted best practices. Unless you have reasons to believe that either yourself or your circumstances are unique, it just plain common sense to learn how to things right and why so.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25315846

http://stackoverflow.com/comment/39566265
type: Comment
has text: Thank you starf for explaining. I couldnt figure out, what a shame :-) I reworked it as you suggested.
type: AnswerComment
comment on: http://stackoverflow.com/a/25372332
score: 0

http://stackoverflow.com/a/25247143
type: AcceptedAnswer
downvote count: 0
has body: In my program com.bsoft.conc is a package name where my class file for the compiled program will be stored.If I have to run that from home folder we have to specify java -classpath test\src com.bsoft.conc."class-file-name" This is because we need to tell the JVM where it has to look for class file. so , we have to specify navigation to the src using "test\src" and then class file location "com.bsoft.conc.class-file-name" If you have set environment variable in advanced settings then it will also be overriden if you specify classpath in cmd
answers question: http://stackoverflow.com/q/25237345
accepted answer of: http://stackoverflow.com/q/25237345
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/comment/39544285
has text: btnClick.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent redirect = new Intent(getActivity().getApplicationContext(), MobileRecharge.class); startActivity(redirect); } });
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25361345
score: 0

http://stackoverflow.com/q/25362956
has title: JSTL formatDate shows year + 1 in JSP
has answer: http://stackoverflow.com/a/25363449
tagged with: date
favorite count: 0
type: Question
tagged with: jstl
upvote count: 2
downvote count: 0
has body: I have a problem. I am using in jsp the following: &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt; &lt;fmt:formatDate type="date" pattern="dd.MM.YYYY" value="${booking.startDate}"/&gt; having date as : 2014-12-29 or represented as long 1419807600000, which is displayed as 29.12.2015, which is wrong. What I have found: formatDate uses internally Gregoriancalendar#getWeekYear() right after the following piece of code : if (field == CalendarBuilder.WEEK_YEAR) { if (calendar.isWeekDateSupported()) { value = calendar.getWeekYear(); }... which goes to this piece of code inside GregorianCalendar#getWeekYear() : if (year &gt; gregorianCutoverYear + 1) { int weekOfYear = internalGet(WEEK_OF_YEAR); if (internalGet(MONTH) == JANUARY) { if (weekOfYear &gt;= 52) { --year; } } else { if (weekOfYear == 1) { ++year; } } return year; } Obviosly, the problem is here : if (weekOfYear == 1) { ++year; } So, week of the year is 1, because 29.12.2014 actually is in the first week of the year 2015. I use German locale for this, which means that the first week of year is the first week with 4 or more days in the new year. Still, my format doesn't work properly. Any suggestions? Thanks a lot.
score: 2
type: AnsweredQuestion
tagged with: formatdatetime
accepted answer: http://stackoverflow.com/a/25363449
tagged with: java
answer count: 1

http://stackoverflow.com/q/25283239
has answer: http://stackoverflow.com/a/25291552
score: 1
favorite count: 0
has title: Result of Quaternion Multiplication not yielding expected Rotation of local coordinate system
tagged with: rotation
tagged with: 3d
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
has body: I'm getting unexpected results when multiplying two quaternions and applying the resulting rotation to my local right-handed coordinate system. (X pointing forward, Y to the right and Z downward). (See my Java SCCE below) So I am trying to first apply a Z rotation by 90 degrees (yaw) and then a rotation of 90 degrees around the local X axis (roll). I am trying to accomplish this by multiplying two quaternions representing these two rotations, creating a rotation Matrix from the result and applying it to the 3 unit vectors of my coordinate system but the results I am getting do not make sense. (i.e. they do not represent the coordinate system you should get from these two rotations.) I have tried changing the quaternion multiplication order which did not help (see code lines that were commented out in the main method of the SCCE). I have also tried creating the quaternion for the second rotation from global Y to simulate that it was created from the resulting local coordinate system after the first rotation. For reference I am also calculating the result by applying the two individual rotation matrices (which works as expected). What am I doing wrong? import java.text.DecimalFormat; import java.text.NumberFormat; public class Quaternion { public static final double NORMALIZATION_LOWER_TOLERANCE = 1 - 1e-4; public static final double NORMALIZATION_UPPER_TOLERANCE = 1 + 1e-4; private double w = 1.0; private double x = 0.0; private double y = 0.0; private double z = 0.0; public static void main(String[] args) { Vector3D xVect = new Vector3D(1,0,0); Vector3D yVect = new Vector3D(0,1,0); Vector3D zVect = new Vector3D(0,0,1); System.out.println("Initial Local Coordinate System: X:"+xVect+" / Y:"+yVect+ " / Z:"+zVect); Quaternion rotZ = new Quaternion(Math.PI/2, zVect); // Yaw +90 deg Quaternion rotY = new Quaternion(Math.PI/2, yVect); // Yaw +90 deg Quaternion rotX = new Quaternion(Math.PI/2, xVect); // Then roll +90 deg Matrix rotationMatrixZ = new Matrix(rotZ); Vector3D …
type: Question
tagged with: quaternions
tagged with: java

http://stackoverflow.com/a/25373661
has body: I was able to get it working by cleaning up the JSON object a bit. I think it's just a bad formatting error. First, the escape slashes, they need to be uniform or removed. I removed the ones escaping the double quotes, but left them in everywhere else. Then I removed the double quotes around the nested objects and arrays. "{...}" to {...} and "[...]" to [...] Seems to be all that was necessary. {"current":{"puzzle_path":"puzzles\/2\/CKqbKz5f\/41a0b30fdfdf6685dd50c6019391cc00.tmx","solved":false,"score":20,"difficulty":1,"level_id":2,"id":2,"fnkeys":1,"title":"Puzzle\n2","level":2,"solution_path":"puzzles\/2\/CKqbKz5f\/7b1886a261b0400768e75dea91948576.json","puzzlecolors":[0,0,0],"puzzle_site_id":2,"locked":false,"fnMoves":[]},"user":{"ID":1,"lifes":3,"google_id":"fdgsdfgfgfgsdgsdf","highscore":13,"last_sync":"2014-08-18\n22:12:12","personname":"Test\nTest","personphoto":"https:\/\/lh4.googleusercontent.com\/-5XfDNwK1PwI\/AAAAAAAAAAI\/AAAAAAAAPs8\/C0onA9lyKvY\/photo.jpg?sz=50"},"solved":[{"puzzle_id":1,"id":1,"user_id":1,"puzzle_tries":10}],"last_sync":"2014-08-18\n22:12:12"}
score: 2
accepted answer of: http://stackoverflow.com/q/25372260
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25372260
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39585884

http://stackoverflow.com/comment/39465794
comment on: http://stackoverflow.com/a/25317953
has text: Yes, that's it, thank you a lot! No need to post the 3 list design! Thank you very much!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25311674
score: 8
answers question: http://stackoverflow.com/q/25309350
type: AcceptedAnswer
has body: the Camel aggregator and filter patterns can be used for this scenario... use a filter to detect "end" messages and route them through an aggregator use a custom aggregation strategy to build up the single end message with a count use a custom completion predicate to trigger the completion message something like this... from("source1").to("direct:aggregateRoute"); from("source2").to("direct:aggregateRoute"); from("direct:aggregateRoute") .filter(header("isEndMessage").isEqualTo("true")) .aggregate(constant(true), new MyAggregationStrategy()) .completionPredicate(new MyCompletionStrategy()) .to("destination");
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25309350
upvote count: 8
type: Answer

http://stackoverflow.com/comment/39589738
type: Comment
has text: Regarding the title, you're right, I just realize now that it sounds strange. I meant without timezone conversion/shift. But everyone who reads through it will perfectly understand what I mean.
score: 0
comment on: http://stackoverflow.com/q/25384680
type: QuestionComment

http://stackoverflow.com/a/25236759
answers question: http://stackoverflow.com/q/25236665
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25236665
score: 2
downvote count: 0
type: Answer
has body: This package-level javadoc explains: http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/optimization/package-summary.html Basically, the entire org.apache.commons.math3.optimization.* tree is being reworked. The direct replacement class for CurveFitter is org.apache.commons.math3.fitting.AbstractCurveFitter. Why? You would need to trawl through the issue tracker and developer mailing lists to find that out.
upvote count: 2

http://stackoverflow.com/comment/39344128
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25252531
type: AnswerComment
has text: Yes! Thank you so much! I didn't know how to combine the arrays into one line but now it works!

http://stackoverflow.com/comment/39472700
comment on: http://stackoverflow.com/a/25321816
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59395/discussion-between-ker-p-pag-and-user3896367).
score: 0
type: AnswerComment

http://stackoverflow.com/q/25341014
answer count: 2
has body: I have a problem with returning generic collection from getter method. My class looks like this: public abstract class ContentGroup&lt;E extends Content&gt; extends Content { private List&lt;E&gt; childContents = new LinkedList&lt;E&gt;(); public List&lt;E&gt; getChildContents() { return childContents; } ... } public class Container extends ContentGroup { } When I call getChildContents() method it returns a list, but not a list of objects extending Content class so I have to explicitly cast returned value to Content: public void doit(Container contentGroup) { //Why does get method return Object instead of Content? Content content = (Content) contentGroup.getChildContents().get(0); ... } Edit I updated the code to reflect better the acctual implementation. As one of the answers suggests the problem was that Container did not define Type. Problem was solved with: public class Container extends ContentGroup&lt;Content&gt; { }
possible better answer: http://stackoverflow.com/a/25341147
has answer: http://stackoverflow.com/a/25341031
upvote count: 1
has comment: http://stackoverflow.com/comment/39508473
tagged with: java
accepted answer: http://stackoverflow.com/a/25341031
downvote count: 1
has answer: http://stackoverflow.com/a/25341147
tagged with: generics
tagged with: collections
has comment: http://stackoverflow.com/comment/39508440
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39508889
linked to: http://stackoverflow.com/q/2770321
has title: Return generic collection from getter
has comment: http://stackoverflow.com/comment/39508416
has comment: http://stackoverflow.com/comment/39508532
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25323252
score: 0
answers question: http://stackoverflow.com/q/25323194
has body: Its the type of the parameter. Java is a strongly typed language, it needs to know the type of every variable in the program. In this case, the variable must be of type Editable, or any child type or implementor of Editable. Since Editable is an interface, it will be an implementor. If it was a class, it would be an instance of it or a child type of it.
type: Answer

http://stackoverflow.com/a/25322710
has comment: http://stackoverflow.com/comment/39474521
downvote count: 9
answers question: http://stackoverflow.com/q/25322679
type: Answer
score: 19
has comment: http://stackoverflow.com/comment/39474430
upvote count: 28
has comment: http://stackoverflow.com/comment/39473838
has comment: http://stackoverflow.com/comment/39474536
has body: The difference between ++i and i++ is that ++i effectively increments the variable and 'returns' that new value. i++ on the other hand effectively creates a temp variable to hold the current value in i, then increments the variable 'returning' the temp variable's value. This is where the extra overhead is coming from. // i++ evaluates to something like this // Imagine though that somehow i was passed by reference int temp = i; i = i + 1; return temp; // ++i evaluates to i = i + 1; return i; In your case it appears that the increment won't be optimized by the JVM because you are using the result in an expression. The JVM can on the other hand optimize a loop like this. for( int i = 0; i &lt; Integer.MAX_VALUE; i++ ) {} This is because the result of i++ is never used. In a loop like this you should be able to use both ++i and i++ with the same performance as if you used ++i.

http://stackoverflow.com/q/25250643
score: 2
type: AnsweredQuestion
tagged with: while-loop
tagged with: if-statement
tagged with: java
has title: Data validation within data validation
accepted answer: http://stackoverflow.com/a/25250764
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39341076
has comment: http://stackoverflow.com/comment/39340868
has answer: http://stackoverflow.com/a/25250764
has body: I first want to validate that the user entered a value and to make sure to exit if 'cancel' was pushed. Then, I want to validate that the String releaseDateString is in the correct format at the same time as converting the String to java.sql.Date. The first validation is taking place but then the JOptionPane carries on repeating itself and does not even consider the try and catch following it. Here is my method boolean retry = false; java.sql.Date releaseDate = null; String releaseDateString = ""; String title = ""; while (!retry) { while(!retry){//field is validated to make sure a value was entered and to exit if cancel was pushed releaseDateString = JOptionPane.showInputDialog("Please input the release date of the movie (yyyy-mm-dd)"); qtd.stringValidation(releaseDateString); } try { //the date is validated to make sure it is in the correct format releaseDate = java.sql.Date.valueOf(releaseDateString); } catch (Exception e) { retry = false; JOptionPane.showMessageDialog(null, "Make sure you enter a date in the format of 'dd-mm-yyy'"); } } It links to this method public static boolean stringValidation(String attribute){ boolean retry = false; if (attribute == null){ System.exit(0); } else if (attribute.equals("")) //if the cancel button is selected or no value was entered into the { JOptionPane.showMessageDialog(null, "Make sure you enter a character into the textbox"); } else { retry = true; } return retry; }
upvote count: 2
tagged with: validation
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39340592

http://stackoverflow.com/comment/39342143
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25251443
type: Comment
has text: @user3929076 it is the location of the panel within the frame. For example, for the third panel, its bounds `x = 188`, but its `width = 94`. So you're painting outside the bounds of the panel. Also, note that coordinate (0,0) represents the upper left corner of the panel.

http://stackoverflow.com/q/25328454
score: 2
upvote count: 2
has body: There is a collection of 20 objects of a POJO class. I Want to write a method that return objects with distinct value. Now this is my Pogo class class Student { private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName( String firstName ) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName( String lastName ) { this.lastName = lastName; } } Now i want some method which returns unique last names values. I could not understand which logic i have to put in this.
tagged with: java
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25329063
has answer: http://stackoverflow.com/a/25328641
has answer: http://stackoverflow.com/a/25328994
type: Question
linked to: http://stackoverflow.com/q/27581
has title: How to compare value of array of objects?
tagged with: arrays
tagged with: pojo
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25328536
answer count: 6
linked to: http://stackoverflow.com/q/5477511
has answer: http://stackoverflow.com/a/25328562
has answer: http://stackoverflow.com/a/25345960
tagged with: oop

http://stackoverflow.com/q/25231154
has comment: http://stackoverflow.com/comment/39302920
has title: How to get the key of a TreeMap by it's index?
tagged with: java
accepted answer: http://stackoverflow.com/a/25231212
has comment: http://stackoverflow.com/comment/39302935
has comment: http://stackoverflow.com/comment/39302989
has comment: http://stackoverflow.com/comment/39302933
answer count: 2
downvote count: 0
has body: So I'm trying to get the key of a TreeMap by an int index. Here's my code: TreeMap&lt;String, Integer&gt; map = new TreeMap&lt;String, Integer&gt;(Collections.reverseOrder()); map.put("hi", 1); map.put("hi2", 5); System.out.println("Key: " + (String) map.keySet().toArray()[0] + "\nValue: " + map.get(0)); But when I execute this, I get the error: java.lang.Integer cannot be cast to java.lang.String So I'm trying to get the key: "hi2"
has comment: http://stackoverflow.com/comment/39302936
has answer: http://stackoverflow.com/a/25231235
possible better answer: http://stackoverflow.com/a/25231235
has answer: http://stackoverflow.com/a/25231212
has comment: http://stackoverflow.com/comment/39303072
linked to: http://stackoverflow.com/q/857420
has comment: http://stackoverflow.com/comment/39303057
favorite count: 0
type: Question
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/comment/124530009
type: AnswerComment
comment on: http://stackoverflow.com/a/25232720
has text: @OrangeDog `application.properties` > `application.yml`, meaning yml loads first and properties later. Any `application-profile.properties` will be added even later. This is a nice way to override values in `application.properties` IMO.
type: Comment
score: 4

http://stackoverflow.com/a/29970021
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25310759
has body: Answer in regards to bounty, but it seems to be the same problem from the original post Looking at the link you provided, all the examples return SalesType, and not a List<SalesType>. You can't expect a SalesType to be converted to a List<SalesType>. If you are returning SalesType from your resource class, the exception provided. Even from the link for the original post, the JSON is coming in as JSON object. List doesn't map to a JSON object ({}), but instead a JSON array ([]). If you want a list of SalesType, then simply return a list from the resource. Below is a complete example import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.Test; class SalesType { public String test; } public class MOXyTest extends JerseyTest { @Path("test") public static class TestResource { @GET @Produces(MediaType.APPLICATION_JSON) public Response getSalesTypeList() { List<SalesType> list = new ArrayList<>(); SalesType sales = new SalesType(); sales.test = "test"; list.add(sales); list.add(sales); return Response.ok( new GenericEntity<List<SalesType>>(list){}).build(); } } @Override public Application configure() { return new ResourceConfig(TestResource.class); } @Test public void testGetSalesTypeList() { List<SalesType> list = target("test").request() .get(new GenericType<List<SalesType>>(){}); for (SalesType sales: list) { System.out.println(sales.test); } } } These are the two dependencies I used (making use of Jersey Test Framework) org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-inmemory ${jersey2.version} test org.glassfish.jersey.media jersey-media-moxy ${jersey2.version} Your problem can easily be reproduced by return the sales in the resource class from the example above. The current code above works, but just to see the error, if you replace the GenericEntity (which is a wrapper for generic types being returned in a Respo…
upvote count: 2
type: Answer

http://stackoverflow.com/q/25298724
favorite count: 0
tagged with: recursion
has body: I'm trying to see what's going on in a chain of recursive calls. Is there some way to set a breakpoint in the middle of a single line to see when the function is being called from each statement? Example: fibonacci(term - 2) + (want to put a breakpoint here) fibonacci(term - 1)
tagged with: breakpoints
has comment: http://stackoverflow.com/comment/39429500
tagged with: java
has answer: http://stackoverflow.com/a/25298897
has title: Set breakpoint in the middle of a line Java with Eclipse
type: Question
has comment: http://stackoverflow.com/comment/39429700
tagged with: debugging
answer count: 2
has answer: http://stackoverflow.com/a/25298849
score: 2
upvote count: 2
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/a/25312338
answers question: http://stackoverflow.com/q/25308625
score: 0
has body: I think this should put you on the right path, if you change canvas.DrawText("Mytext",left,top+height-10,rectanglePaint); to int spacing = 10; String text = "Mytext"; canvas.DrawText(text,left,top+height-10,rectanglePaint); left += rectanglePaint.measureText(text) + spacing; You might need to change the value of spacing to get the spacing you want between the text and the next square.
has comment: http://stackoverflow.com/comment/39455652
has comment: http://stackoverflow.com/comment/39455523
has comment: http://stackoverflow.com/comment/39457606
type: Answer
has comment: http://stackoverflow.com/comment/39457209

http://stackoverflow.com/comment/39414826
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25290888
has text: And I would not throw a RuntimeException in this case
type: Comment

http://stackoverflow.com/comment/39419019
comment on: http://stackoverflow.com/q/25290935
type: Comment
type: QuestionComment
has text: Thanks for the update! AFAIK there is nothing out of the box that supports what you are looking for
score: 0

http://stackoverflow.com/a/25317013
answers question: http://stackoverflow.com/q/25316683
score: 0
has body: Alternatively, frequency = x * y * Math.pow(roomSize, -2)
type: Answer

http://stackoverflow.com/comment/39483226
type: Comment
type: QuestionComment
has text: Ah alright, I see what you mean. No worries, thanks for all the help everyone :)
score: 0
comment on: http://stackoverflow.com/q/25327553

http://stackoverflow.com/a/25245159
has body: If you don't use maven, you may want to download the sources (git checkout), compile them into a jar, and add the jar in your project's build path. Read: How to make a jar
answers question: http://stackoverflow.com/q/25244722
type: Answer
accepted answer of: http://stackoverflow.com/q/25244722
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/106297899
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/54737451
has text: then what is the solution if we only want to save date using Hibernate 5.x

http://stackoverflow.com/comment/39463107
type: Comment
comment on: http://stackoverflow.com/a/25316710
score: 0
type: AnswerComment
has text: Maybe the best is in `View.onSizeChanged()` or ` View.onLayout` : you calculate only when size changes and layout your clock drawables, and not every time the clock has to be drawn

http://stackoverflow.com/a/25266406
has body: Your testDate string does not match the format given to SimpleDateFormat's constructor. Try: SimpleDateFormat setDateFormet = new SimpleDateFormat("yyyyMMddhhmmss");
answers question: http://stackoverflow.com/q/25266320
upvote count: 2
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/25333337
has comment: http://stackoverflow.com/comment/39494489
has body: We have an java enterprise application that is supposed to run on cluster of servers. The application consists of different WARs hosted by some web containers running on these servers. Now we have a lot of different configurations for this application, to name a few: Relational DB host/port, credentials and so forth Non Relational DB configurations - stuff like mongo, redis and so forth Internal lookup configurations (how to obtain a web service in SOA architecture, stuff like that). Logging related configuration, log4j.xml Connection pooling configurations Maybe in future some internal settings for smart load balancing, maybe Multi Tenancy support Add to this multiple environments, test/staging/production/development and what not, having different hosts/ports for all aforementioned examples and we and up with a dozen of configuration files. As I see it, all these things are not something related directly to the business layer of the application, but rather can be considered "generic" for all applications, at least in the java enterprise world. So I'm wondering whether exists some solution for dealing with configuration management of this kind??? Basically I'm looking for the following abilities: Start my war on any of my servers in cluster with a host/port of this configuration server. The war will "register" itself and "download" all the needed configurations. Of course it will have adapters to apply this configuration. This way, all my N wars in different JVMs in cluster start (they're all share-nothing architecture, so I consider them as independent pieces of deployment) Now, if I want to change some setting, like, setting the log level of some logger to DEBUG, I go to the management console UI of this configuration server and apply the change. Since this management center knows about all the wars (as they were registered), it should notify them about the setting change. I want to be able to change settings for one specific WAR or cluster wide. If one of the web…
has title: Configuration management server for java enterprice application
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39495302
has comment: http://stackoverflow.com/comment/58313331
favorite count: 0
type: Question
tagged with: jakarta-ee
tagged with: configuration
tagged with: java
has comment: http://stackoverflow.com/comment/58311969

http://stackoverflow.com/comment/39372957
comment on: http://stackoverflow.com/a/25268385
type: AnswerComment
has text: Thanks for the answer but what is HotSpot VM and how it is different from JVM ?
type: Comment
score: 0

http://stackoverflow.com/a/25265376
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/39367628
has comment: http://stackoverflow.com/comment/39367346
accepted answer of: http://stackoverflow.com/q/25259852
has comment: http://stackoverflow.com/comment/39368283
answers question: http://stackoverflow.com/q/25259852
has body: This page of Java Community Process Maintenance Review for J2SETM 1.5.0 Beta 1 says that they added that key for solving a problem for Numpad-5 key when it is pressed and numlock is off New Keycode for Numpad-5 On X-Windows, X-events are produced when the numpad-5 key is pressed even when the numlock key is off. Previously, there was no Java java.awt.event.KeyEvent generated in this situation. A corresponding keycode has been added: java.awt.event.KeyEvent.VK_BEGIN. The bug report associated with this change is 4850137.
type: Answer
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39368134

http://stackoverflow.com/comment/39405269
score: 3
has text: `toString()` is not overriden for Process class, so you will get `java.lang.UNIXProcess@727896` (default implementation is className@hashCode). What output are you expecting?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25286047

http://stackoverflow.com/q/25348438
has answer: http://stackoverflow.com/a/25363787
type: Question
has comment: http://stackoverflow.com/comment/39526723
score: 0
has title: LibGDX Scene2D: Applying Actions to Actors in separate class
answer count: 1
type: AnsweredQuestion
has body: I'm having trouble getting a MoveToAction to work on an Actor (menuBackground), when the Actor is in a separate class. I have attached relevant code below- which doesn't make the Actor move at all. I have had success in apply other actions to the root stage in the MainMenuScreen class, and to a different Actor (Button) in the MainMenuScreen class, but have had no success applying actions to Actors in a separate class. I've tried putting the MoveToAction in the act(float delta) method within the MenuBackground class, but that didn't work either. Neither did assigning the MoveToAction to the menuBackground from within the MainMenuScreen class. Note that I am making a call to super.act(delta); within my MenuBackground class. I would ultimately like to put the code for the MoveToAction within the Actor MenuBackground class, to make things neat and tidy. Cheers. Class containing stage: public class MainMenuScreen implements Screen { private Stage stage; public MainMenuScreen() { stage = new Stage(new FitViewport(800, 480)); Gdx.input.setInputProcessor(stage); menuBackground = new MenuBackground(); MoveToAction moveToAction = new MoveToAction(); moveToAction.setPosition(242f, 276f); moveToAction.setDuration(10f); menuBackground.addAction(moveToAction); stage.addActor(menuBackground); @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); } ... } Actor Class: public class MenuBackground extends Actor { private Texture menuBackgroundTexture; private float actorX; private float actorY; public MenuBackground() { menuBackgroundTexture = new Texture(Gdx.files.internal("data/menuTitleTexture.png")); actorX = 242f; actorY = 350f; setBounds(actorX,actorY,316,128); } @Override public void draw(Batch batch, float alpha) { batch.draw(menuBackgroundTexture,actorX,actorY); } @Override public void act(float delta) { super.act(delta); } ... }
tagged with: libgdx
tagged with: scene2d
tagged with: java
has comment: http://stackoverflow.com/comment/39545468
accepted answer: http://stackoverflow.com/a/25363787

moxy
tag name: moxy
tags question: http://stackoverflow.com/q/25314172
tags question: http://stackoverflow.com/q/25291759
tags question: http://stackoverflow.com/q/25289613
tags question: http://stackoverflow.com/q/25238355
type: Tag
tags question: http://stackoverflow.com/q/25310759

http://stackoverflow.com/comment/39580049
has text: I've forked the test app (https://github.com/pillingworthz/requstFactoryVSRPC) and added some more RF timings. In prod mode, RF server side starts at 300ms, after JVM has been warmed up (after >50 requests) it then takes 15-20ms. Still slower than RPCs 46ms that drops to 1 to 2ms. Client side RF takes 70ms to deserialise the response. Haven't got figures for RPC deserialisation but whole RPC request/response takes about 15ms. This was all in Firefox20. Chrome and IE10 were about 4x faster!
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25325801

http://stackoverflow.com/q/25239109
type: AnsweredQuestion
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25239167
tagged with: java
has title: Is there analog Collections.singleton() / Collections.singletonList() / Collections.singletonMap() to obtain mutable collection?
has answer: http://stackoverflow.com/a/25239765
possible better answer: http://stackoverflow.com/a/25239765
tagged with: collections
favorite count: 0
type: Question
has body: I know if I have element and I want to get List/Set/Map with this element I can invoke : Collections.singleton() / Collections.singletonList() / Collections.singletonMap() At this case I get immutable collection(I cannot add/delete element to collection). Is there analog to obtain mutable collection?
upvote count: 26
has answer: http://stackoverflow.com/a/25239167
score: 26
tagged with: word-wrap

http://stackoverflow.com/comment/80922205
type: Comment
comment on: http://stackoverflow.com/q/25278808
type: QuestionComment
has text: do you solve your prolem? I have some problem.
score: 0

http://stackoverflow.com/a/25343369
has comment: http://stackoverflow.com/comment/39600214
has comment: http://stackoverflow.com/comment/39557531
has comment: http://stackoverflow.com/comment/39552090
has body: Not answering the entire question, but it should be pointed out that using ThreadLocal is exactly the wrong thing to use if you want to ensure visibility of updated values in all threads. Consider the following code: class Test { private static final ThreadLocal&lt;Integer&gt; value = new ThreadLocal&lt;&gt;(); public static void main(String[] args) throws InterruptedException { System.out.println("From main Thread, value is " + value.get()); value.set(42); System.out.println("Value has been changed"); Thread t = new Thread() { public void run() { System.out.println("From other Thread, value is " + value.get()); } }; t.start(); t.join(); System.out.println("From main Thread, value is " + value.get()); } } This will output the following: From main Thread, value is null Value has been changed From other Thread, value is null From main Thread, value is 42 i.e. the other thread doesn't see the updated value. This is because changes to the value of a ThreadLocal is, by definition, localized to the thread which changes it. My personal preference would be to use AtomicReference, since this avoids the risk of forgetting to synchronize externally; it also allows things like atomic compare-and-set, which you don't get with a volatile variable. However, this may not be a requirement for your particular application.
answers question: http://stackoverflow.com/q/25333768
type: Answer
score: 0

http://stackoverflow.com/comment/39508668
type: AnswerComment
comment on: http://stackoverflow.com/a/25341051
has text: You cannot access a non static members of a class in main method,but in order to access them you create an instance of the class.Does this mean that we are converting a class into a static one? But Java says that you cannot have a static class. It is really confusing me. Please help.
type: Comment
score: 0

http://stackoverflow.com/comment/39417208
type: Comment
has text: Fixed the issue by changing the plugins version. sonar-surefire-plugin-2.1, sonar-squid-java-plugin-2.1, sonar-jacoco-plugin-2.1, sonar-checkstyle-plugin-2.1, sonar-build-stability-plugin-1.2, sonar-pmd-plugin-2.1, sonar-findbugs-plugin-2.1, sonar-java-plugin-2.1. With these versions, sonar automatically runs jacoco and created report.
type: AnswerComment
comment on: http://stackoverflow.com/a/25260410
score: 0

http://stackoverflow.com/q/25381511
has title: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException
has body: I am building an object-based program in java. It should calculate the salary and deduct some taxes. Taxes are to be checked using JCheckBox. The problem is when I click a checkbox, it shows the ff error: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:538) at WageCalcDriver.itemStateChanged(WageCalcDriver.java:140) at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2050) at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.java:2353) at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonModel.java:455) at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:272) at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:289) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6527) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6292) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4883) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4705) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent(Component.java:4705) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue…
tagged with: jcreator
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: string
has answer: http://stackoverflow.com/a/25381724
score: 0
has answer: http://stackoverflow.com/a/25381631
tagged with: exception
tagged with: java

http://stackoverflow.com/comment/39382785
type: QuestionComment
has text: alan fahmidam chimikhayd.monteha logcat stack trace ro tozih bedid
score: 0
comment on: http://stackoverflow.com/q/25272803
type: Comment

http://stackoverflow.com/q/25231769
has comment: http://stackoverflow.com/comment/39304217
has comment: http://stackoverflow.com/comment/39307356
has answer: http://stackoverflow.com/a/25231793
tagged with: algorithm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39304432
has comment: http://stackoverflow.com/comment/39746626
has body: I had this piece of code: while((line=br.readLine())!=null) { String Words[]= line.split(" "); outputLine = SomeAlgorithm(Words); output.write(outputLine); } As you can see in the above code, for every line in the input file I'm reading one line, running some algorithm on it which modifies that line read basically, and then writes the output line to some file. There are 9k lines in the file, and the entire program took 3 minutes on my machine. I thought, okay, I'm doing 2 I/Os for every (line) run of the algorithm. So I'm doing around 18k I/Os. Why not collect all the lines first into an ArrayList , then loop through the list and run the algorithm on each line? Also collect each output into one string variable, and then write out all the output once at the end of the program. That way, I'd have total 2 big I/Os for the entire program (18k small File I/Os to 2 big File I/Os). I thought this would be faster, so I wrote this: List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); while((line=br.readLine())!=null) { lines.add(line); // collect all lines first } for (String line : lines){ String Words[] = line.split(" "); bigOutput+=SomeAlgorithm(Words); // collect all output } output.write(bigOutput); But, this thing took 7 minutes !!! So, why is looping through ArrayList slower than reading a file line by line? Note : Collecting all lines by readLine() and writing the bigOutput are each taking only a few seconds. There is no change made to SomeAlgorithm() either. So, definitely, I think the culprit is for (String line: lines) Update: As mentioned in the various comments below, the problem was not with ArrayList traversal , it was with the way the output was accumulated using += . Shifting to StringBuilder() did give a faster-than-original result.
has answer: http://stackoverflow.com/a/25231799
tagged with: arraylist
answer count: 2
linked to: http://stackoverflow.com/q/22241841
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39304255
has comment: http://stackoverflow.com/comment/39304254
has comment: http://stackoverflow.com/comment/39304214
has title: Why is Java List traversal slower than file readline?
has comment: http://stackoverflow.com/comment/39310119
favorite count: 0
has comment: http://stackoverflow.com/comment/39304233
score: 9
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/39743187

http://stackoverflow.com/q/25295917
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25298277
answer count: 3
upvote count: 2
tagged with: java
has body: I have a provider that outputs something like this http://myUrl.com/test1 <Domain name="myUrl.search.com" /> en This is the description Help ProductTitle 2012-04-06T21:44:11Z I'm trying to create an xsd to leverage jaxb, but I'm not sure how to handle the Property attribute appearing several times but not inside a list, so a sequence won't work. Any ideas?
has title: XSD declaration of a complex type with repeating attribute outside a list
downvote count: 0
tagged with: jaxb
possible better answer: http://stackoverflow.com/a/25298649
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25301070
has answer: http://stackoverflow.com/a/25298649
accepted answer: http://stackoverflow.com/a/25301070

http://stackoverflow.com/comment/39374222
type: Comment
type: AnswerComment
has text: Btw, laune, can you explain the regex used here? It would be of great help to me (and others as well I suspect). Thank you.
comment on: http://stackoverflow.com/a/25231563
score: 0

http://stackoverflow.com/q/25300446
tagged with: mule-el
tagged with: mule
tagged with: mule-studio
score: 2
has body: I have a base64Binary encoded file(eg:pdf,img,doc). In Mule I'm setting this encoded data as an outBoundAttachment to eventually send it as attachments using SMTP. How to decode or apply decoding transformer only to the outbound attachment and send it in smtp. &lt;set-attachment attachmentName="xml.pdf" value="#[flowVars['pdf']]" contentType="application/pdf" doc:name="Attachment"/&gt; &lt;base64-decoder-transformer /&gt; &lt;string-to-byte-array-transformer /&gt; &lt;smtp:outbound-endpoint host="smtp.gmail.com" user="${username}" password="${pwd}" connector-ref="smtpConnector" to="${toAddress}" from="${fromAddress}" mimeType="text/html" subject="This is sample from mule" responseTimeout="10000" doc:name="SMTP"&gt; &lt;email:object-to-mime-transformer useOutboundAttachments="true"/&gt; &lt;/smtp:outbound-endpoint&gt; Currently I'm getting: 'Failed to transform from "base64" to "org.mule.transformer.types.SimpleDataType"' 'Bad Base64 Input character at 0:60(decimal)'
upvote count: 2
type: AnsweredQuestion
tagged with: mule-component
downvote count: 0
tagged with: java
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25303834
accepted answer: http://stackoverflow.com/a/25303834
has title: How to apply <base64-encoder-transformer/> on message.OutboundAttachment in Mule

http://stackoverflow.com/comment/39591627
score: 0
type: Comment
has text: @Jeshurun [a] You should add the `Android` tag to such a Question. [b] Joda-Time does work in Android, though I understand you may not be at liberty to add it. But I'd rather lose the left half of my keyboard than do without Joda-Time!
type: AnswerComment
comment on: http://stackoverflow.com/a/25378050

http://stackoverflow.com/q/25266560
has comment: http://stackoverflow.com/comment/39370282
has comment: http://stackoverflow.com/comment/39369977
has comment: http://stackoverflow.com/comment/39371805
has comment: http://stackoverflow.com/comment/39370931
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39369613
has comment: http://stackoverflow.com/comment/39370024
has answer: http://stackoverflow.com/a/25269779
tagged with: spring
has body: I am developing sample Spring MVC application i want to return JSON string by requesting to spring mvc controller but when i make request via url it shows me 404 error i am following tutorial from very famous website ,My URL to which i make request IS localhost:8080/SpringAngularProject/rest/kfc/brands/kfc1 here is my code below : 0-- Console Picture : Aug 12, 2014 7:31:19 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/SpringAngularProject/rest/kfc/brands/sdsd] in DispatcherServlet with name 'mvc-dispatcher' 1- Its my Controller Class package com.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/kfc/brands") public class HelloWorldController { @RequestMapping(value = "{name}", method = RequestMethod.GET) public @ResponseBody Shop getShopInJSON(@PathVariable String name) { Shop shop = new Shop(); shop.setName(name); shop.setStaffName(new String[] { "staff1", "staff2" }); return shop; } } 2-- My web.xml file <?xml version="1.0" encoding="UTF-8"?> AngularSpring index.html mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher /rest contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener 3-- My Spring cfg file : <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframew…
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39371544
has comment: http://stackoverflow.com/comment/39370104
score: 3
has comment: http://stackoverflow.com/comment/39370243
has comment: http://stackoverflow.com/comment/39370353
upvote count: 3
tagged with: java
downvote count: 0
answer count: 1
has title: Spring MVC request mapping not found 404 page not found
has comment: http://stackoverflow.com/comment/39370486
has comment: http://stackoverflow.com/comment/39369898
has comment: http://stackoverflow.com/comment/39370715
favorite count: 0
has comment: http://stackoverflow.com/comment/39370234
has comment: http://stackoverflow.com/comment/39369497
has comment: http://stackoverflow.com/comment/39370621
type: Question

http://stackoverflow.com/comment/39485134
has text: I may go that approach as I prefer to not have to know the count ahead of time. I would pay admission to see you and alfasin duke it out though.
comment on: http://stackoverflow.com/a/25324574
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25235552
has comment: http://stackoverflow.com/comment/39425297
accepted answer: http://stackoverflow.com/a/25386826
has comment: http://stackoverflow.com/comment/39312154
has answer: http://stackoverflow.com/a/25446193
tagged with: java
has comment: http://stackoverflow.com/comment/39633083
tagged with: regex
has answer: http://stackoverflow.com/a/25353944
has title: Regular Expression for partial match length - String similarity
has answer: http://stackoverflow.com/a/25236149
tagged with: pattern-matching
type: Question
possible better answer: http://stackoverflow.com/a/25296938
has comment: http://stackoverflow.com/comment/39493653
has comment: http://stackoverflow.com/comment/39516472
has comment: http://stackoverflow.com/comment/39314500
downvote count: 0
has answer: http://stackoverflow.com/a/25296725
has answer: http://stackoverflow.com/a/25386826
answer count: 7
linked to: http://stackoverflow.com/q/14387631
has comment: http://stackoverflow.com/comment/39425252
has answer: http://stackoverflow.com/a/25354332
tagged with: string
has body: Say I have the string "Torcellite" and another string "Tor" - the similarity length of these two strings is 3 since both of them begin with "Tor". Now another string "christmas" and "mas" would have a similarity of 0 since they do not begin with the same set of characters. In both cases, the second string is a suffix of the first string. A clearer example: Length of string: 1 to 10^5 String: abaabc Suffixes: abaabc, baabc, aabc, abc, bc, c Similarity: abaabc, none, a, ab, none, none Similarity Length: 6, 0, 1, 2, 0, 0 Answer: 6+0+1+2+0+0 = 9 I have an inefficient logic to find these partial suffixes matches using regex. Algorithm: Find all the substrings of the given string. Make a pattern from the substrings of the suffixes. for(int i=1; i&lt;substrings[i].length; i++) { Pattern p = Pattern.compile("^"+substrings[i].substring(0, i)); Matcher m = p.find(string); //the given string for which similarities need to be calculated if(m.find()) similaryLengths += i; } The complexity for this becomes roughly O(n^2) since I need to run through the string for suffixes and then the substrings for patterns. I've thought of using grouping in the pattern to find the groups but I'm unsure what the regex would look like. What I have in mind is for the very first substring is: ((((((a)b)a)a)b)c) and then find the longest group match. Is there a more efficient algorithm that can achieve his?
favorite count: 0
has answer: http://stackoverflow.com/a/25296938
score: 14
upvote count: 14
type: AnsweredQuestion

http://stackoverflow.com/comment/39500599
has text: @laksys so is there any way that I can remove the restriction? Or is it not possible?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25328867
score: 0

plaintext
tag name: plaintext
tags question: http://stackoverflow.com/q/25261659
type: Tag

http://stackoverflow.com/q/25268370
has comment: http://stackoverflow.com/comment/39372977
has comment: http://stackoverflow.com/comment/39376130
has answer: http://stackoverflow.com/a/25268979
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39373032
has comment: http://stackoverflow.com/comment/39372910
has title: Computing integer powers with a recursive divide-and-conquer algorithm
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25268552
linked to: http://stackoverflow.com/q/1657834
has answer: http://stackoverflow.com/a/25269772
has comment: http://stackoverflow.com/comment/39373051
has comment: http://stackoverflow.com/comment/39372896
has answer: http://stackoverflow.com/a/25268567
tagged with: recursion
has body: I have implemented a recursive function to find m^n (m raised to the power n). Now I want to implement the same function but by dividing the problem into two equal parts, like m^n = m^(n/2) * m^(n/2) = ... (for even n like, m^2, m^4, m^6). With the implementation below, if I give m = 2 and n = 4, my output is 4 while it should be 16. public class Recursion { public static void main(String[] args) { System.out.println(pow(2, 4)); } public static long pow(long m,long n) { if (n &gt; 0) return m * pow(m, ((n/2) - 1) * pow(m, ((n/2) - 1))); else return 1; } }
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/25268639
has comment: http://stackoverflow.com/comment/39373329
has comment: http://stackoverflow.com/comment/39373136
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39373511

http://stackoverflow.com/comment/39400571
score: 0
comment on: http://stackoverflow.com/q/25282738
has text: @Illidanek...this error Ive got (Unfortunately Project has stopped)
type: Comment
type: QuestionComment

pojo
tags question: http://stackoverflow.com/q/25328454
type: Tag
tag name: pojo
tags question: http://stackoverflow.com/q/25364095
tags question: http://stackoverflow.com/q/25258046
tags question: http://stackoverflow.com/q/25236523
tags question: http://stackoverflow.com/q/25361341

http://stackoverflow.com/comment/96098349
type: Comment
has text: @Purefan you can get the certificate from the metadata the identity provider shares. You probably can get it from a certain endpoint like : https://idp.hostname/saml2/idp/metadata.php , ask the admin of the IPS you are using. Just drop it in an empty file between the BEGIN / END CERTIFICATE tags
type: AnswerComment
comment on: http://stackoverflow.com/a/25384924
score: 1

http://stackoverflow.com/q/25324739
tagged with: java
answer count: 1
tagged with: mysql
has comment: http://stackoverflow.com/comment/39477430
has comment: http://stackoverflow.com/comment/39477408
has comment: http://stackoverflow.com/comment/39477377
has title: Ensure that SQL is properly escaped when writing SQL scripts for a migration
favorite count: 0
has comment: http://stackoverflow.com/comment/39477478
type: Question
has comment: http://stackoverflow.com/comment/39478280
downvote count: 4
has comment: http://stackoverflow.com/comment/39480012
accepted answer: http://stackoverflow.com/a/25325920
has answer: http://stackoverflow.com/a/25325920
score: -3
upvote count: 1
has comment: http://stackoverflow.com/comment/39479215
has comment: http://stackoverflow.com/comment/39479443
has comment: http://stackoverflow.com/comment/39478168
has comment: http://stackoverflow.com/comment/39477804
tagged with: escaping
type: AnsweredQuestion
has body: We're currently trying to migrate data from one database to another. This migration is not exactly straightforward, so it cannot be done by simply executing some update statements. We therefore need to read the source data with a program and then generate an update SQL script to a file which will insert the converted data into the target database. This file is later run by an administrator against the target database. Normally one would use prepared statements for this and not care about escaping at all but in this case we actually want to generate SQL that is going to be printed into a file and executed manually at a later time. The reason for this is that no software may be installed in the target environment. So because we are not directly sending SQL to our target database, in our case prepared statements are of no help. Do you know of a way to generate the result SQL after performing the database migration with a tool in-memory which ensures that everything is escaped correctly in the generated SQL files?
tagged with: sql

http://stackoverflow.com/q/25275596
tagged with: log4j
has body: My Spring ApplicationContext file is being loaded twice. This is using a standard maven webapp structure, with one web.xml. There is only one context file, and only one servlet defined. There is NO context-loader-listener. I have attempted the following to fix the issue Standard Naming Conventions ('test-servlet.xml') Defining a ContextLoaderListener with a different Context file - without any bean definitions Component Scan Manual Bean definitions Singleton getInstance type methods ("public static Test getInstance()") and private Constructor The Web.XML test org.springframework.web.servlet.DispatcherServlet 1 contextConfigLocation /WEB-INF/beans.test.xml The beans file <mvc:annotation-driven /> <bean id="testController" class="Test" /> The Java Class public class Test { private static Logger logger = Logger.getLogger(Test.class); public Test() { logger.debug("IN INIT"); } } All of this results in the following lines 2014-08-12 15:56:32,427 - INFO : [beans.factory.xml.XmlBeanDefinitionReader-loadBeanDefinitions] - Loading XML bean definitions from ServletContext resource [/WEB-INF/beans.test.xml] 2014-08-12 15:56:32,427 - INFO : [beans.factory.xml.XmlBeanDefinitionReader-loadBeanDefinitions] - Loading XML bean definitions from ServletContext resource [/WEB-INF/beans.test.xml] 2014-08-12 15:56:33,015 - DEBUG: [Test-<init>] - IN INIT 2014-08-12 15:56:33,015 - DEBUG: [Test-<init>] - IN INIT So far....Nothing has seemed to work. Edit: The app uses Log4j (version 1.2.17) with a log4j.xml file under /src/main/resources, with the following structure <?xml version="1.0" encoding="UTF-8"?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <level value="INFO" /> <appender-ref ref="console" /> <level value="DEBUG" /> <appender-ref ref="console" /> <level value="ERROR" /> <appender-ref ref="console" /> </log4j:configuration>
answer count: 1
downvote count: 0
upvote count: 1
has title: Spring ApplicationContext beans loaded twice
favorite count: 0
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25275641
has answer: http://stackoverflow.com/a/25275641
score: 1
tagged with: java

http://stackoverflow.com/a/25279954
has comment: http://stackoverflow.com/comment/39440698
has comment: http://stackoverflow.com/comment/39529534
has comment: http://stackoverflow.com/comment/39438997
has comment: http://stackoverflow.com/comment/39443466
has comment: http://stackoverflow.com/comment/39443339
has comment: http://stackoverflow.com/comment/39544642
has comment: http://stackoverflow.com/comment/39446340
has comment: http://stackoverflow.com/comment/39991172
answers question: http://stackoverflow.com/q/25279727
has body: You could... Use JXTable from SwingLabs, SwingX library which has functionality which could do this...this would be my preferred solution if you can use 3rd party libraries... You could... Use Nimbus look and feel which does this...but this precludes you from using other look and feels (like the system look and feel) You could... Create your own series of custom TableCellRenderers which color their background based on the current row...this is tedious as EVERY cell renderer you might need, needs to be able to perform this operation... You could... Override the prepareCellRenderer method of the JTable and forcefully set the background of the cell renderer yourself, based on the row...I'm not a fan of this solution, as it's forcing a design choice onto the renderer which might not fit it's requirements (overriding values the cell renderer might want) and locks you into a particular implementation of the table... You could... Create a JViewport which was capable of talking with the JTable and rendered the candy stripping underneath the table, but the table and renderers would need to be transparent...I've done this, it's...complicated...but allowed me to continue the candy stripping the full length of the view port (beyond the renderable area of the table)... Updated with JViewport example This is an example of a concept I implemented a while ago for a project (it is actually managed by an interface so I could include JList and JTextArea as well, but that's another question)... Basically, it makes the JViewport, which appears below the JTable, responsible for rendering the actual candy stripping. But "why?" you ask...because it doesn't affect the table or cell renderer. The only requirement that this makes is that both the table and cell renderers are transparent (unless they have to be otherwise). This means, you don't need to put candy stripping logic in your renderers, this means you don't need to override prepareRenderer of every table you create and mangle the req…
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39991753
accepted answer of: http://stackoverflow.com/q/25279727
has comment: http://stackoverflow.com/comment/39494371
has comment: http://stackoverflow.com/comment/39544807
has comment: http://stackoverflow.com/comment/39991023
score: 3
has comment: http://stackoverflow.com/comment/39445064
has comment: http://stackoverflow.com/comment/39482823
has comment: http://stackoverflow.com/comment/39445472
has comment: http://stackoverflow.com/comment/39991083
upvote count: 3
has comment: http://stackoverflow.com/comment/39438017
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39437972
has comment: http://stackoverflow.com/comment/39442439
has comment: http://stackoverflow.com/comment/39445458

http://stackoverflow.com/comment/39311525
has text: Regardless of that, you're making a severe mistake concatenating the data into a StringBuilder and saving it as a String. First, you aren't even doing that correctly, as you're ignoring the read count when constructing each String. Secondly, *String is not a container for binary data.* You should copy each entry to a ByteArrayOutputStream and return a HashMap<String, byte[]>.
score: 2
comment on: http://stackoverflow.com/q/25235229
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25234561
has comment: http://stackoverflow.com/comment/39310236
has comment: http://stackoverflow.com/comment/39310342
has comment: http://stackoverflow.com/comment/39310568
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39312934
has comment: http://stackoverflow.com/comment/39310527
has comment: http://stackoverflow.com/comment/39312862
has comment: http://stackoverflow.com/comment/39310533
accepted answer of: http://stackoverflow.com/q/25234379
type: Answer
has body: I tried this piece of code and works: Object[][] data = { { "hello", "world" }, { "bye", "world" } }; //convert Object[][] to List&lt;Object[]&gt; List&lt;Object[]&gt; dlist = new ArrayList&lt;&gt;(Arrays.asList(data) ); for (Object[] o : dlist) { System.out.println(Arrays.deepToString(o)); } //convert List&lt;Object[]&gt; to Object[][] Object[][] data2 = dlist.toArray(new Object[0][]); System.out.println(Arrays.deepToString(data2)); Also, Java language doesn't work with commands, except if you refer to the command line to compile your files, but that's outside the Java programming language.
answers question: http://stackoverflow.com/q/25234379

http://stackoverflow.com/comment/40035090
type: AnswerComment
has text: @Betlista built-in? how to find it? I use Eclipse Juno or Kepler - not the oldest ones, and haven't seen it.
comment on: http://stackoverflow.com/a/25307826
score: 0
type: Comment

http://stackoverflow.com/comment/39568216
type: QuestionComment
comment on: http://stackoverflow.com/q/25373037
score: 0
has text: @KickButtowski I modified my question because your comment showed me an error in my question. Please have another read and let me know if that clears up the confusion.
type: Comment

http://stackoverflow.com/a/25239494
type: Answer
accepted answer of: http://stackoverflow.com/q/25239315
score: 0
answers question: http://stackoverflow.com/q/25239315
type: AcceptedAnswer
has body: No There isn't any priority. You have set android:layout_centerInParent="true" to text01 & there isn't any alignment to any child view of relative layout. When you are not assigning any alignment to child view of relative layout than there are overlapped.(and added to stack from bottom to top) Check out updated view which add views in relative layout from top to bottom <TextView android:id="@+id/text01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Relative_layout1 (2)" android:textColor="#ff0000ff" android:textSize="19dp" /> <TextView android:id="@+id/text02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/text01" android:layout_toRightOf="@id/text01" android:background="#ffff0000" android:text="Mosquito" android:textColor="#ff00ff00" android:textSize="15dp" /> <TextView android:id="@+id/text03" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Linear_layout2 (3)" />

http://stackoverflow.com/comment/129125876
has text: @Ruzihm spaces is the only thing it doesn't work with. If you know you are going from Java to JS then you just handle that one special case yourself.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25298843

http://stackoverflow.com/q/25358976
downvote count: 0
has answer: http://stackoverflow.com/a/26117040
favorite count: 0
type: Question
tagged with: effect
answer count: 2
tagged with: libgdx
type: UnansweredQuestion
tagged with: android
has body: I have a problem with the use of particle effect of LIBGDX with 2 or more emitters. After using ParticleEditor to create my .p file, I use it in my code BUT...when I use only 1 emitter it's fine but with more than 1, not fine ! :( Here is my error code in java console : Exception in thread "LWJGL Application" java.lang.RuntimeException: Error parsing emitter: - Delay - at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:910) at com.badlogic.gdx.graphics.g2d.ParticleEmitter.&lt;init&gt;(ParticleEmitter.java:95) at com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitters(ParticleEffect.java:154) at com.badlogic.gdx.graphics.g2d.ParticleEffect.load(ParticleEffect.java:138) at com.fasgame.fishtrip.android.screens.GameScreen.show(GameScreen.java:313) at com.badlogic.gdx.Game.setScreen(Game.java:61) at com.fasgame.fishtrip.android.screens.MainMenuScreen.render(MainMenuScreen.java:71) at com.badlogic.gdx.Game.render(Game.java:46) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:206) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: java.lang.NumberFormatException: For input string: "- Count -" at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at sun.misc.FloatingDecimal.parseFloat(Unknown Source) at java.lang.Float.parseFloat(Unknown Source) at com.badlogic.gdx.graphics.g2d.ParticleEmitter.readFloat(ParticleEmitter.java:929) at com.badlogic.gdx.graphics.g2d.ParticleEmitter$RangedNumericValue.load(ParticleEmitter.java:1062) at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:866) ... 9 more And here is my particle effect .p file : Blanc - Delay - active: false - Duration - lowMin: 3000.0 lowMax: 3000.0 - Count - min: 0 max: 200 - Emission - lowMin: 0.0 lowMax: 0.0 highMin: 250.0 highMax: 250.0 relative: false scalingCount: 1 scaling0: 1.0 timelineCount: 1 timeline0: 0.0 - Life - lowMin: 500.0 lowMax: 500.0 highMin: 500.0 highMax: 500.…
has answer: http://stackoverflow.com/a/47490193
score: 3
tagged with: particles
has title: LIBGDX "parsing error emitter" with 2 or more emitters
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/39356043
score: 0
type: AnswerComment
has text: About autoboxing http://stackoverflow.com/questions/1073919/how-to-convert-int-into-listinteger-in-java
comment on: http://stackoverflow.com/a/25258618
type: Comment

http://stackoverflow.com/a/25388993
upvote count: 3
downvote count: 0
has body: Once you have a raw (RFC822) email string you can use the java MimeMessage library to parse it and then read the headers. I found a couple by searching for java MimeMessage example. You can use the MimeMessage(Session, InputStream) constructor, once you have a MimeMessage you can just call things like getFrom() or getHeader(String headerName) on it. While not exactly what you're trying to do, the Gmail API java guide for sending email is somewhat relevant in that it shows how to deal with MimeMessage libraries, etc: https://developers.google.com/gmail/api/guides/sending
answers question: http://stackoverflow.com/q/25383062
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39642937
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39625330
accepted answer of: http://stackoverflow.com/q/25383062

http://stackoverflow.com/q/25381299
score: 1
tagged with: java
tagged with: hibernate
tagged with: date
has body: I have exported the sql from oracle db, which has this line: to_timestamp('23-APR-09 06.11.52.000000000 PM','DD-MON-RR HH.MI.SS.FF AM') I have class called Test which has an instance called date of type TimeStamp. Like: @Entity class Test { TimeStamp date } when I try to run these codes: session.createSQLQuery("insert into Test (date) values(to_timestamp('23-APR-09 06.11.52.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'))").executeUpdate() I get an exception like: org.hibernate.exception.DataException: could not execute native bulk manipulation query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:219) at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1300) at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:365) Caused by: java.sql.SQLException: data exception: invalid datetime format: java.text.ParseException: Unparseable date: "23-APR-09 06.11.52.000000000 PM" at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:210) ... 6 more Caused by: org.hsqldb.HsqlException: data exception: invalid datetime format: java.text.ParseException: Unparseable date: "23-APR-09 06.11.52.000000000 PM" ... 7 more where I'm making the mistake?
tagged with: hsqldb
favorite count: 0
type: Question
has title: Unparseable date when running hibernate against hsqldb
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25386720

http://stackoverflow.com/q/25309190
has answer: http://stackoverflow.com/a/25309965
type: Question
tagged with: spring
has comment: http://stackoverflow.com/comment/39448785
has title: Why my aspect doesn't work?
has comment: http://stackoverflow.com/comment/39448995
tagged with: spring-aop
type: AnsweredQuestion
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39448600
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39449193
accepted answer: http://stackoverflow.com/a/25309965
favorite count: 0
has body: I want to print "Hell yeah" in console after @ValidPassword annotation appears. This is how I did. Annotation: public @interface ValidPassword { } Aspect: import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @Aspect public class ValidPasswordAspect { @Before("@annotation(ru.tenet.smsc.annotation.ValidPassword)") public void myAdvice(){ System.out.println("Hell yeah"); } } xml: <context:annotation-config /> <context:component-scan base-package="ru.tenet.smsc" /> <mvc:resources mapping="/resources/**" location="/resources/" /> <context:component-scan base-package="ru.tenet.smsc" /> <mvc:annotation-driven /> <tx:annotation-driven /> <task:annotation-driven /> org.springframework.security.core.context.SecurityContextHolder setStrategyName MODE_INHERITABLETHREADLOCAL /WEB-INF/db/hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration false org.hibernate.dialect.OracleDialect true UTF-8 UTF-8 /WEB-INF/tiles.xml Usage: @RequestMapping(value = "/sms/single", method = RequestMethod.GET) @ValidPassword public String singleSMSPage(Map<String, Object> map, @ModelAttribute("singleSMSForm") SingleSMSForm singleSMSForm) { map.put("title", "Отправка одного сообщения"); return "singleSMS"; } But no "Hell Yeah" in console. Why?

http://stackoverflow.com/comment/39309335
type: Comment
has text: Ok, I see it is also just used to receive the Location, not to keep the GPS alive :) I recently discarded fused location in favor of relying only on GPS and monitoring when the locations are of decent quality (device has firs-fix of satelites). Just seems simpler to me as it is contained within a single Service, so, a single class and update of the manifest and I am good to go :p http://stackoverflow.com/questions/19365035/location-servise-gps-force-closed/19366773#19366773 SO unfortunately I have no good code to show for fused locations
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25233505

http://stackoverflow.com/comment/39568129
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25353250
has text: Given that line counting begins in the first import, I've replaced Integer with Long in lines 11, 31, 34 and 57 and still got the message "Repetition between answers detected. Quiting."; am I doing this correctly? Where exactly should I replace Integer with Long?

http://stackoverflow.com/comment/39553592
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25366441
has text: Primitive types (like `int`) will never be null.
type: QuestionComment

http://stackoverflow.com/comment/39352046
has text: So far I have a total of 1633 lines of code in this program, it's my first real project since I started programming. I'm starting to get better but I obviously still need a bit of work
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25256725

http://stackoverflow.com/q/25379351
tagged with: hadoop
linked to: http://stackoverflow.com/q/19943766
type: UnansweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39582473
favorite count: 0
has body: On my Ubuntu x32, Java x32, Hadoop 2.5.0 I execute: hduser@master:~$ hdfs dfs -ls / 14/08/19 08:51:21 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Found 3 items drwxr-xr-x - hduser supergroup 0 2014-08-19 08:37 /data drwxr-xr-x - hduser supergroup 0 2014-08-19 08:37 /export drwxrwx--- - hduser supergroup 0 2014-08-19 08:32 /tmp Can someone tell me how to fix the warning? Java version: hduser@master:~$ java -d64 -version Error: This Java instance does not support a 64-bit JVM. Please install the desired version. hduser@master:~$ java -d32 -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode) Ubuntu version: hduser@master:~$ uname -a Linux master 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:02:19 UTC 2014 i686 i686 i686 GNU/Linux Hadoop version hduser@master:~$ hadoop version Hadoop 2.5.0 Subversion http://svn.apache.org/repos/asf/hadoop/common -r 1616291 Compiled by jenkins on 2014-08-06T17:31Z Compiled with protoc 2.5.0 From source with checksum 423dcd5a752eddd8e45ead6fd5ff9a24 This command was run using /home/hduser/hadoop-2.5.0/share/hadoop/common/hadoop-common-2.5.0.jar EDIT: .bashrc export SQOOP_HOME=/home/hduser/sqoop export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") export PATH=$PATH:$SQOOP_HOME/bin export HADOOP_COMMON_HOME=/home/hduser/hadoop export HADOOP_MAPRED_HOME=/home/hduser/hadoop export HADOOP_HOME=/home/hduser/hadoop export PATH=$PATH:$HADOOP_HOME/bin export PIG_HOME=/home/hduser/pig export PATH=$PATH:$PIG_HOME/bin export HBASE_HOME=/home/hduser/hbase export HIVE_HOME=/home/hduser/hive export PATH=$PATH:$HIVE_HOME/bin
score: 3
has comment: http://stackoverflow.com/comment/39584410
has title: Java complains about Hadoop native library
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25379392

http://stackoverflow.com/comment/39402681
has text: @Orion - *Design principles says prefer second style* **once you know the relation (if any) between classes** :)
comment on: http://stackoverflow.com/q/25284601
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39397426
comment on: http://stackoverflow.com/a/25281704
score: 0
has text: I dont want to using boxing and unboxing due to the performance costs associated with boxing and unboxing. Do you know if the reflection will have a big performance impact on the code?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39403858
type: AnswerComment
comment on: http://stackoverflow.com/a/25282414
type: Comment
has text: Yes you addressed it by saying that memory and time are needed when instantiating stateless objects. I knew that.
score: 0

http://stackoverflow.com/a/25297511
type: Answer
has comment: http://stackoverflow.com/comment/39427562
answers question: http://stackoverflow.com/q/25297412
downvote count: 0
upvote count: 1
has body: Here's what it does (Collections.sort calls Arrays.sort which calls Arrays.mergeSort) : private static void mergeSort(Object[] src, Object[] dest, int low, int high, int off, Comparator c) { int length = high - low; // Insertion sort on smallest arrays if (length &lt; INSERTIONSORT_THRESHOLD) { for (int i=low; i&lt;high; i++) for (int j=i; j&gt;low &amp;&amp; c.compare(dest[j-1], dest[j])&gt;0; j--) swap(dest, j, j-1); return; } // Recursively sort halves of dest into src int destLow = low; int destHigh = high; low += off; high += off; int mid = (low + high) &gt;&gt;&gt; 1; mergeSort(dest, src, low, mid, -off, c); mergeSort(dest, src, mid, high, -off, c); // If list is already sorted, just copy from src to dest. This is an // optimization that results in faster sorts for nearly ordered lists. if (c.compare(src[mid-1], src[mid]) &lt;= 0) { System.arraycopy(src, low, dest, destLow, length); return; } // Merge sorted halves (now in src) into dest for(int i = destLow, p = low, q = mid; i &lt; destHigh; i++) { if (q &gt;= high || p &lt; mid &amp;&amp; c.compare(src[p], src[q]) &lt;= 0) dest[i] = src[p++]; else dest[i] = src[q++]; } }
score: 1

http://stackoverflow.com/comment/39951837
comment on: http://stackoverflow.com/q/25301904
type: QuestionComment
has text: Have you tried to use FFmpeg through [JavaCV](https://github.com/bytedeco/javacv)? AFAIK, it's not "slow", but please elaborate on the specific issue so I can provide an answer, thank you.
type: Comment
score: 0

http://stackoverflow.com/comment/39598828
comment on: http://stackoverflow.com/q/25383812
type: Comment
type: QuestionComment
score: 0
has text: Thanks for understanding, I will take this into account next time.

http://stackoverflow.com/comment/39302989
comment on: http://stackoverflow.com/q/25231154
has text: Well if your key has type String you cannot do map.get(0). And of course, since the value is of type int you cannot cast it to String. You are interverting the types of your map.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39357228
type: Comment
type: QuestionComment
has text: so ImageSpan is inside pasted buffer, try to get it via Spanned.getSpans and try to see its Drawable (ImageSpan.getDrawable method)
comment on: http://stackoverflow.com/q/25240548
score: 0

http://stackoverflow.com/q/25241319
has title: Java 7 (acting as client) SSL handshake failure with keystore and truststore that worked in Java 6
type: AnsweredQuestion
tagged with: keystore
has body: I'm doing a JBoss AS 5.1 to 7.4, and Java 6 to 7 migration, and get a handshake failure. The keystore and truststore are the ones we have been using successfully for ages with Java 6. I've written some tests to narrow the problem down, it's definitely not JBoss but rather Java 7. With SSL logging turned on, I get this: 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) %% Invalidated: [Session-2, SSL_RSA_WITH_RC4_128_SHA] 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, SEND TLSv1 ALERT: fatal, description = certificate_unknown 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, WRITE: TLSv1 Alert, length = 2 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, called closeSocket() 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, called close() 17:44:30,042 INFO [stdout] (http-/192.168.147.20:8080-120) http-/192.168.147.20:8080-120, called closeInternal(true) There are some threads touching upon this (or a similar) problem, where people are suggesting to recreate certs or truststores with different params. I'd rather not go down this route, since I've recently without success tried to create more such keystores and truststores for different accounts of the same webservice. Since we have been using these old (keystore and truststore) in production with Java 6, I'd like to keep them if at all possible. It appears the problem may be caused by Java 7 being more tight regarding the checking of truststore certificate chain? Is it possible to set some flags to relax the checking, make it behave like J…
linked to: http://stackoverflow.com/q/23775155
tagged with: java
has comment: http://stackoverflow.com/comment/39349312
answer count: 1
downvote count: 1
tagged with: ssl
upvote count: 15
favorite count: 0
has answer: http://stackoverflow.com/a/25244372
type: Question
tagged with: handshake
tagged with: truststore
has comment: http://stackoverflow.com/comment/39349370
score: 14
accepted answer: http://stackoverflow.com/a/25244372

http://stackoverflow.com/q/25244652
tagged with: graphics
type: UnansweredQuestion
has body: So I'm working on a sidescroller game in Java, and I just started working on the animations for the player. Everything was working okay up until this point. Here's the error message I'm getting: Exception in thread "Thread-2" java.lang.NullPointerException at com.blp.frisky.entity.Player.render(Player.java:58) at com.blp.frisky.Controller.render(Controller.java:23) at com.blp.frisky.gfx.Renderer.renderForeground(Renderer.java:41) at com.blp.frisky.Game.render(Game.java:123) at com.blp.frisky.Game.run(Game.java:154) at java.lang.Thread.run(Unknown Source) I noticed that the one thing all of the error locations have in common is rendering Graphics. Here's the first location that the error message is pointing to: @Override public void render(Graphics g) { //make player exist if(!moving){ if(direction == Direction.RIGHT){ //facing right **g.drawImage(tex.playerStandingRight, (int) x, (int) y, null);** //draw still player if not moving while facing right }else if(direction == Direction.LEFT){ //facing left g.drawImage(tex.playerStandingLeft, (int) x, (int) y, null); ////draw still player if not moving while facing left } }else{ if(direction == Direction.RIGHT){ //facing right animeRight.drawAnimation(g, x, y); //draw the animation right if moving }else if(direction == Direction.LEFT){ //facing right animeLeft.drawAnimation(g, x, y); //draw animation left if moving } } } What's interesting about this is that if I comment out the portion marked by asterisks above, my the game will run. Only, naturally, it won't show the texture with the player just standing and facing right. If I move though, the animations seem work fine. This leads me to believe that the problem stems from this method. I'd be happy to show more code if necessary. I've been stumped for a day or two now, and help would be greatly appreciated. :)
tagged with: 2d-games
has comment: http://stackoverflow.com/comment/39329017
has comment: http://stackoverflow.com/comment/39329113
has comment: http://stackoverflow.com/comment/39331067
score: 0
tagged with: nullpointerexception
answer count: 0
has comment: http://stackoverflow.com/comment/39345259
has comment: http://stackoverflow.com/comment/39330959
tagged with: rendering
tagged with: java
has title: Rendering Graphics Somehow Producing NullPointerException
type: Question

http://stackoverflow.com/q/25305957
has title: Can't Update The Android Developer Toolkit (ADT) TO Version 23
type: AnsweredQuestion
score: 1
answer count: 1
linked to: http://stackoverflow.com/q/24437564
has body: I am Facing a problem when Opening the Eclipse IDE For developing Android Apps . this Dialog Appears When Eclipse Starting I see a lot of questions here but that didn't works with my Problem i tried to do what this articles Error Message : This Android SDK requires Android Developer Toolkit version 22.6.1 or above when i follow the steps and did everything this error appear to me Error Msg : Cannot complete the install because of a conflicting dependency. Software being installed: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240) Software currently installed: Android Developer Tools 22.0.1.v201305230001--685705 (com.android.ide.eclipse.adt.package.product 22.0.1.v201305230001--685705) Only one of the following can be installed at once: Android Development Toolkit 23.0.3.1327240 (com.android.ide.eclipse.adt 23.0.3.1327240) Android Development Toolkit 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt 22.6.3.v201404151837-1123206) Cannot satisfy dependency: From: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240) To: com.android.ide.eclipse.adt [23.0.3.1327240] Cannot satisfy dependency: From: Android Development Tools 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt.feature.group 22.6.3.v201404151837-1123206) To: com.android.ide.eclipse.adt [22.6.3.v201404151837-1123206] Cannot satisfy dependency: From: ADT Package 22.0.1.v201305230001--685705 (com.android.ide.eclipse.adt.package.feature.group 22.0.1.v201305230001--685705) To: com.android.ide.eclipse.adt.feature.group 22.0.0 Cannot satisfy dependency: From: Android Developer Tools 22.0.1.v201305230001--685705 (com.android.ide.eclipse.adt.package.product 22.0.1.v201305230001--685705) To: com.android.ide.eclipse.adt.package.feature.group [22.0.1.v201305230001--685705] any one of you guys have a solution for that ?? Best Regards !!
downvote count: 0
upvote count: 1
duplicate of: http://stackoverflow.com/q/24437564
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/22513524
tagged with: sdk
tagged with: android
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/25306068
accepted answer: http://stackoverflow.com/a/25306068
tagged with: eclipse

http://stackoverflow.com/comment/39565971
score: 0
type: AnswerComment
has text: Are you sure you are getting 'Male' with a capital and not 'male', you could try the 'equalsIgnoreCase' method.
comment on: http://stackoverflow.com/a/25372585
type: Comment

http://stackoverflow.com/comment/39374534
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25267571
type: Comment
has text: "what wait() does is it halts all running code" Not sure what you mean by _all_ running code. What `foo.wait()` does is, it releases the monitor for foo, it waits to be notified, it re-acquires the monitor for foo, and then it returns. It does not "halt" any other thread.

http://stackoverflow.com/comment/39684279
comment on: http://stackoverflow.com/q/25290036
type: Comment
score: 0
has text: Beyond what the others have said, instead of using a list, consider storing the strings in a single large string with corresponding arrays of integers for the individual string offsets and lengths. That should avoid the cpu having to go off to different areas of memory to fetch each string and allow it to make better use of its caches. Secondly may be do some gross filtering first, eg compare the hash codes of the strings and only bother to compare the strings themselves if the hash codes match.
type: QuestionComment

http://stackoverflow.com/comment/39533103
has text: the size of "email" is not equal to the size of the listD array
comment on: http://stackoverflow.com/a/25343012
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25236408
has comment: http://stackoverflow.com/comment/39313730
has comment: http://stackoverflow.com/comment/39313597
has answer: http://stackoverflow.com/a/25236720
score: 0
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/25237034
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/25236499
has title: Disabling remaining Buttons, On Click of one button
has body: I have a small problem while disabling/enabling buttons in Swing Application. It's a very basic problem, but I'm new to this concept. I have a requirement like, having 2 buttons to perform 2 individual operations. While Running initially B1 &amp; B2 Should be Visible/Enabled. If B1 Clicked, then B2 should be disabled/Invisible. After B1 work Completed, then Both B1 &amp; B2 Should be Visible/Enabled. If B2 Clicked, then B1 should be disabled/Invisible. After B2 work Completed, then Both B1 &amp; B2 Should be Visible/Enabled. But, my problem, is, after processing B1/B2 SetEnable/SetVisible is working. It should be disabled before start and enabled after completing task Can anyone help in this case? Below is my Code import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; public class FinCSV implements ActionListener { JFrame frame = new JFrame("ICON"); JPanel panel = new JPanel(new GridLayout(2, 1, 4, 4)); JButton primaryButton = new JButton(" Primary Process"); JButton secondaryButton = new JButton(" Secondary Process"); public static void main(String[] args) throws Exception { FinCSV msql = new FinCSV(); msql.initGUI(); } public void initGUI() { this.primaryButton.setActionCommand("Primary"); this.secondaryButton.setActionCommand("Secondary"); this.primaryButton.addActionListener(this); this.secondaryButton.addActionListener(this); this.primaryButton.setFont(new Font("Serif", Font.BOLD, 22)); this.secondaryButton.setFont(new Font("Serif", Font.BOLD, 22)); panel.add(this.primaryButton); panel.add(this.secondaryButton); frame.setContentPane(panel); frame.setSize(650, 300); frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Primary")) { secondaryButton.setVisible(false); //…
answer count: 3
has comment: http://stackoverflow.com/comment/39315443
has comment: http://stackoverflow.com/comment/39314167
tagged with: java

http://stackoverflow.com/comment/39339576
comment on: http://stackoverflow.com/q/25250248
type: Comment
has text: @raiyan106 You'll need to be more specific.
type: QuestionComment
score: 0

http://stackoverflow.com/a/25357193
type: Answer
has body: You can use WebDriverWait like /** * Method to wait until element is visible * @param driver WebDriver instance * @param identifier identifiers used to select element * @param timeout Timeout duration * @return Element */ public WebElement waitUntilElementIsVisible(By identifier, long timeout) { WebDriverWait wait = new WebDriverWait(driver, timeout); WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(identifier)); return element; }
score: 0
answers question: http://stackoverflow.com/q/25355364

http://stackoverflow.com/comment/39592687
has text: I see. I don't use the InOut exchange pattern often, but have you set up the exchange pattern as InOut, eg jms:MyQueue?exchangePattern=InOut. See http://camel.apache.org/exchange-pattern.html
comment on: http://stackoverflow.com/q/25377183
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/25233881
linked to: http://stackoverflow.com/q/6054681
accepted answer: http://stackoverflow.com/a/25234030
has comment: http://stackoverflow.com/comment/39308898
has comment: http://stackoverflow.com/comment/39308698
type: Question
tagged with: jframe
has body: Here is my code: import java.awt.event.*; import java.awt.*; import javax.swing.*; public class wind extends JFrame implements ComponentListener, MouseListener { JButton button; JLabel label; public wind() { // initialise instance variables setTitle("My First Window!"); setSize(400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); JPanel content = new JPanel(); content.setLayout(new FlowLayout()); content.addComponentListener(this); content.addMouseListener(this); label = new JLabel("My First Window"); content.add(label); label.addComponentListener(this); button = new JButton("Click If You Wish To Live!"); button.addMouseListener(this); content.add(button) setContentPane(content); } public void componentHidden(ComponentEvent e){ try{wait(100);} catch(InterruptedException error){} button.setText("Hidden!"); } public void componentShown(ComponentEvent e){ try{wait(100);} catch(InterruptedException error){} button.setText("Shown!"); } public void componentResized(ComponentEvent e){ try{wait(100);} catch(InterruptedException error){} button.setText("Resized!"); } public void componentMoved(ComponentEvent e){ try{wait(100);} catch(InterruptedException error){} button.setText("Moved!"); } public void mouseExited(MouseEvent e){ try{wait(100);} catch(InterruptedException error){} label.setText("Exited!"); } public void mouseEntered(MouseEvent e){ try{wait(100);} catch(InterruptedException error){} label.setText("Entered!"); } public void mousePressed(MouseEvent e){ try{wait(100);} catch(InterruptedException error){} label.setText("pressed at: "+e.getX()+" "+e.getY()); } public void mouseReleased(MouseEvent e){ try{wait(100);} catch(InterruptedException error){} label.setText("Released!"); label.setLocation(e.getX(), e.getY()); } public void mouseClicked(MouseEvent e){} } It won't respond to the mouse or window re-sizing, hiding, or moving. Furthermore the button is not being displayed. fixed! I am just starting to learn about Java's JFrame and other g…
has comment: http://stackoverflow.com/comment/39309042
has answer: http://stackoverflow.com/a/25234030
has comment: http://stackoverflow.com/comment/39309028
has comment: http://stackoverflow.com/comment/39309361
answer count: 2
possible better answer: http://stackoverflow.com/a/25234612
has comment: http://stackoverflow.com/comment/39308909
has answer: http://stackoverflow.com/a/25234612
has comment: http://stackoverflow.com/comment/39309352
has comment: http://stackoverflow.com/comment/39308877
has comment: http://stackoverflow.com/comment/39308999
has comment: http://stackoverflow.com/comment/39308783
has comment: http://stackoverflow.com/comment/39309512
type: AnsweredQuestion
has title: Why won't my JFrame respond to mouse and window changes?
score: 0
tagged with: mouselistener
tagged with: java
has comment: http://stackoverflow.com/comment/39308883
tagged with: window
has comment: http://stackoverflow.com/comment/39309291
tagged with: swing
has comment: http://stackoverflow.com/comment/39308893
has comment: http://stackoverflow.com/comment/39308892

http://stackoverflow.com/a/25391394
answers question: http://stackoverflow.com/q/25381228
type: Answer
score: 2
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25381228
type: AcceptedAnswer
has body: A classical example for a Decorator (I think it was from the GOF book) is a widget or panel from a UI application that can be enhanced (or decorated) with further styling (e.g. borders). Imagine two different decorators, one decorating your rectangular widget with a 1pixel-sized border and another, using a 5pixel-sized dash border. Do you expect (1) new DashedBorder(new Border(new Panel())) to look the same as (2) new Border(new DashedBorder(new Panel()))? I would not. In the first case I would expect a 1pixel-sized border encapsulated by a 5pixel-sized dashed border and in the second case a vice-versa result. Decorators do what they are called. They decorate your object. Decorating an object with two different things can lead to the same result but they do not have to.

http://stackoverflow.com/comment/39389458
type: QuestionComment
comment on: http://stackoverflow.com/q/25274949
type: Comment
score: 0
has text: it gives this and the usage details `RPM version 4.8.0 Copyright (C) 1998-2002 - Red Hat, Inc. This program may be freely redistributed under the terms of the GNU GPL`

http://stackoverflow.com/comment/39591387
comment on: http://stackoverflow.com/q/25386215
score: 0
has text: i dont want to change the all theme . just to customize the tabs with my own pictures i made..
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25288381
has answer: http://stackoverflow.com/a/25289843
type: Question
tagged with: weblogic
has answer: http://stackoverflow.com/a/25289575
tagged with: maven
tagged with: http://stackoverflow.com/tag/xml
has title: is it possible to inject value into weblogic.xml from external file?
tagged with: code-injection
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25289575
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25289843
has body: i have defined virtual directory directory mapping like below: <virtual-directory-mapping> ${foo} *.pdf </virtual-directory-mapping> The value foo is declared in pom.xml. Everything is working properly. But the question is: Can i inject this value from some external file or define this in weblogic directly?

http://stackoverflow.com/q/25282581
has title: Correct way to parse a String of data
has answer: http://stackoverflow.com/a/25283340
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39399021
has body: I'm fairly new to programming and I've recently built an Android application that reads data from a USB serial device using USB OTG. I read the data into a byte buffer, convert it into a String and then parse the string so that I can select and use different parts of the data to display different things on my app. I do this by first using example.substring(example.lastIndexOf("123"); to split the string up and lose the first part of the string that I don not need, I then check the length of the substring to make sure the data is correct, next I convert the substring data into a char array so that I'm able to select different data elements of the array and display them on screen. This seems to work but I just feel like its messy and probably the incorrect way to parse the string. Could someone please give me an Idea of whether there's a more efficient way to parse the string or if I should carry with my current method. For example: String s = "Serial Data String TX, ID: 1, UOD: 1234, OK"; String ss = s.substring(s.lastIndexOf("ID: ")); int len = ss.length(); char[] c = ss.toCharArray(); if (len == 20) { if (c[4] == '1') { String mSubstring = ss.substring(12, 16); tv1.setText(mSubString); Is this a messy/ineficient method?
tagged with: performance
tagged with: oop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39399375
has answer: http://stackoverflow.com/a/25282753
accepted answer: http://stackoverflow.com/a/25282897
has comment: http://stackoverflow.com/comment/39399580
favorite count: 0
tagged with: parsing
type: Question
has answer: http://stackoverflow.com/a/25283049
has comment: http://stackoverflow.com/comment/39399498
possible better answer: http://stackoverflow.com/a/25282753
has comment: http://stackoverflow.com/comment/39398887
has answer: http://stackoverflow.com/a/25283423
downvote count: 0
has answer: http://stackoverflow.com/a/25282875
upvote count: 1
answer count: 6
tagged with: string
has answer: http://stackoverflow.com/a/25282897

http://stackoverflow.com/a/25294160
type: Answer
answers question: http://stackoverflow.com/q/25293918
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39421339
has body: The easiest way to do this would be making the JMenuBar Object public and static to allow access from every other class in the program without creating extra instances.
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25293918

http://stackoverflow.com/comment/39418178
score: 0
has text: not really a duplicate as it is about converting to a LinkedList, not a List in general.
type: Comment
comment on: http://stackoverflow.com/q/25292784
type: QuestionComment

http://stackoverflow.com/q/25298642
tagged with: java
possible better answer: http://stackoverflow.com/a/25298855
has answer: http://stackoverflow.com/a/25298855
tagged with: updates
has answer: http://stackoverflow.com/a/25299086
accepted answer: http://stackoverflow.com/a/25299086
tagged with: text-based
type: Question
answer count: 2
has title: Update loop inside game error from null/ Map generator generating null
tagged with: maps
tagged with: generator
type: AnsweredQuestion
score: 0
has body: Thanks for thanks the time to read my question. I am currently having trouble with a small text based adventure game I am developing. Right now I am getting this error message when I update my map: Exception in thread "main" java.lang.NullPointerException at main.GameManager.update(GameManager.java:92) at main.GameManager.run(GameManager.java:78) at main.Main.main(Main.java:8) I have a theory as to why this may be happening, as I have spent a few hours trying to figure this out on my own. My theory is that the map generator is creating a square with a null value which is causing the update method to encounter an error. Another thing I have noticed is that the error message occurs with random objects every time. Sometimes, an entity returns the error message, when other times a weapon returns the error message. The code for the update method is below: NOTE: I put two asterisks on the line of code where the error message returned the error //method executed every loop until end private void update(Object[][] gameMap, GUIController guiController){ player.update(gameMap, guiController); //updates every object on the map besides player for(int row = 0; row&lt;mapManager.getWIDTH(); row++){ for(int col = 0; col&lt;mapManager.getHEIGHT(); col++){ //if the square has something inside of it if(!(gameMap[row][col] instanceof EmptySquare)){ **gameMap[row][col].update(gameMap, guiController); } } } //check guiController.displayMessage("updated"); } The map generation code is below: for(int row = 0; row &lt; WIDTH; row++){ for(int col = 0; col &lt; HEIGHT; col++){ Random r = new Random(); //NOTE: +1 included to get number 1-6 instead of 0-6 or 0-5 int rand = r.nextInt(6) + 1; int rand2 = r.nextInt(2) + 1; System.out.println(rand); System.out.println(rand2); if(rand &lt;= 2){ //an empty tile gameMap[row][col] = new EmptySquare("Empty Square", 0); gameMap[row][col].setLocation(row, col); }else if(rand == 3 || rand == 4){ //monster tile //decides what monster to put in the tile bas…

http://stackoverflow.com/comment/39458494
type: Comment
type: AnswerComment
has text: These decimalformats can only print the decimals right? But I want to make the variable store six decimal places. Isnt that possible?
comment on: http://stackoverflow.com/a/25314368
score: 0

http://stackoverflow.com/q/25378256
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25761041
possible better answer: http://stackoverflow.com/a/25404562
answer count: 2
has answer: http://stackoverflow.com/a/25761041
upvote count: 1
downvote count: 1
has body: i have little trouble. I'm stuck at broadcast message using chat from server to client using Netty, I'll already can chat from client to server and autoreplay from server (using handling), now what i want is Server can chat like client and broadcast it to all client(channel active). I'm trying to copy from my client, but it didn't work, Channel channel = boostrap.bind(port).sync().channel(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true) { channel.writeAndFlush(in.readLine() + "\r\n"); } Sorry about Android tag, because later I want to use this code Client on Android Considering Nio doesn't work on Android, but Oio work. i include all code of my work, //ChatServer.java public class ChatServer { private final int port; public static void main(String[] args) throws Exception { System.out.println("Server Started at " + InetAddress.getLocalHost().getHostAddress() + " port " + 9999); new ChatServer(9999).run(); } public ChatServer(int port) { this.port = port; } public void run() throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap boostrap = new ServerBootstrap() .group(bossGroup,workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChatServerInitializer()); Channel channel = boostrap.bind(port).sync().channel(); // channel.closeFuture().sync(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true) { channel.writeAndFlush(in.readLine() + "\r\n"); } }finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } } . // ChatServerHandler.java public class ChatServerhandler extends SimpleChannelInboundHandler&lt;String&gt; { private static final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); @Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { Channel incoming = ctx.channel(); for (Channel channel: channels) { channel.w…
favorite count: 0
type: Question
has title: Server Chat to all Client Online/Connected Netty
has answer: http://stackoverflow.com/a/25404562
tagged with: android
tagged with: netty
tagged with: java

http://stackoverflow.com/q/25236886
type: Question
tagged with: jsoup
score: 5
answer count: 1
downvote count: 0
has body: I'm working on a project that displays song names and a link to that song by parsing a website using Jsoup. The only problem is, I can only get the first 10 elements that I want from that website because as you scroll down, the website generates more elements. The specific website I'm trying to parse is a music site called TrappedIO. You'll notice when viewing the website that when you scroll down, more song names and images appear. When I use inspect element in chrome, I see that as I scroll, it generates more of elements I'm trying to parse. The CSS Path of what I'm parsing: #content > div.container > div > div:nth-child(index of element) The problem is when I get this website with Jsoup using this method, Document doc = Jsoup.connect(url).get(); HTML returned from Jsoup: Pastebin Only the first 10 elements I want to parse are returned, along with all the other HTML. To be more specific, I'm parsing using Jsoup in an AsyncTask, then populating a ListView with the parsed data. Any ideas? Any suggestions on how to load everything at once? Any response is very much appreciated, thanks.
accepted answer: http://stackoverflow.com/a/25237275
type: AnsweredQuestion
tagged with: android
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25237275
favorite count: 0
has title: Parsing a website with Jsoup that dynamically loads as the user scrolls

http://stackoverflow.com/comment/39447303
type: AnswerComment
has text: @suud I don't think that m2e will solve your trouble
comment on: http://stackoverflow.com/a/25306076
score: 0
type: Comment

http://stackoverflow.com/q/25255950
tagged with: eclipse
has answer: http://stackoverflow.com/a/25256083
linked to: http://stackoverflow.com/q/21893754
answer count: 2
has answer: http://stackoverflow.com/a/25317755
score: 1
has comment: http://stackoverflow.com/comment/39390897
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/21442547
upvote count: 1
has comment: http://stackoverflow.com/comment/57865687
tagged with: macos
has body: I am pretty new to Mac OS, or Bouncy Castle/Encryption at all, hence I am following the guide here and downloaded the PGP-JDK1.5-1.7 version of Bouncy Castle jar. I issued the below command to see where Java is installed: bash-3.2$ sudo find / -name "*.security" Password: /Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib/security/java.security find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/java.security /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security /Users/fn.lastname/code/vault/security_java_jars_Aug11/java.security I then added security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/java.security and also added the bouncy castle jar to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext The changed java.security content is as below: security.provider.1=sun.security.provider.Sun security.provider.2=sun.security.rsa.SunRsaSign security.provider.3=sun.security.ec.SunEC security.provider.4=com.sun.net.ssl.internal.ssl.Provider security.provider.5=com.sun.crypto.provider.SunJCE security.provider.6=sun.security.jgss.SunProvider security.provider.7=com.sun.security.sasl.Provider security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI security.provider.9=sun.security.smartcardio.SunPCSC security.provider.10=apple.security.AppleProvider security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider I went to eclipse(STS) and executed the program here to see if the Bouncy Castle is successfully installed. It just returned "BC provider not installed". I tried the same on the location at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/securi…
favorite count: 0
type: Question
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: cryptography
has title: Installing Bouncy Castle on Mac

http://stackoverflow.com/comment/39592380
type: QuestionComment
has text: @nija i will update my code with more descripton in few mins. i try to solve it by converting bitmap to byte[] array and then passing it. that does not help either. Im kinda confused :s gimme few minss
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25386114

http://stackoverflow.com/q/25336476
tagged with: java
type: UnansweredQuestion
tagged with: mongotemplate
score: 1
favorite count: 0
tagged with: mongodb
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/57114587
upvote count: 1
has answer: http://stackoverflow.com/a/25342380
has title: Java MongoDB search for value in multiple fields
tagged with: spring-mvc
type: Question
has body: i have a java method public List&lt;Project&gt; tagSearch(String searchCriteria){ Query query = new Query(); return mongoTemplate.find(query.addCriteria(Criteria.where("projectTag") .regex(searchCriteria,"i")), Project.class, COLLECTION_NAME); } here it is searching the searchCriteria value in the field projectTag. I want to search for that value in multiple fields. for example another field projectName appreciate your assistance.

http://stackoverflow.com/comment/39530704
score: 0
comment on: http://stackoverflow.com/q/25354148
type: Comment
type: QuestionComment
has text: Although I have no clue, I very much doubt you would be able to do this due to the obvious problems with security. You could overwrite everything.

http://stackoverflow.com/q/25365998
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/39577058
favorite count: 0
linked to: http://stackoverflow.com/q/11160534
type: AnsweredQuestion
tagged with: java
has title: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException in spring compiled Jar
accepted answer: http://stackoverflow.com/a/25388467
has body: I have looked around and SO and I have not found a solution that has solved this issue for me. I have a Maven project using Spring and I call assembly-single and build a runnable jar. This project works fine from the IDE but when I run it as the runnable jar I get the following exception: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [properties.xml] is invalid; nested excep tion is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 62; cvc-elt. 1.a: Cannot find the declaration of element 'beans'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB eanDefinitions(XmlBeanDefinitionReader.java:396) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea nDefinitions(XmlBeanDefinitionReader.java:334) [...] My properties.xml file looks like the following. Notice I have schemaLocation correct and line 8 is http://www.springframework.org/schema/context &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"&gt; &lt;context:property-placeholder location="classpath:test.properties" system-properties-mode="OVERRIDE"/&gt; &lt;!-- --&gt; &lt;/beans&gt;
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39587426
type: Question
has answer: http://stackoverflow.com/a/25388467
possible better answer: http://stackoverflow.com/a/25378752
answer count: 2
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25378752
linked to: http://stackoverflow.com/q/8609322
downvote count: 0

http://stackoverflow.com/q/25259873
has answer: http://stackoverflow.com/a/25423980
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39364940
score: 5
tagged with: java
has body: We have legacy monolithic software in C++ that acts like a request-reply TCP server. This software is single-threaded and may process just one request simultaneously. Currently we have fixed pool of such processes to serve multiple clients in parallel. Periodically clients experience significant delays in request processing due to the large amount of messages. Currently we have an idea to solve this problem by introducing kind of Proxy between clients and workers: We want the following functionality for this Proxy: Application-level load balancing: spreading requests between workers by checking request context and client id Control and monitor life cycle of the worker processes Spawn additional worker processes (on different PCs) to handle peaks In fact we want it to behave like an ExecutorService in Java, but with worker processes instead of threads. Current idea is to implement this Balancer in Java based on Jetty or Tomcat server, with internal message queue and servlets forwarding requests to the worker processes. But I'm wondering: is there existing solutions (preferable in Java) that would automate this process? What would be the easiest way to implement such a Proxy? UPDATE: What I do with request context - well, that C++ server is really messy software. In fact every time it receives different context it updates internal cache accordingly to match that context. For example if you request that server to give you some data in English, then it reloads the internal cache to English. If next request is in French, then it reloads the cache again. Obviously I would like to minimize number of cache reloads by forwarding requests a bit more intelligently. The communication protocol is homemade (based on TCP/IP), but it's relatively easy to extract context part from it. Currently load balancing is implemented on the client side, so each client is configured to know all the server nodes and sends requests to them in round robin fashion. There are several problems of th…
downvote count: 0
favorite count: 0
type: Question
has title: Application level load balancer for pool of processes
tagged with: network-programming
upvote count: 5
has comment: http://stackoverflow.com/comment/39358486
possible better answer: http://stackoverflow.com/a/25404256
tagged with: architecture
has answer: http://stackoverflow.com/a/25404256
accepted answer: http://stackoverflow.com/a/25423980
answer count: 4
has answer: http://stackoverflow.com/a/25418805
has comment: http://stackoverflow.com/comment/39360158
has answer: http://stackoverflow.com/a/25374973
tagged with: c++

http://stackoverflow.com/comment/39574103
comment on: http://stackoverflow.com/a/25376249
score: 0
type: Comment
type: AnswerComment
has text: hi djna thanks i was looking for an option with testng since these is an Assert.assertThat option in junt. Found a work around in http://www.jroller.com/alexRuiz/entry/fest_assert_another_assertthat_library

http://stackoverflow.com/q/25260558
downvote count: 0
tagged with: ssl
tagged with: groovy
score: 7
tagged with: java
answer count: 1
has title: Groovy SSL signature verification: signature length not correct?
upvote count: 7
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25264526
has body: I'm trying to verify a message signed with private key, using the provided public key and a signature. The command line that works like charm is cat call.blah | openssl dgst -sha256 -verify public-key.pem -signature signature.sig Verified OK The public-key.pem has been created from X509 certificate using the command openssl x509 -pubkey -noout -in x509key.cer &gt; public-key.pem Now I am trying to mimic that in groovy, here's my code static void main(String[] args) { /* Verify a DSA signature */ if (args.length != 3) { System.out.println("Usage: VerSig publickeyfile signaturefile datafile") } else try { /* import encoded public key */ FileInputStream keyfis = new FileInputStream(args[0]) CertificateFactory f = CertificateFactory.getInstance("X.509") X509Certificate certificate = (X509Certificate)f.generateCertificate(keyfis) PublicKey pubKey = certificate.getPublicKey() /* input the signature bytes */ FileInputStream sigfis = new FileInputStream(args[1]) byte[] sigToVerify = new byte[sigfis.available()] sigfis.read(sigToVerify) sigfis.close() /* create a Signature object and initialize it with the public key */ Signature sig = Signature.getInstance("SHA256withRSA") sig.initVerify(pubKey) /* Update and verify the data */ FileInputStream datafis = new FileInputStream(args[2]) BufferedInputStream bufin = new BufferedInputStream(datafis) byte[] buffer = new byte[1024] int len while (bufin.available() != 0) { len = bufin.read(buffer) sig.update(buffer, 0, len) } bufin.close() boolean verifies = sig.verify(sigToVerify) // &lt;---- THIS IS WHERE THE ERROR OCCURS System.out.println("signature verifies: " + verifies) } catch (Exception e) { e.printStackTrace() } } and i'm running this with these parameters x509key.cer signature.sig call.blah (it's the X509 certificate, signature and the signed message body) Getting out the following stacktrace java.security.SignatureException: Signature length not correct: got 512 but was expecting 256 at sun.security.rsa.RSASignature.engine…
type: UnansweredQuestion

http://stackoverflow.com/q/25367510
tagged with: java
downvote count: 0
upvote count: 1
score: 1
has title: Getting error: The request sent by the client was syntactically incorrect
has answer: http://stackoverflow.com/a/25367571
answer count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25367571
has body: On one of the action I want it to take a POST of content. I am sending the following values: permissionId = $('#permissionId').val(); var emails = $.trim($('#emails', win).val()); var sms = $.trim($('#sendSms', win).is(':checked')); var email = $.trim($('#sendEmail', win).is(':checked')); var override = $.trim($('#cannotOverride', win).is(':checked')); window.location = '/aims/monitoringPermissions/' + permissionId + '/' + emails + '/' + sms + '/' + email+ '/' + override+ '/' + monitId; However, when I send it I am getting the following error: The request sent by the client was syntactically incorrect. My action looks like this @RequestMapping(value="/monitoringPermissions/{permissionId}/{emails}/{sms}/{email}/{override}/{monitId}", method = RequestMethod.GET) public ModelAndView submitPermissions(@PathVariable long roleId, @PathVariable String emails, @PathVariable boolean canSendSMS, @PathVariable boolean canSendEmail, @PathVariable boolean cannotOverride, @PathVariable long monitoringId,Model model, HttpSession session, Principal principal, @ModelAttribute("permission") MonitoringPermission monitoringPermission) throws Exception { Please help.
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/25379748
accepted answer of: http://stackoverflow.com/q/25379374
upvote count: 3
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25379374
has comment: http://stackoverflow.com/comment/39582918
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39579011
has comment: http://stackoverflow.com/comment/39579286
has body: Verify(mock) doesn't verify something by it self. You should say what exactly you wand to verify. For example, if you create test like: List mock = mock(ArrayList.class); verify(mock); You will get exception: org.mockito.exceptions.misusing.UnfinishedVerificationException: Missing method call for verify(mock) here: -&gt; at StackOverflowTest.testMockito(StackOverflowTest.java:72) Example of correct verification: verify(mock).doSomething() Example of correct test: List mock = mock(ArrayList.class); mock.add(new Object()); verify(mock).add(any()); Where you test that method add was invoked one time (default for verify) with any parameter

http://stackoverflow.com/comment/39495216
type: AnswerComment
comment on: http://stackoverflow.com/a/25319954
type: Comment
has text: Yes, I was already looking for a way to make family tree with `JTree`, it would be much more easy, but I'll find another way.
score: 0

lwjgl
tags question: http://stackoverflow.com/q/25335341
tags question: http://stackoverflow.com/q/25325440
tags question: http://stackoverflow.com/q/25319508
tag name: lwjgl
tags question: http://stackoverflow.com/q/25351206
tags question: http://stackoverflow.com/q/25252024
tags question: http://stackoverflow.com/q/25345469
tags question: http://stackoverflow.com/q/25269561
tags question: http://stackoverflow.com/q/25326519
type: Tag
tags question: http://stackoverflow.com/q/25323970
tags question: http://stackoverflow.com/q/25277085

http://stackoverflow.com/q/25308509
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/39447397
tagged with: eclipse
answer count: 4
has answer: http://stackoverflow.com/a/25308639
score: 0
has answer: http://stackoverflow.com/a/25308666
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39447320
downvote count: 1
has answer: http://stackoverflow.com/a/25308771
favorite count: 0
type: Question
has body: What I'm asking is, instead of spaces separating arguments can you have bars do it for eclipse arguments? So instead of passing everything as one word like somethingOne somethingTwo somethingThree you could do it like something one|something two|something three| instead?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25308579
has title: Is it possible to separate command arguments in eclipse with bars?

http://stackoverflow.com/q/25348958
has comment: http://stackoverflow.com/comment/39658784
has comment: http://stackoverflow.com/comment/39527845
type: Question
answer count: 2
has title: Kevin Brothaler OpenGL ES 2 tutorial code is wrong?
upvote count: 1
has comment: http://stackoverflow.com/comment/39658891
score: 1
tagged with: opengl-es-2.0
downvote count: 0
has answer: http://stackoverflow.com/a/25369914
has comment: http://stackoverflow.com/comment/39527817
has answer: http://stackoverflow.com/a/28007720
possible better answer: http://stackoverflow.com/a/28007720
favorite count: 0
has body: I got a book "Pragmatic OpenGL ES 2 for Android" by Kevin Brothaler. I just start to reading it and doing tutorials. Everything was fine until the tutorial in 4th chapter, about adding colors and shades. So 3rd chapter code is here (there are lot of stuff so I added a link). Everything was fine. And in the 4th chapter we are changing the way which this stuff is drawn and changing shaders. And there are just black screen instead of such nice picture First, we've changed the shaders Vertex shader attribute vec4 a_Position; attribute vec4 a_Color; varying vec4 v_Color; void main() { v_Color = a_Color; gl_Position = a_Position; gl_PointSize = 10.0; } Frament shader precision mediump float; varying vec4 v_Color; void main(){ gl_FragColor = v_Color; } Also we added new stuff in Render class and deleted some too. Variables private static final int POSITION_COMPONENT_COUNT=2; private static final int BYTES_PER_FLOAT=4; private static final String A_COLOR="a_Color"; private static final int COLOR_COMPONENT_COUNT=3; private static final int STRIDE = (POSITION_COMPONENT_COUNT+COLOR_COMPONENT_COUNT)*BYTES_PER_FLOAT; private int aColorLocation; Changing methods this way (thats how it was before) public void onSurfaceCreated(GL10 gl, EGLConfig config) { // TODO Auto-generated method stub glClearColor(0.0f, 0.0f, 0.0f, 0.0f); String vertexShaderSource = TextResourceReader.readTextFileFromResource(context, R.raw.simple_vertex_shader); String fragmentShaderSource = TextResourceReader.readTextFileFromResource(context, R.raw.simple_fragment_shader); int vertexShader = ShaderHelper.compileVertexShader(vertexShaderSource); int fragmentShader = ShaderHelper.compileFragmentShader(fragmentShaderSource); program = ShaderHelper.linkProgram(vertexShader, fragmentShader); if(LoggerConfig.ON){ ShaderHelper.validateProgram(program); } glUseProgram(program); aPositionLocation = glGetAttribLocation(program, A_POSITION); aColorLocation = glGetAttribLocation(program, A_COLOR); vertexData.position(0)…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39527916
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25369914

http://stackoverflow.com/comment/39374784
type: AnswerComment
comment on: http://stackoverflow.com/a/25261148
score: 0
type: Comment
has text: Thank you S Ravikumar but there are more than one field I need to grab. I can not hard code 'Rewards Number'

http://stackoverflow.com/a/25382591
answers question: http://stackoverflow.com/q/25382192
score: 0
has comment: http://stackoverflow.com/comment/39585170
has comment: http://stackoverflow.com/comment/39585775
has body: Okay let us start at the beginning. You are using methods to get the values of your variables. A convention which is used for this is to call the method "get" + variableName. Something like this: public double getHoursWorked() { return this.hoursWorked; } If you want to set this variable you can use the same convention. You call the function "set" + variableName. In your main function you should try to use additional functions for you behavior. First of you could create a function calculatePayroll and in this function you will call additional functions which will calculate the desired things. The sections to turn into a functions are already defined by you in the commnents. For "/** Figure Out Overtime Hours */" you could create a function: public double calculateOvertimeHours() { //do your calculation here } This will split your code into some functions which are easier to test and to debug if you program does not work properly.
type: Answer

http://stackoverflow.com/q/25363859
has title: Calendar week_of_year comes week_of_month
answer count: 1
has answer: http://stackoverflow.com/a/25363915
downvote count: 0
has body: I am retrieving the number of week in the year from a date but it seems it returns me the number of week in the month. Calendar cal = Calendar.getInstance(); try { cal.setTime((new SimpleDateFormat("yyyy-mm-dd")).parse(date)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } int num_of_week = cal.get(Calendar.WEEK_OF_YEAR); I input "2014-08-18" and it comes out 3 as result.......how can I correctly retrieve the week number.......
upvote count: 1
tagged with: calendar
favorite count: 0
has comment: http://stackoverflow.com/comment/39548654
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25363915
type: Question
has comment: http://stackoverflow.com/comment/39548611

http://stackoverflow.com/comment/39474551
type: Comment
has text: Is there any thing that is static? So you are interested on all values?
comment on: http://stackoverflow.com/a/25307807
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39530137
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25346293
has text: It would be a more accurate measure of time, as the `Timer` only guarantees at least the specified delay time

http://stackoverflow.com/comment/39474705
comment on: http://stackoverflow.com/a/25322499
type: Comment
has text: thanks for your reply. If i'm running the encryption in a test server, should the server be set up with the JCE Unlimited strength policy?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39541312
score: 0
has text: @Morfic not yet, i'll try it! :)
comment on: http://stackoverflow.com/q/25359512
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39587353
score: 0
type: QuestionComment
has text: Okay, I guess there's nothing I can do then apart from just not use the mouse lol. Thanks.
comment on: http://stackoverflow.com/q/25382930
type: Comment

http://stackoverflow.com/comment/39614916
has text: Hi @haraldK! I'm using JAI 1.1.3. I've downloaded jai_core.jar, jai_codec.jar and set them in my eclipse project buildpath. No other instalations should be made, because this code should be deployed on client's server and I don't have access and rghts to make installations on it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25385966
score: 0

http://stackoverflow.com/q/25294122
upvote count: 1
has title: Private Constructor Object initialization
downvote count: 1
answer count: 1
favorite count: 0
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39420498
accepted answer: http://stackoverflow.com/a/25294161
has answer: http://stackoverflow.com/a/25294161
type: AnsweredQuestion
score: 0
has body: I read the following code on NULL object pattern but there is one thing that I am really not clear on. The code follows. //Null.java package test_package1; public interface Null { } //Person.java class Person { public final String first; public final String last; public final String address; // etc. public Person(String first, String last, String address){ this.first = first; this.last = last; this.address = address; } public String toString() { return "Person: " + first + " " + last + " " + address; } public static class NullPerson extends Person implements Null { private NullPerson() { super("None", "None", "None"); } public String toString() { return "NullPerson"; } } public static final Person NULL = new NullPerson(); } Now, I've a question: why should the following code snippet work: public static final Person NULL = new NullPerson(); The NullPerson class has a private constructor, so how is the object instantiation possible outside the class scope? Secondly, what is the need of making the NullPerson class as a static inner class?
has comment: http://stackoverflow.com/comment/39420500

http://stackoverflow.com/comment/39427604
type: AnswerComment
comment on: http://stackoverflow.com/a/25260697
score: 0
has text: Correct, except I'll take issue with the "generally". Various computer systems have used about [two dozen different epochs](http://en.wikipedia.org/wiki/Epoch_(reference_date)#Notable_epoch_dates_in_computing). As for the count, Unix systems use seconds-since-epoch (giving us the [Y2038 problem](http://en.wikipedia.org/wiki/2038_problem)), java.util.Date/Joda-Time use milliseconds, and the new java.time package in Java 8 uses nanoseconds.
type: Comment

http://stackoverflow.com/comment/39426701
has text: I have to refresh a browser with this code browser.refresh(); but when there are a lot of errors:Exception in thread "Timer-1" org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:4361) at org.eclipse.swt.SWT.error(SWT.java:4276) at org.eclipse.swt.SWT.error(SWT.java:4247) at org.eclipse.swt.widgets.Widget.error(Widget.java:468) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
score: 0
comment on: http://stackoverflow.com/a/25296852
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25312407
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2399086
tagged with: android
accepted answer: http://stackoverflow.com/a/25312934
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/2652414
has comment: http://stackoverflow.com/comment/39455192
has answer: http://stackoverflow.com/a/25312934
has title: unable to get selected spinner value when assign values from strings.xml in android application
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39455042
answer count: 1
has comment: http://stackoverflow.com/comment/39454742
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39455061
favorite count: 0
type: Question
has body: In android application to populate values into spinner I have used values from values\strings.xml first second In layout\input_box.xml <Spinner android:id="@+id/spinner_problems" android:entries="@array/myList" android:layout_width="match_parent" android:layout_height="wrap_content" /> above code will populate spinner values from myList on MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { spin_problem = (Spinner)findViewById((R.id.spinner_problems)); spin_problem.setOnItemSelectedListener(new OnItemSelectedListener(){ @Override public void onItemSelected(AdapterView<?> adapter, View view1, int pos, long id) { spin_problem_val= adapter.getItemAtPosition(pos).toString(); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); //thread run Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { try { showInputDialog("Any Complaints?"); } catch (JSONException e) { e.printStackTrace(); } }}, 8000); // 3000 milliseconds //end thread } showInputDailog method code // my textbox and spinner is in this method public void showInputDialog(final String textparam) throws JSONException { try{ // get prompts.xml view to show complaint popup LayoutInflater layoutInflater = LayoutInflater.from(MainActivity.this); View promptView = layoutInflater.inflate(R.layout.input_dialog, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( MainActivity.this); alertDialogBuilder.setView(promptView); if(textparam.toString() == "Feedback"){alertDialogBuilder.setTitle("Feedback");} else{alertDialogBuilder.setTitle("Any Complaints?");} //Get all dialog box values final EditText name = (EditText) promptView .findViewById(R.id.name); final EditText mobno = (EditText) promptView .findViewById(R.id.mobno); final EditText complaint = (EditText) promptView .findViewById(R.id.complaint); // final Spinner problems = (Spinner)findViewById((R.id.spinner_problems)); // final Spi…

http://stackoverflow.com/q/25315753
tagged with: compilation
has comment: http://stackoverflow.com/comment/39488679
has title: Scala "bad symbolic reference" to scala.actors
has comment: http://stackoverflow.com/comment/39466533
has comment: http://stackoverflow.com/comment/39468113
has comment: http://stackoverflow.com/comment/39475504
answer count: 0
score: 0
tagged with: scala
tagged with: intellij-idea
type: Question
has body: I am trying to compile a Java / Scala project in Intellij and getting the following error: Error:scalac: Error: bad symbolic reference to scala.actors encountered in class file 'Anytime.class'. Cannot access term actors in package scala. The current classpath may be missing a definition for scala.actors, or Anytime.class may have been compiled against a version that's incompatible with the one found on the current classpath. scala.reflect.internal.Types$TypeError: bad symbolic reference to scala.actors encountered in class file 'Anytime.class'. Cannot access term actors in package scala. The current classpath may be missing a definition for scala.actors, or Anytime.class may have been compiled against a version that's incompatible with the one found on the current classpath. at scala.reflect.internal.pickling.UnPickler$Scan.toTypeError(UnPickler.scala:675) The Scala source code is mixed with the Java source code. I don't understand what is causing this error or how to fix it.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39347510
comment on: http://stackoverflow.com/q/25253027
has text: Why do you need to call `SwingUtilities.updateComponentTreeUI(this);` and/or `this.validateTree()` at all?
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25242365
score: 0
answers question: http://stackoverflow.com/q/25242091
type: Answer
has body: @XmlRootElement class MyRoot { private List&lt;SubRootDTO&gt; subs; ... @XmlElementRef(name = "CustomName") public List&lt;SubRootDTO&gt; getSubs(){ return subs; } } class SubRootDTO { } In contrast to annotate SubRootDTO with @XmlRootElement(name = "XYZ"), @XmlElementRef(name = "ABC") allows you to name the element differently for each reference.

http://stackoverflow.com/a/25357403
upvote count: 6
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/39547841
has comment: http://stackoverflow.com/comment/39536643
answers question: http://stackoverflow.com/q/25357390
downvote count: 0
has body: static blocks are executed when a class is first initialized (initialization of a class happens once it is loaded ) so they execute earlier than instance level blocks / methods (executed after creating an object)

http://stackoverflow.com/a/68297172
upvote count: 6
has body: I've decided update initial question's code with final working version for future readers. try { KeyPairGenerator kg = KeyPairGenerator.getInstance("EC"); ECGenParameterSpec kpgparams = new ECGenParameterSpec("secp256r1"); kg.initialize(kpgparams); KeyPair kp = kg.generateKeyPair(); PublicKey pubKey = kp.getPublic(); PrivateKey pvtKey = kp.getPrivate(); // sign Signature ecdsaSign = Signature.getInstance("SHA256withECDSA"); ecdsaSign.initSign(pvtKey); String message = "text ecdsa with sha256";//getSHA256(msg) ecdsaSign.update(message.getBytes(StandardCharsets.UTF_8), 0, message.length()); byte[] signature = ecdsaSign.sign(); // Validation ecdsaSign.initVerify(pubKey); ecdsaSign.update(message.getBytes(StandardCharsets.UTF_8), 0, message.length()); boolean result = ecdsaSign.verify(signature); assertTrue(result); // junit5 assert } catch (Exception e) { e.printStackTrace(); }
downvote count: 0
has comment: http://stackoverflow.com/comment/139419809
type: Answer
score: 6
answers question: http://stackoverflow.com/q/25261823

http://stackoverflow.com/comment/39596001
has text: i am using `mysql` as a database currently this database is getting used by `C# frontend`. now i want to migrate my application into `java web based` application. i can say i am writing this application from scratch with same database `DDL and proc`. so i will have write all DAO and services logic and all again, and i am open to write it again :) . So i need advice on this should i go with `grails + vaadin` so in future i don't need to migrate again. Please let me know if you need more information.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25387105

http://stackoverflow.com/comment/39436331
has text: Is that your spinner value saved in sharedpreference.And retrive when your app re-open???
type: QuestionComment
comment on: http://stackoverflow.com/q/25302398
score: 0
type: Comment

http://stackoverflow.com/q/25270905
score: 0
tagged with: java
has body: I have created a table in Microsoft Access with these fields: ID | Time | Roll_no | Attendance where ID is default auto-number field. I am trying to use the following code but it's generating this error: "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement." Code: ps=con.prepareStatement("insert into co3gs(Time, Roll_no, Attendance) values(?, ?, ?)"); ps.setString(1,mytime); ps.setString(2,r1); ps.setString(3,P);
has comment: http://stackoverflow.com/comment/39377814
answer count: 1
tagged with: ms-access
has answer: http://stackoverflow.com/a/25271382
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39377899
has title: How to skip autonumber field while using insert into
tagged with: sql

http://stackoverflow.com/comment/39429762
type: AnswerComment
comment on: http://stackoverflow.com/a/25298841
score: 0
type: Comment
has text: Well, _technically_ this solution isn't visiting all chars _in the counting part_ (it's excluding `-`). But it makes three passes over the input strings, the `split()` operation comes with a cost (so yes, it's visiting all chars after all). It won't be faster than my original answer.

http://stackoverflow.com/a/25279647
type: AcceptedAnswer
has body: Initially i was using a jar downloaded from Java2s link for downloading the jar I replaced it with jersey bundle 1.17 and asm 3.3.1. It worked then
type: Answer
answers question: http://stackoverflow.com/q/25251476
score: 0
accepted answer of: http://stackoverflow.com/q/25251476

http://stackoverflow.com/q/25315752
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39462784
accepted answer: http://stackoverflow.com/a/25325570
has comment: http://stackoverflow.com/comment/39468657
has comment: http://stackoverflow.com/comment/39466337
has comment: http://stackoverflow.com/comment/39462045
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/25325570
type: Question
has title: Java 8 Annotations on Instance creation
upvote count: 8
tagged with: annotations
has body: In the Javadocs for Annotations, it states that the following can be written in Java 8: new @Interned MyObject(); Is there anyway to retrieve the annotation @Interned from an object annotated like this via reflection? I'm familiar with the typical ways of retrieving annotations from methods, fields, classes, etc, but I'd like to know if it's possible to associate a particular instance with an annotation at runtime in Java 8.
has comment: http://stackoverflow.com/comment/39468730
tagged with: java-8
has comment: http://stackoverflow.com/comment/39466237
type: AnsweredQuestion
tagged with: reflection
tagged with: java

http://stackoverflow.com/q/25350296
linked to: http://stackoverflow.com/q/16037747
tagged with: spring-mvc
has body: I'm trying to upload a multipart file using Ajax, Spring MVC 3.2.0, Tomcat 8.0.9, but can't get it work. I read a lot of blogs and similar posting here on stackoverflow (Spring upload file problems, MultipartConfig with Servlet 3.0 on Spring MVC, …) which seem to have similar causes but couldn't figure out how to solve it. The weird thing is that the upload works when the file is smaller than 1MB, but when ever the recorded video exceeds that size, the following error is raised: org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:163) org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:139) org.springframework.web.multipart.support.MultipartFilter.doFilterInternal(MultipartFilter.java:110) In the following you can see all the configurations I made: The AJAX POST-Request: var videoBlob = e.data; var pathArray = window.location.pathname.split( '/' ); var userID; for (i = 0; i < pathArray.length; i++) { if (pathArray[i].toString() == "edit"){ userID = pathArray[i+1]; } } var fd = new FormData(); fd.append('fname', 'video'); fd.append('data', videoBlob); $.ajax({ url: '/user/edit/uploadVideo/' + userID, data: fd, processData: false, contentType: false, type: 'POST', success: function(data) { $('#result').html(data + "uploaded by FormData!"); } }); The web.xml contextConfigLocation classpath*:root-context.xml spring.profiles.default common org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:servlet-context.xml 1 appServlet / springMultipartFilter springMultipartFilter org.springframework.web.multipart.support.MultipartFilte…
answer count: 2
score: 5
downvote count: 0
tagged with: java
tagged with: multipartform-data
has comment: http://stackoverflow.com/comment/39524023
favorite count: 0
type: Question
tagged with: ajax
linked to: http://stackoverflow.com/q/23223762
upvote count: 5
has answer: http://stackoverflow.com/a/25350893
has title: Spring MVC - Multipart file upload with Ajax (Could not parse multipart servlet request)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39523962
has answer: http://stackoverflow.com/a/35719080
tagged with: spring

http://stackoverflow.com/q/25382249
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39594142
has comment: http://stackoverflow.com/comment/39595918
has body: I have the following set-up @Entity @Table(name = "FOO") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "FOO_TYPE", discriminatorType = DiscriminatorType.STRING, length = 20) @DiscriminatorValue("FOO") public class Foo implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "foo_column") private String fooColumn; ... getters and setters ... } @Entity @Table(name = "BAR") @PrimaryKeyJoinColumn(name = "BAR_ID", referencedColumnName = "ID") @DiscriminatorValue("Bar") public class Bar extends Foo { @Column(name = "bar_column") private String barColumn; ... getters and setters ... } When I execute the following query in Hibernate 3.6 as JPA provider, everything works as expected(well... as I expect at least), and the result list is populated with all kinds of objects which extend the Foo class: List&lt;Foo&gt; fooList = em.createQuery("SELECT foo FROM Foo foo WHERE 1=1 AND foo.fooColumn = 'foo' and foo.barColumn = 'bar'"); Notice that I am filtering by barField on the Foo object - and Hibernate is able to sort this out by filtering and populating the appropriate object. However, when executing the same query using EclipseLink, I recieve the following error: ... Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JPQLException Exception Description: Problem compiling [SELECT foo FROM Foo foo WHERE 1=1 AND foo.fooColumn = 'foo' and foo.barColumn = 'bar'] [66, 79] The state field path 'foo.barColumn' cannot be resolved to a valid type. ... Note: I have read the documentation of EclipseLink and I added a @DiscriminatorColumn and @DiscriminatorValue to the tables specifically. Then I changed the query to the following - using the TREAT function: List&lt;Foo&gt; fooList = em.createQuery("SELECT foo FROM Foo foo WHERE 1=1 AND foo.fooColumn = 'foo'…
score: 2
upvote count: 2
has title: EclipseLink: select from base entity and filter by child fields with InheritanceType.JOINED
answer count: 0
downvote count: 0
tagged with: eclipselink
tagged with: java
tagged with: jpa
favorite count: 0

http://stackoverflow.com/comment/39487593
comment on: http://stackoverflow.com/a/25325086
has text: Hmm... that sounds like a terrible solution to me. I was pointing you towards the problem, not solving it.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25246766
has body: I have the following class: import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Root; @Root(name="PickLineXtra") public class PickXtra { private final String key; @Attribute(name=this.key) private String value; public PickXtra(String key, String value) { this.key = key; this.value = value; } } This code does not compile. Specifically I'm trying to assign the name of the XML attribute dynamically, but annotations require constant expressions for assignment of their properties. Is there a way to accomplish this in simple XML?
answer count: 1
has comment: http://stackoverflow.com/comment/39828476
has comment: http://stackoverflow.com/comment/39828456
favorite count: 0
has answer: http://stackoverflow.com/a/25513444
type: AnsweredQuestion
score: 3
upvote count: 3
downvote count: 0
tagged with: java
has title: Dynamically assign attribute name in SimpleXML (java)
accepted answer: http://stackoverflow.com/a/25513444
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: simple-framework
has comment: http://stackoverflow.com/comment/39334781

http://stackoverflow.com/comment/39599310
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25389299
type: AnswerComment
has text: You can always read the contents of the `Iterator` into a `Collection`, but of course that means you have to hold all of it in memory at once. This may or may not be OK for your use case.

http://stackoverflow.com/comment/39449006
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25303420
has text: What does your `Map<String , Map<String , String>> states` contain? Could you be more explicit( maybe show us possible values for this map) and what values you expect to be in your states combo box as auto populated based on selected country?
score: 0

http://stackoverflow.com/q/25346712
has answer: http://stackoverflow.com/a/69119040
tagged with: opencv
has answer: http://stackoverflow.com/a/34902360
score: 0
tagged with: skew
has answer: http://stackoverflow.com/a/50232033
linked to: http://stackoverflow.com/q/15721550
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39607639
answer count: 4
tagged with: c++
type: UnansweredQuestion
has title: OpenCV Rotation (Deskewing) in Android - C++ to Java Conversion
linked to: http://stackoverflow.com/q/19651756
has answer: http://stackoverflow.com/a/30125832
has body: I'm trying to detect the skew angle of a text in an image link. The problem is that this post is written in C++, and I'm having trouble converting some things to Java. I did the implementation of Hugh Transform. Most of the conversion to java I did guiding me from this post (1). But it's not working fine. Is giving an angle of 0.27919363 when is supposed to give an angle of 15.9882. This is the image I'm working with. And this is my code: public double compute_skew1(String filename){ Log.d(TAG, "Computing skew 1"); Mat src = Highgui.imread(filename, 0); Size size = src.size(); //double minLineSize = 20; double minLineSize = src.width() / 2.f; Core.bitwise_not(src, src); Mat lines = new Mat(); double angle = 0.; try { Imgproc.HoughLinesP(src, lines, 1, Math.PI / 180, 100, minLineSize, 20); Mat disp_lines = new Mat(size, CvType.CV_8UC1, new Scalar(0, 0, 0)); int nb_lines = lines.cols(); for (int i = 0; i &lt; nb_lines; i++) { double[] vec = lines.get(0, i); double x1 = vec[0], y1 = vec[1], x2 = vec[2], y2 = vec[3]; Point start = new Point(x1, y1); Point end = new Point(x2, y2); Core.line(disp_lines, start, end, new Scalar(255,0,0)); angle += Math.atan2(y2 - y1, x2 - x1); } angle /= nb_lines; // mean angle, in radians.*/ //Log.d(TAG, "ANGLE: "+angle); Log.d(TAG, "ANGLE: "+ angle * 180 / Math.PI); } catch (Exception e) { Log.e(TAG, "Error in compute_skew1"); Log.e(TAG, e.getMessage()); } return angle; } I'm almost certain the problem is with this line "int nb_lines = lines.cols();" since the original line is "unsigned nb_lines = lines.size();", java doesn't jave unsigned variables, and that's the way it works in the post(1). Also, I don't quite understand this line "double[] vec = lines.get(0, i);" but that's the way it worked in the post (1) as well. What am I doing wrong? Also, after I get the angle, I need to do the rotation or deskewing of the text, and I also have some trouble with this conversion, especially with this part of the code: std::vector&lt;cv::Point&gt;…
has comment: http://stackoverflow.com/comment/48289285
type: Question

http://stackoverflow.com/comment/39311177
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25235091
type: AnswerComment
has text: Thanks chrylis! That fixed it now. I'm not sure why Eclipse added the *.jar;*.zip. I'll edit in the dialog that Eclipse gave me. I'll accept your answer as soon as stackoverflow lets me.

http://stackoverflow.com/q/25293459
tagged with: java
has answer: http://stackoverflow.com/a/25293523
type: AnsweredQuestion
tagged with: timer
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39420468
has comment: http://stackoverflow.com/comment/39419306
has comment: http://stackoverflow.com/comment/39419445
has comment: http://stackoverflow.com/comment/39419412
score: 1
upvote count: 1
has title: How to cancel the timer on java?
favorite count: 0
has comment: http://stackoverflow.com/comment/39419389
type: Question
possible better answer: http://stackoverflow.com/a/25293561
has body: How can I Cancel the timer when i2 == 690. This is my code: Timer timer = new Timer(); timer = new Timer(false); timer.schedule(new TimerTask() { @Override public void run() { if (i2 == 690) { timer.cancel(); } i2--; System.out.println("Java " + i2); } }, 0, 1000);
accepted answer: http://stackoverflow.com/a/25293523
has answer: http://stackoverflow.com/a/72238449
has answer: http://stackoverflow.com/a/25293561

http://stackoverflow.com/a/25280453
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25280300
has body: Connection conn=DriverManager.getConnection("jdbc:ucanaccess://C://Users//Satish Aiyappa//Documents//hrmanpowersystem.accdb"); should be Connection conn=DriverManager.getConnection("jdbc:ucanaccess://C:/Users/Satish Aiyappa/Documents/hrmanpowersystem.accdb"); only use //between jdbc:ucanaccess: and the path, use single / for the path.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25280300
type: AcceptedAnswer

http://stackoverflow.com/comment/39357661
type: QuestionComment
score: 0
type: Comment
has text: public boolean processData(final short[] data, final int offset, final int numShorts) { int numSamplesRequired = channels * frameSize; if (numShorts != numSamplesRequired) { throw new IllegalArgumentException("SpeexEncoder requires " + numSamplesRequired + " samples to process a Frame, not " + numShorts); } // convert shorts into float samples, for (int i=0; i<numShorts; i++) { rawData[i] = (float) data[offset + i ]; } // encode the bitstream return processData(rawData, numShorts); }
comment on: http://stackoverflow.com/q/25239432

http://stackoverflow.com/q/25233804
has title: Selenium Webdriver: JavascriptExecutor to push play on video
tagged with: javascript
tagged with: jquery
favorite count: 0
has body: How to execute play function on page's javascript jquery code using JavascriptExecutor? This is the code from the website: &lt;script type="text/javascript"&gt; jQuery(document).ready(function($) { $('#wp_mep_1').mediaelementplayer({ m:1 ,features: ['playpause','current','progress','duration','volume','tracks','fullscreen'] }); }); &lt;/script&gt; Here is a basic initiation of JavascriptExecutor: JavascriptExecutor js = (JavascriptExecutor) driver; Object o = js.executeScript("return '123'"); I may be way off, but I feel like I should be setting "o" in this example to $('#wp_mep_1').mediaelementplayer and then passing ("playpause"). Something like: JavascriptExecutor js = (JavascriptExecutor) driver; Object $('#wp_mep_1').mediaelementplayer = js.executeScript('playpause'); I don't have experience with Javascript or jquery, and advice would be most helpful.
score: 1
tagged with: java
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/26105079
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
tagged with: selenium

http://stackoverflow.com/comment/39483338
has text: So on top of the problems that others have pointed out - you're trying to invoke a constructor that doesn't exist. The error message is telling you that it's expecting a call to `Animal(String, String, Mlyzoo)` (Myzoo?), but got `Animal()` instead.
comment on: http://stackoverflow.com/q/25327506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39443978
score: 0
comment on: http://stackoverflow.com/q/25306709
type: Comment
has text: It would be easier to help if you post the error log
type: QuestionComment

http://stackoverflow.com/q/25295983
has title: Impossible to use BaseGameActivity in Android Studio
has comment: http://stackoverflow.com/comment/39456227
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39462485
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25329164
has answer: http://stackoverflow.com/a/25329164
tagged with: google-play-services
has body: I'm following this tutorial but I still cannot use BaseGameActivity. I installed the Library through SDK manager and I added this in my build.gradle dependencies { compile 'com.google.android.gms:play-services:5.2.08' } I also edited AndroidManifest Then I used "Sync Project With Gradle Files". I have no errors but I cannot had any of these import gms.common.api.*; import com.google.example.games.basegameutils.BaseGameActivity; -> Cannot resolve symbol 'gms' and Cannot resolve symbole 'example' Now I'm stuck.
tagged with: android-studio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39458535
tagged with: android-gradle-plugin
downvote count: 0
answer count: 1
score: 1
upvote count: 1

http://stackoverflow.com/a/41666063
score: -1
has comment: http://stackoverflow.com/comment/70533754
has comment: http://stackoverflow.com/comment/70547487
has body: I had the same error you're having(an error on the BufferedReader). It's because you forgot to put the BufferedReader in a try catch block. I also had the throws IOException after the main funtion but that's not enough. So it's not a memory issue. The correct code could be something like this: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = null; try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); for (int i=0; i&lt;T; i++) { int N = Integer.parseInt(br.readLine()); int res = (N/2)+1; System.out.println(res); }catch(Exception e) { e.printStackTrace(); }finally{ try{ br.close(); }catch ( Exception e){ e.printStackTrace(); } } // end of try catch } } Good Luck!
downvote count: 1
answers question: http://stackoverflow.com/q/25343025
upvote count: 0
type: Answer

http://stackoverflow.com/comment/39666805
type: Comment
type: QuestionComment
has text: Does this also mean that you solved the problem? Your module descriptor is almost identical to one I have in a JBoss 6.2 deployment (except mine had `xmlns="urn:jboss:module:1.0"`, but as far as I can tell that shouldn't make a difference).
score: 0
comment on: http://stackoverflow.com/q/25365532

z3
tags question: http://stackoverflow.com/q/25251936
type: Tag
tag name: z3

http://stackoverflow.com/q/25347567
has title: Eclipse Error "Could not create Java Virtual Machine"
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39519969
tagged with: android-studio
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39534712
has body: Error Image: http://postimg.org/image/p5ur9r7yh/ It was working just half an hour ago. But now it's throwing error like it could not create JVM. I Tired putting Environment variable like said in http://www.tomshardware.co.uk/faq/id-1761312/fix-create-java-virtual-machine-issue.html Also tried to create registry value _JAVA_OPTIONS Also tried to change values in eclipse.ini file. Nothing helped!
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/39538049
type: Question
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/39392468
score: 0
comment on: http://stackoverflow.com/a/25275370
has text: How does this link help?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25243369
favorite count: 0
type: Question
score: 1
tagged with: java
tagged with: paintcomponent
has title: in which order are components added to a JPanel drawn?
has body: I have a small application that should demonstrate how the opaque property works in Swing. however, what throws me off is the order in which paintComponent() is called. I'd come to think components are drawn in the order they were added (whats added first, gets drawn first) however in this example it appears that paintComponent() methods are drawn in reverse order(what's added last got painted first) can someone explain this behavior, thanks public class TwoPanels { public static void main(String[] args) { JPanel p = new JPanel(); // setting layout to null so we can make panels overlap p.setLayout(new BorderLayout()); CirclePanel topPanel = new CirclePanel("topPanel1"); // drawing should be in blue topPanel.setForeground(Color.blue); // background should be black, except it's not opaque, so // background will not be drawn topPanel.setBackground(Color.black); // set opaque to false - background not drawn topPanel.setOpaque(false); topPanel.setBounds(50, 50, 100, 100); // add topPanel - components paint in order added, // so add topPanel first p.add(topPanel); CirclePanel bottomPanel = new CirclePanel("buttomPanel1"); // drawing in green bottomPanel.setForeground(Color.green); // background in cyan bottomPanel.setBackground(Color.cyan); // and it will show this time, because opaque is true bottomPanel.setOpaque(true); bottomPanel.setBounds(30, 30, 100, 100); // add bottomPanel last... p.add(bottomPanel); // frame handling code... JFrame f = new JFrame("Two Panels"); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 300); f.setLocationRelativeTo(null); f.setVisible(true); } // Panel with a circle drawn on it. private static class CirclePanel extends JPanel { String objName; public CirclePanel(String objName) { this.objName = objName; } // This is Swing, so override paint*Component* - not paint protected void paintComponent(Graphics g) { System.out.println(objName); // call super.paintComponent to get default Swing // painting behavio…
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25243588

http://stackoverflow.com/comment/39579704
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25377700
has text: The keyword is “synchronize **d**” not “synchronize”

http://stackoverflow.com/q/25236084
possible better answer: http://stackoverflow.com/a/25236102
type: Question
accepted answer: http://stackoverflow.com/a/25237102
answer count: 2
linked to: http://stackoverflow.com/q/2835090
tagged with: database-connection
downvote count: 0
has comment: http://stackoverflow.com/comment/39313336
has comment: http://stackoverflow.com/comment/39313222
has body: I am very new to all this. I have created a web application which consists of all jsp pages(Note : the html content is embedded in those jsp pages itself along with the main logic) some snippets of my code are as below : &lt;% final String host = "jdbc:mysql://mySQLPath/ShopSystem"; final String uName = "myUsername"; final String uPass = "myPassword"; Connection con = DriverManager.getConnection( host, uName, uPass ); %&gt; A lot of my files have the above lines of code. Now I wish to upload these files on a web host as an attempt to publish my website. But what I am worried is that in doing so I will be uploading my username and password as well on the third party site. Is there any other better way to do this? I don't want any third person from being able to view my url, username and password.
has comment: http://stackoverflow.com/comment/39313308
has title: Providing security to jsp page which is to be uploaded on a web host
tagged with: jsp
has answer: http://stackoverflow.com/a/25237102
type: AnsweredQuestion
upvote count: 3
tagged with: security
score: 3
has answer: http://stackoverflow.com/a/25236102
has comment: http://stackoverflow.com/comment/39313038
tagged with: java
has comment: http://stackoverflow.com/comment/39313264
tagged with: web-hosting
favorite count: 0

http://stackoverflow.com/comment/39482169
type: Comment
has text: That would work too (you could also do it with a `direct` exchange) but most consider that the closest thing to a JMS topic (pub/sub) is a `fanout` exchange. A `topic` exchange is usually used to provide similar functionality to a JMS `messageSelector` expression but, you are correct, multiple consumers can "select" the same message with an appropriate binding.
type: AnswerComment
comment on: http://stackoverflow.com/a/25315805
score: 0

http://stackoverflow.com/comment/39522494
comment on: http://stackoverflow.com/q/25349500
score: 0
type: Comment
type: QuestionComment
has text: @m4rtin Yes, I'll edit in sec.

http://stackoverflow.com/a/28137717
score: 8
upvote count: 9
answers question: http://stackoverflow.com/q/25363027
downvote count: 1
has body: I thought to provide a more involved answer to this question. The following is a simplified version of some experiments I am doing with JNI to learn how to use it. This example is more about exploring how to access objects and fields using JNI rather than to be a recommendation as to use. Also the Java source is slightly modified removing quite a bit of other source dealing with other JNI uses. However this should provide a starting place. There are best practices for JNI such as caching of field identifiers which are being ignored in this example. Here are some best practices using JNI from IBM. In this example taken from that source the idea was to have a class, helloworld, which contained an inner class, ExportedFuncs, which would have various methods which acted as an interface to a set of native C functions exported from a dynamic link library (DLL). This inner class would in turn have its own inner class, ExportedData, which would be a data only class. When an ExportedFuncs object was created, it would do a native call using JNI to obtain an instance of an ExportedData class. JNI requires a fully qualified class name Notice in the JNI Native C source below that both the GetFieldID() and the FindClass() functions use a fully qualified class name of "Lhelloworld$ExportedFuncs$ExportedData;" which has the inner classes separated by the US dollar sign ($). The GetMethodID() function must include the parent classes of any inner class. If the method being looked up was within the main class, helloworld, then the call would look like: jmethodID midInit = (*env)->GetMethodID(env, cls, "<init>", "()V"); However since we are wanting to construct an inner class of an inner class we need to specify the parent classes for the inner class we want to construct as in: jmethodID midInit = (*env)->GetMethodID(env, cls, "<init>", "(Lhelloworld$ExportedFuncs;)V"); One other point is that the constructor for the ExportedData class is the default constructor which does not take any…
type: Answer

http://stackoverflow.com/q/25240345
tagged with: spring
linked to: http://stackoverflow.com/q/5901378
score: 0
has body: I am using maven for build on our purposes, I need to copy the javascript resources to a folder, can the folder name be the buildnumber , can we do this. I am planning to copy the javascript files to a folder name with build number and trying to write the build number in manifest file also to get this in JSP, could you please tell how i can implement this org.apache.maven.plugins maven-resources-plugin 2.6 copy-prod-resources process-resources copy-resources UTF-8 ${basedir}/target/cp/BUILD NUMBER /js ${basedir}/src/main/webapp/js true can I have some way to give the build number in this logic instead of the BUILD NUMBER text Regards Hari
tagged with: java
has answer: http://stackoverflow.com/a/25240898
has answer: http://stackoverflow.com/a/25240655
type: Question
answer count: 2
type: UnansweredQuestion
has title: Copy resources to buildnumber folder in maven
tagged with: maven

http://stackoverflow.com/a/25267578
has comment: http://stackoverflow.com/comment/39576781
answers question: http://stackoverflow.com/q/25267086
score: 1
type: Answer
has body: This seems a design choice between a class full of static variables and methods and a Singleton pattern In your situation, both may work. Although answers should not be opinion-based, I'd go slightly in the favor of the first choice (the same as your own), because of the exact same argument you provided: a lot of static constants. However, this will bring your code to a more C-style, procedural form. If, on the other hand, you don't make heavy use of static fields and you won't use your class in the same way you use Arrays, for example, then the second choice is better; the reason being flexibility (polymorphism is one example that gives flexibility). As for your second question, the static code gets executed when the class is loaded. For example: class MyClass { static final int SPEED_OF_LIGHT = 299792458; static { foo(); } static void foo () { // ... } } The method foo above gets executed at loading time and needs no objects to do its thing (of course, 'cause it's static). Also, static varaibles are initialized at class loading time as well.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25267086
upvote count: 1

http://stackoverflow.com/comment/39403326
has text: Project: clean leads to the console output: [2014-08-13 13:32:39 - test2] /test2/gen already exists but is not a source folder. Convert to a source folder or rename it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25284004

http://stackoverflow.com/comment/39342047
type: Comment
has text: We only briefly touched on hash tables in class. So i will need to practice using those, thanks for the advice!
type: AnswerComment
comment on: http://stackoverflow.com/a/25251503
score: 0

http://stackoverflow.com/q/25251779
has comment: http://stackoverflow.com/comment/39347584
has answer: http://stackoverflow.com/a/25311488
linked to: http://stackoverflow.com/q/20505446
type: UnansweredQuestion
tagged with: servlet-filters
has body: While working on a Java Servlet Filter to integrate with an internal SSO I struggled to find the correct way to create a persistent login using programmatic security functions. Specifically, after reading many tutorials such as this I was calling request.login(username,password) and a user Principal was created that returned correct values for methods request.isUserInRole(role) etc. for the current request. I expected this to be persistent for the user, but subsequent requests would return null for request.getUserPrincipal() so my authentication code was entered on every request. What I found here after much searching was that calling request.getSession(true) before calling request.login(username,password) causes the Principal to be persistent for the user session. Is it required to explicitly create a session before logging the user in to persist the Principal for the session? This behaviour seems odd to me so I am wondering if I am doing something wrong. I appreciate any insight from developers more knowledgeable on the matter than myself. Using JDK 7 and Tomcat 8. Realm is an extension of RealmBase that overrides authenticate(username,password), getName(), getPassword(username) and getPrincipal(username). public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; if(request.getUserPrincipal() == null) { try { String userName = request.getParameter(userNameField); String password = request.getParameter(passwordField); request.getSession(true); // &lt;-- block always entered without this request.login(username,password); } catch(ServletException e) { // Handle failed login... return; } } fc.doFilter(req,res); }
tagged with: servlets
score: 1
tagged with: java
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39364319
tagged with: authentication
upvote count: 1
has title: Is calling request.getSession(true) explicitly required to persist programmatic authentication via request.login(username,password)?
favorite count: 0
type: Question

http://stackoverflow.com/a/25307975
has comment: http://stackoverflow.com/comment/39446336
answers question: http://stackoverflow.com/q/25307720
downvote count: 0
upvote count: 1
score: 1
type: Answer
has body: I don't want two paths ok then put your the file in the resources folder of your application and try reading it this way private String filePath = className.getClass() .getResource("yourFileName").getPath(); BufferedReader reader = new BufferedReader(new FileReader(filePath));

http://stackoverflow.com/comment/39486159
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25327766
score: 0
has text: I shall check it out. Thanks for the heads up. Seems like CardLayout may be the way to go (without extending the component), as the component doesn't offer any api method to switch out it's internals (assuming it's the VisualizationViewer) :-)

http://stackoverflow.com/comment/39342507
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25251641
type: Comment
has text: I've updated to take into account the points made by Hot Licks and QuercusMax. I'll update again to include Jon's link. I wasn't aware of that!

http://stackoverflow.com/a/25371223
upvote count: 8
has body: Short answer: EnumSet is not designed to be extended outside of the java.util package. Long answer: EnumSet has two implementations: MiniEnumSet and HugeEnumSet. The mini one is optimized to use a single long to represent values; the huge one uses multiple longs. These classes are 'hidden' inside the JRE so that calling code does not know the difference. This is why the EnumSet provides many static factory methods to create new instances. It is a common design pattern to prevent the fragile base class antipattern. The compiler is telling you that you can't call the super constructor of the class because the developers marked it package-private. Thus you would have to package your code under java.util to call it. The same with the other methods you attempted to override.
type: Answer
accepted answer of: http://stackoverflow.com/q/25371058
type: AcceptedAnswer
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/25371058

http://stackoverflow.com/a/25265553
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25265474
accepted answer of: http://stackoverflow.com/q/25265474
type: Answer
score: 3
has body: ... currency=(EditText)findViewById(R.id.editText1); value=currency.getText().toString(); usa=(TextView)findViewById(R.id.textView1); pak=(TextView)findViewById(R.id.textView2); uk=(TextView)findViewById(R.id.textView3); oman=(TextView)findViewById(R.id.textView4); ksa=(TextView)findViewById(R.id.textView5); eu=(TextView)findViewById(R.id.textView6); ... Move the currency here. You are trying to get currency data without initiating it.
upvote count: 3

http://stackoverflow.com/q/25354756
upvote count: 1
has answer: http://stackoverflow.com/a/25354899
downvote count: 1
favorite count: 0
type: Question
tagged with: model
tagged with: system
has comment: http://stackoverflow.com/comment/70571992
type: UnansweredQuestion
has title: How to know the CPU model like core i7-2600k in java?
has comment: http://stackoverflow.com/comment/39531834
score: 0
tagged with: java
answer count: 1
has body: I know how to get system info but i can not find the cpu model using System.getenv neither Runtime.getRuntime() nor SystemEnvironment.getSystemEnvironment(); how can i do it?
tagged with: cpu

http://stackoverflow.com/q/25289051
type: Question
tagged with: jtabbedpane
has title: How do I split a tab of JTabbedPane into its own window?
answer count: 0
tagged with: jframe
type: UnansweredQuestion
has body: I have an application I've made whose initial GUI consists of a JTabbedPane with multiple tabs. I want to take one of those tabs and separate it from its parent JTabbedPane, making it its own window. Is there a way other than making a new JFrame, copying the tab's contents and then changing all the method calls?
tagged with: swing
has comment: http://stackoverflow.com/comment/39412681
linked to: http://stackoverflow.com/q/18587746
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39411628

http://stackoverflow.com/comment/39466665
type: QuestionComment
has text: No, you can't put one method inside another (short of some weird things with anonymous classes). However, the *class* that contains the *main* method can have as many other methods as one wishes.
comment on: http://stackoverflow.com/q/25318814
type: Comment
score: 1

http://stackoverflow.com/a/25262900
accepted answer of: http://stackoverflow.com/q/25262854
type: AcceptedAnswer
downvote count: 0
upvote count: 7
answers question: http://stackoverflow.com/q/25262854
has comment: http://stackoverflow.com/comment/39430431
score: 7
has body: You need to use assertThat(ids, hasItem(equalTo("id1")); This is because contains will expect you to have a matcher that matches every item in the iterable. If you look at the api docs here You can see the difference between contains and hasItem. If your list was as following: List&lt;String&gt; ids = new List&lt;String&gt;() ids.add("id1"); Your assertion would work as you would expect.
type: Answer
has comment: http://stackoverflow.com/comment/39432614

http://stackoverflow.com/comment/39396285
type: AnswerComment
score: 1
has text: Even if ankur-singhal answer is form related, a controller does not care about **how** the request was constructed, and you can still construct it with javascript or any other scripting language.
type: Comment
comment on: http://stackoverflow.com/a/25277615

http://stackoverflow.com/a/25332757
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39541927
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25329965
has body: I think it's because the field you're mapping to is a primitive type (long). You should use the Wrapper type Long instead.

http://stackoverflow.com/a/25253408
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39369111
downvote count: 0
has body: If all you're doing is adding elements, accessing elements by index and sequentially iterating through elements, why would ArrayList have problems? ArrayList is very efficient at all of those operations. If you're really talking about having an array that is much larger than you can support, heapwise, what you're really talking about is database access. If you think about your array as being a database table with the index of each element being represented in an integer column, this is very easy to implement. If you don't care about latency, you can just create an index for that column in your database and do selects by the indexed column, which is reasonably efficient (though not as fast as accessing a reference in memory, obviously). If you care about latency and can predict beforehand which elements you will probably be accessing, some sort of caching mechanism can easily be made to fit your memory and object access requirements. Unfortunately, I don't have any idea what your latency requirements are and your question doesn't really specify how you will be using this giant array, so this vague asspull is the best I can do.
answers question: http://stackoverflow.com/q/25253350
has comment: http://stackoverflow.com/comment/39347179
type: Answer
has comment: http://stackoverflow.com/comment/39349549

http://stackoverflow.com/comment/39342054
has text: Applets are sort-of discouraged as it's so hard to make them work with browser security. "How to deploy a JavaFX application as an applet" would probably take too much to write as a full SO answer, but there is a deployment guide [here](http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm) which includes applet deployment.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25251168

http://stackoverflow.com/q/25277106
has answer: http://stackoverflow.com/a/25284781
has title: Access Denied - Cannot create a file in a certain directory
upvote count: 3
tagged with: java
tagged with: access-denied
downvote count: 0
tagged with: file
has comment: http://stackoverflow.com/comment/39388999
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39402010
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39402453
has comment: http://stackoverflow.com/comment/39906080
has comment: http://stackoverflow.com/comment/39401626
linked to: http://stackoverflow.com/q/19037339
has answer: http://stackoverflow.com/a/25284662
has body: When I try to create a file in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp, I get the following error: java.io.FileNotFoundException: C:\ProgramData\Microsoft\Windows\Start Menu\Progr ams\StartUp\test.bat (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at Program.testMethod(Program.java:26) at Program.main(Program.java:14) I would like to know why I am getting this error and how to work around it. When I put quotes around the path as suggested below, I get the following error: java.io.FileNotFoundException: "C:\ProgramData\Microsoft\Windows\Start Menu\Prog rams\StartUp\test.bat" (The filename, directory name, or volume label syntax is i ncorrect) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at Program.testMethod(Program.java:26) at Program.main(Program.java:14) Line 26 is: BufferedWriter w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("\"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\test.bat\""), "utf-8"));
score: 3
has comment: http://stackoverflow.com/comment/39388961

http://stackoverflow.com/comment/39512447
has text: Shouldn't you be dividing 10^16 by 3 (since 10^3=1 mod 37), and then dealing with the remainder? I think this gives the correct answer of 1, not 21.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25341839
type: AnswerComment

http://stackoverflow.com/comment/39470892
score: 0
comment on: http://stackoverflow.com/q/25319859
type: Comment
type: QuestionComment
has text: You should start your variable names with lower case letters, and start your classes with uppercase. This is a standard Java convention and will make your code more readable to others.

http://stackoverflow.com/a/25298788
upvote count: 4
downvote count: 0
score: 4
has body: the code works for me. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; public class NewClass { void n() throws FileNotFoundException { File Fileright = new File("/home/ubuntu/Documents/f.txt"); PrintWriter pw = new PrintWriter(Fileright); for (int i = 0; i &lt;= 3; i++) { pw.println(i); System.out.println(i); } pw.close(); } public static void main(String[] args) throws FileNotFoundException { new NewClass().n(); } } output:(in file: /home/ubuntu/Documents/f.txt) 0 1 2 3
answers question: http://stackoverflow.com/q/25298582
type: Answer

android-sdk-tools
tags question: http://stackoverflow.com/q/25379016
tag name: android-sdk-tools
type: Tag

jcombobox
tags question: http://stackoverflow.com/q/25365403
tags question: http://stackoverflow.com/q/25274566
type: Tag
tags question: http://stackoverflow.com/q/25260116
tag name: jcombobox
tags question: http://stackoverflow.com/q/25342435
tags question: http://stackoverflow.com/q/25358545
tags question: http://stackoverflow.com/q/25242372
tags question: http://stackoverflow.com/q/25377813
tags question: http://stackoverflow.com/q/25369248
tags question: http://stackoverflow.com/q/25327766
tags question: http://stackoverflow.com/q/25373449
tags question: http://stackoverflow.com/q/25297909

http://stackoverflow.com/comment/39466806
score: 0
has text: Unfortunately yes, we are constrained to use a DB for this purpose.
type: Comment
comment on: http://stackoverflow.com/a/25318864
type: AnswerComment

http://stackoverflow.com/comment/39351362
type: QuestionComment
comment on: http://stackoverflow.com/q/25240548
has text: @pskink i want to show image from drawable folder.
score: 0
type: Comment

http://stackoverflow.com/comment/39619664
has text: Did you ever find a solution? I'm facing the same problem. It occurs when I try to use (e.g. count) a specific RDD.
comment on: http://stackoverflow.com/q/25254934
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25274256
type: Answer
answers question: http://stackoverflow.com/q/25273610
score: 2
upvote count: 2
has body: Copypaste the contents of the example file as a String variable in the test code I suggest against doing this as it makes modifying the input for your tests more difficult. Also, using an external file makes your tests more flexible. For example, reading an external file allows you to create multiple tests while reusing the basic framework for each test. Of course, this also means that you will need to take some time to design the methods that actually perform the tests.
downvote count: 0

http://stackoverflow.com/a/25273657
answers question: http://stackoverflow.com/q/25272994
has body: Deadlock example: Since two threads (executing instance of an process, or even light weight processes as some operating systems call them) acquire the same lock one of them will always get the lock and the other has to wait until the one that acquired the lock first (this is determined by the JVM, think about the JVM as the operating system - someone has to guarantee atomicity of the lock, that is up to the JVM) finished. In the example one thread will execute bow() followed by a bowBack(), but by the time bowBack() is executed the other thread has performed a acquire on the same lock (by calling bow()), leaving the other thread in a waiting state, which depends on the first thread and the first thread depends on the same lock when calling bowBack() - a circular dependency has occurred, i.e. a deadlock. from the oracle doc: First, it is not possible for two invocations of synchronized methods on the same object to interleave. 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. The example further states that its extremely likely that a deadlock will occur, implying that it does not have to occur. This is because the first thread that got the lock could finish executing its bowBack() before the second thread acquires the lock, i.e. calls bow() (I use acquire the lock as terminology from operating system theory which came up with the original language for this once), it is up to the JVM to decide which thread can execute at what time (the actual scheduling of the threads executing scheme so to say, and changing executing thread (called a context switch) is a bit costly thus the JVM might decide to let the first thread execute for a longer period with the result of a deadlock not occurring). Thinking of thread scheduling one is best of by consider it as a pretty random thing, if a deadlock can occur it sooner or …
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39383092

http://stackoverflow.com/a/25359490
has body: Yes you can. There are two (or more) ways to achieve it. You can use Animal interface/class and use wildcard like this: public static &lt;T extends Animal&gt; void makeAnimalEat(T animal) { animal.eat(); } or use reflection like this: public static &lt;T&gt; void makeAnimalEatReflection(T animal) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { animal.getClass().getMethod("eat").invoke(animal); } Where Animal is interface: interface Animal{ void eat(); } For additional information about generic and wildcards you can visit http://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html
answers question: http://stackoverflow.com/q/25359358
score: 0
type: Answer

http://stackoverflow.com/comment/39419105
score: 0
comment on: http://stackoverflow.com/a/25276171
type: Comment
type: AnswerComment
has text: I have changed the code using "line.split(',')" and tried pypy, but pypy seems slower than generic python.

http://stackoverflow.com/q/25306009
has body: I have an an arraylist called Semesters of Semester objects private ArrayList&lt;Semester&gt; Semesters I wrote the following code to printout a string using the objects(Semester) in the list(Semesters) String report = year + "\n"; for (Semester s : Semesters) { report += s.toString() + "\n"; } Then I got a tip on netbeans where the entire above code can be written in one line like this: String report = year + "\n"; report = Semesters.stream().map((s) -&gt; s.toString() + "\n").reduce(report, String::concat); I am an intermediate java student and I am trying to understand this feature which I find to be very useful but can't quite get my head around it. Please help me understand how these two pieces of code are the same.
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/25306144
type: Question
has title: Understanding functional operator: Lambda
tagged with: java
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25307423
has answer: http://stackoverflow.com/a/25307284
answer count: 3
downvote count: 0
upvote count: 1
tagged with: string
tagged with: lambda

http://stackoverflow.com/q/25278775
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/39392264
downvote count: 1
favorite count: 0
tagged with: jasper-reports
tagged with: java
has comment: http://stackoverflow.com/comment/39431669
has title: JasperReports v5.6.0 crashing Tomcat
has comment: http://stackoverflow.com/comment/39427768
type: Question
has body: We are creating PDFs using JasperReports v5.6.0. It works fine but for the same PDF request JASPER is taking down the whole Tomcat server (production) every second day. Once Tomcat server is restarted then the same PDF starts working fine until next day and then there will be another server crash due to native code i.e.; JASPER We have narrowed it down and found out that JasperFillManager fill (...) method is responsible for the crash. LocalJasperReportsContext ctx = iniJasperReportsContext(request); JasperFillManager fillmgr = JasperFillManager.getInstance(ctx); logger.debug(classAndMethodName + " Before Fill the report with data from dataSource"); JasperPrint jasperPrint = fillmgr.fill(jasperReport, parameters, dataSource); // Fill the report with data from dataSource. This is the method which is responsible for the Crash. Since above crashed the server so Catch and the Finally blocks didn't execute as well and we don't have the exact stacktrace of the issue. Previously we were facing the same crashing issue with JASPER v5.2.0 so we migrated to JASPER v5.6.0 but unfortunately it didn't help. Can you please advise what could be the reason and the possible solution for this severe crashing issue? Our Environment details are as below; java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode) apache-tomcat-7.0.26 JasperReports v5.6.0
answer count: 0
has comment: http://stackoverflow.com/comment/39399600
upvote count: 2
has comment: http://stackoverflow.com/comment/65609288
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/39543952
comment on: http://stackoverflow.com/q/25361420
type: QuestionComment
has text: Why are you trying to avoid the `while(true)`? How are you writing it into the file?
type: Comment
score: 2

http://stackoverflow.com/comment/39342449
has text: @user3218114 I can adapt a solution to another language as long as the regex parsers are similar enough. Also, it's only double-quotes here, but can easily be changed by replacing the regex's quotes with some other character
comment on: http://stackoverflow.com/a/25250834
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25251411
tagged with: java
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25251473
possible better answer: http://stackoverflow.com/a/25252252
has body: i have a problem with my code, the algorithm is correct but i don't understand why the method matrixInverse change the value of matrix.. MatrixInverse return only identity. how can i solve? public class Main { public static void main(String[] args){ double[][] matrix = new double[][]{{ 56, 0, 0, 34, 0, 0}, { 0, 1, 0, 0, 0, 0}, { 0, 0, 1, 0, 0, 0}, { 1, 0, 0, 1, 0, 0}, { 0, 0, 0, 0, 1, 0}, { 0, 0, 0, 0, 0, 1}, }; double[][] inverse = MathUtilities.matrixInverse(matrix); } } method matrixInverse: public static double[][] matrixInverse(double[][] mat) throws ArithmeticException { if (mat.length != mat[0].length) { System.err.println("Matrix is not square"); ArithmeticException e = new ArithmeticException(); throw e; } double[][] matrix = mat; double[][] identity = new double [matrix.length][matrix.length]; //---------------------------------------------------------------------- for(int i = 0;i &lt; matrix.length;++i) { for(int j = 0;j &lt; matrix.length; ++j) { if(i == j) identity[i][j] = 1; else identity[i][j] = 0; } } //---------------------------------------------------------------------- for(int i = 0; i &lt; matrix.length; ++i) { for(int j = i + 1 ; j &lt; matrix.length; ++j) { double constant = matrix[j][i]/matrix[i][i]; for(int k = 0; k &lt; matrix.length; ++k) { matrix[j][k] = matrix[j][k] - (constant * matrix[i][k]); identity[j][k] = identity[j][k] - (constant * identity[i][k]); } } } //---------------------------------------------------------------------- for(int i = matrix.length - 1;i &gt;= 0; --i) { for(int j = i - 1; j &gt;= 0; --j) { double constant1 = matrix[j][i]/matrix[i][i]; for(int k = matrix.length - 1 ; k &gt;= 0; k--) { matrix[j][k] = matrix[j][k] - constant1 * matrix[i][k]; identity[j][k] = identity[j][k] - constant1 * identity[i][k]; } } } //---------------------------------------------------------------------- for(int i = 0 ; i &lt; matrix.length; ++i) { for(int j = 0;j &lt; matrix.length; ++j) { identity[i][j]=identity[i][j]/matrix[i][i]; } }…
upvote count: 0
has answer: http://stackoverflow.com/a/25252252
has comment: http://stackoverflow.com/comment/39346397
score: -1
has title: method change value of object passed to him
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25251473

http://stackoverflow.com/comment/39461527
comment on: http://stackoverflow.com/a/25314390
has text: Typically, I would want to use machine library to process text data, index them and search with Java Lucene library. On front end, among others the main functionality is a search box to accept user's queries using words.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25307586
accepted answer: http://stackoverflow.com/a/25311329
tagged with: heroku
has comment: http://stackoverflow.com/comment/39450740
has answer: http://stackoverflow.com/a/25311329
possible better answer: http://stackoverflow.com/a/39736598
has body: I was recently pointed in the direction of dropwizard and heroku for the relatively easy creation and deployment of restFUL webservices. Having followed the getting started tutorial at http://dropwizard.readthedocs.org/en/latest/getting-started.html I soon had a simple Hello World service running on my localhost, no problems at all. Moving onto trying to deploy this on Heroku I have hit an issue. On deploying the app to heroku, I get an error 2014-08-14T11:34:59.869067+00:00 heroku[web.1]: State changed from starting to crashed 2014-08-14T11:34:59.070364+00:00 heroku[web.1]: Error R10 (Boot timeout) -&gt; Web process failed to bind to $PORT within 60 seconds of launch 2014-08-14T11:34:59.070573+00:00 heroku[web.1]: Stopping process with SIGKILL 2014-08-14T11:34:59.857478+00:00 heroku[web.1]: Process exited with status 137 My Procfile looks like.... web java $JAVA_OPTS -D.http.port=$PORT -jar target/exampleMavenProject-0.0.1-SNAPSHOT.jar server hello-world.yml Which is exactly the same as the command line code to run the app on the local host, with the exception of $JAVA_OPTS -D.http.port=$PORT $JAVA_OPTS is definied within the herkou app config variables; and from my understanding $PORT can't be overridden. And the hello-world.yml doesn't have any extra configuration variables in it other than those required for the dropwizard example template: Hello, %s! defaultName: Stranger Does anyone have any suggestions as to why this doesn't work? Thanks.
type: AnsweredQuestion
score: 3
answer count: 2
has title: Running Dropwizard app on Heroku: R10 failed to bind to $PORT
tagged with: dropwizard
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39450956
downvote count: 0
has answer: http://stackoverflow.com/a/39736598
favorite count: 0
type: Question

http://stackoverflow.com/a/25383343
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25382876
score: 5
answers question: http://stackoverflow.com/q/25382876
upvote count: 5
type: Answer
has body: There is no such "multiwriter" in the standard Java library, but you can create one very easily. The reason for "easily" is because there are only 3 abstract methods in java.io.Writer: close(), flush() and write(char[] cbuf, int off, int len). The default implementation of all other overloads of the write() method call this abstract one. You just have to store the writers you want to forward to and do just that: forward the calls of these 3 abstract methods: class MultiWriter extends Writer { private final Writer[] writers; public MultiWriter(Writer... writers) { this.writers = writers; } @Override public void write(char[] cbuf, int off, int len) throws IOException { for (Writer w : writers) w.write(cbuf, off, len); } @Override public void flush() throws IOException { for (Writer w : writers) w.flush(); } @Override public void close() throws IOException { for (Writer w : writers) w.close(); } }; Note: I know you wanted a PrintWriter, but since our MultiWriter is a java.io.Writer, you can simply pass it to a PrintWriter like this: PrintWriter pw = new PrintWriter(new MultiWriter(writer1, writer2)); Note #2: In my implementation I did not catch exceptions thrown by the writers we forward to. If for example the write() method of a "child" writer would thow an IOException, even if we would succeed to write to other writers, the one that failed will still be failed... If we wanted to handle individual exceptions, we would have to implement a new IOException that could hold a collection of other IOException because multiple "child" writers could fail just as easily.
has comment: http://stackoverflow.com/comment/39585531

http://stackoverflow.com/comment/39345508
score: 0
comment on: http://stackoverflow.com/q/25252422
has text: See also http://stackoverflow.com/a/14216559/545127
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39495316
has text: Thanks for the answer but that didn't fix it either.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25333815
type: AnswerComment

http://stackoverflow.com/a/25345833
accepted answer of: http://stackoverflow.com/q/25345786
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25345786
has body: Well, Jersey is an implementation of JAX-RS, so looking at the JAX-RS specification (downloadable here) first, there is no mention of any XML configuration mechanism. Instead the specification clearly states that it is POJO-based: The API will provide a set of annotations and associated classes/interfaces that may be used with POJOs in order to expose them as Web resources. The specification will define object lifecycle and scope. Reading through the Jersey user guide, it seems that Jersey (as expected) does not add on an XML configuration mechanism of its own. So, it looks like it's going to be annotations all the way. In general, it seems that as far as JavaEE is concerned, XML configuration mechanisms are slowly going the way of the dodo.
type: Answer
has comment: http://stackoverflow.com/comment/39516238

http://stackoverflow.com/a/25324120
has comment: http://stackoverflow.com/comment/66251783
type: Answer
has comment: http://stackoverflow.com/comment/79287989
has comment: http://stackoverflow.com/comment/72469379
has body: You need to put the class where the constructor is called into the @PrepareForTest annotation instead of the class which is being constructed - see Mock construction of new objects. In your case: ✗ @PrepareForTest(MyQueryClass.class) ✓ @PrepareForTest(A.class) More general: ✗ @PrepareForTest(NewInstanceClass.class) ✓ @PrepareForTest(ClassThatCreatesTheNewInstance.class)
has comment: http://stackoverflow.com/comment/93001773
accepted answer of: http://stackoverflow.com/q/25317804
has comment: http://stackoverflow.com/comment/59096241
answers question: http://stackoverflow.com/q/25317804
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39498560
upvote count: 295
score: 295
has comment: http://stackoverflow.com/comment/72466306
has comment: http://stackoverflow.com/comment/73301215

http://stackoverflow.com/comment/39405548
comment on: http://stackoverflow.com/q/25278144
type: Comment
score: 0
has text: Trying Changing Column Definitions was a good idea. Thanks. The Problem was with the database specific directions 'mysql->'. I am might be using it wrongly. But for now I tried removing it and it worked. Thanks for your support. One last thing that I need to know is that How do I Mark this Qauestion as Answered?????? Please Help.
type: QuestionComment

http://stackoverflow.com/comment/39457124
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25312637
has text: You're always starting with `new DateTime()`, which is always the current day (for the JVM's time zone). You'll have to change your starting day to be relative to the previously determined date.

http://stackoverflow.com/comment/39311138
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25234952
type: QuestionComment
has text: i dont know how... :|

http://stackoverflow.com/q/25250119
has answer: http://stackoverflow.com/a/25251513
tagged with: spring-mvc
score: 0
tagged with: java
answer count: 1
type: Question
tagged with: jakarta-ee
has title: Spring MVC: Forward instead of redirect
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39340168
has comment: http://stackoverflow.com/comment/39341968
tagged with: spring
has body: Is it possible to invoke an spring controller/action without redirecting? I do not want the browser to refresh to the new url.

http://stackoverflow.com/comment/39424387
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25295987
type: QuestionComment
has text: Your question is insufficiently specified. What do you mean by "make a file?" Can it be just any ol' file, or does it have a structure?

http://stackoverflow.com/comment/39580324
type: AnswerComment
has text: That is probably a windows feature. Afaik windows internally uses a \r\n for a new line.
type: Comment
comment on: http://stackoverflow.com/a/25378870
score: 0

http://stackoverflow.com/a/25376539
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25364334
type: Answer
has body: I believe, the component that you have created is an input event adaptor, then you can send a event by calling the onEventCall() method of InputEventAdaptorListener class. Please refer [1] for more info.. To get the http url endpoint please refer below documentation [2]. The endpoint url should be as given below, For super tenants - http://localhost:9763/endpoints/&lt;input_adaptor_name&gt;/&lt;topic&gt; or https://localhost:9443/endpoints/&lt;input_adaptor_name&gt;/&lt;topic&gt; [1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/event-stream/event-input-adaptor/org.wso2.carbon.event.input.adaptor.http/1.0.0/src/main/java/org/wso2/carbon/event/input/adaptor/http/HTTPMessageServlet.java [2] https://docs.wso2.com/display/CEP310/Input+HTTP+Event+Adaptor Thanks, Mohan
answers question: http://stackoverflow.com/q/25364334
score: 1

http://stackoverflow.com/comment/39519934
comment on: http://stackoverflow.com/a/25341054
type: AnswerComment
score: 0
has text: I did that, the emulator isn't working anymore, and now there is another error. In the styles.xml file under the directory of values-v21, ... The parent is in red(An error)...
type: Comment

http://stackoverflow.com/a/31696596
has comment: http://stackoverflow.com/comment/75031618
has body: Oke, new project and I'm following this set up a little bit. The problem was : We want to add attachments, but an attachment can be uploading a file, a link or a mail. Pojo classes : Attachment.java : @Entity @Table(name = "T_ATTACHMENT") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "DISCRIMINATOR", discriminatorType = DiscriminatorType.STRING) public abstract class Attachment { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ATTACHMENT_SID") private Long id; @ManyToOne @JoinColumn(name = "TASK_SID", referencedColumnName = "TASK_SID", nullable = false, unique = false, insertable = true, updatable = true) private Task task; @ManyToOne @JoinColumn(name = "USER_SID", referencedColumnName = "USER_SID", nullable = false, unique = false, insertable = true, updatable = true) private User user; public Task getTask() { return task; } public void setTask(Task task) { this.task = task; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } } FileAttachment.java : @Entity @Table(name = "T_FILE_ATTACHMENT") @DiscriminatorValue("FILE") public class FileAttachment extends Attachment { @Column(name = "NAME", nullable = false, unique = false) private String fileName; @Lob @Basic @Column(name = "FILE", nullable = false, unique = false) private byte[] file; public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public byte[] getFile() { return file; } public void setFile(byte[] file) { this.file = file; } } MailAttachment.java : @Entity @Table(name = "T_MAIL_ATTACHMENT") @DiscriminatorValue("MAIL") public class MailAttachment extends Attachment { @Column(name = "RECIPIENT", nullable = false, unique = false) private String to; @Column(name = "CC", nullable = true, unique = false) private String cc; @Column(name = "BCC", nullable = true, unique = false) private String bcc; @Column(name = "TITLE", nullable = true, unique = false) priva…
downvote count: 0
answers question: http://stackoverflow.com/q/25237664
type: Answer
score: 13
upvote count: 13

http://stackoverflow.com/q/25357853
type: AnsweredQuestion
answer count: 2
tagged with: cxf
accepted answer: http://stackoverflow.com/a/25363683
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25363683
upvote count: 1
tagged with: web-services
tagged with: string
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25357973
has comment: http://stackoverflow.com/comment/39538333
has answer: http://stackoverflow.com/a/25357973
has body: I'm using CXF to implement a web services server. Since I'm low on memory I don't want the web service call parameters to be translated strings which are UTF-16 I rather access the original UTF-8 buffers which are usually half in size in my case. So if I have a web method: void addBook(String bookText) How can I get the bookText without CXF translating it to java string?
has title: Getting UTF8 strings directly from the web service call without conversion to String

http://stackoverflow.com/q/25380852
type: AnsweredQuestion
tagged with: sdk
score: 0
tagged with: android
tagged with: java
has body: I have an unexpe`ted problem with my Android project. I have a real android device with ice_cream sandwich installed. My app was working fine during the development but after I added a class to the project, I got an error: Installation error: INSTALL_FAILED_OLDER_SDK The problem is that everything is good in the manifest file. The minSdkversion is 8. Here is my manifest file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="zabolotnii.pavel.timer" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18 " /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="zabolotnii.pavel.timer.TimerActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; I don't know, if there is any need to attach the new class ,but I didn't any changes to other code that should led to this error: package zabolotnii.pavel.timer; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Environment; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.*; import android.widget.*; import java.io.File; import java.io.FilenameFilter; import java.util.*; public class OpenFileDialog extends AlertDialog.Builder { private String currentPath = Environment.getExternalStorageDirectory().getPath(); private List&lt;File&gt; files = new ArrayList&lt;File&gt;(); private TextView title; private ListV…
type: Question
has title: Installation error: INSTALL_FAILED_OLDER_SDK in eclipse
accepted answer: http://stackoverflow.com/a/25380916
answer count: 1
has answer: http://stackoverflow.com/a/25380916
has comment: http://stackoverflow.com/comment/39580717
has comment: http://stackoverflow.com/comment/39580752

http://stackoverflow.com/q/25379550
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/23519202
has comment: http://stackoverflow.com/comment/39581173
tagged with: android
linked to: http://stackoverflow.com/q/3108297
accepted answer: http://stackoverflow.com/a/25379627
has body: I have a small data set in HexaDecimal Representation - byte[] bb = new byte[] { (byte)0x7D, (byte)0x44, (byte)0xCC }; To understand how the values are coming in Decimal Representation, I did the following - Log.i("DECIMAL VALUE of 7D&gt;&gt;", buf[i] + ""); Log.i("DECIMAL VALUE of 44&gt;&gt;", buf[i+1] + ""); Log.i("DECIMAL VALUE of CC&gt;&gt;", buf[i+2] + ""); And what it printed was - DECIMAL VALUE of 7D&gt;&gt; 125 DECIMAL VALUE of 44&gt;&gt; 68 DECIMAL VALUE of CC&gt;&gt; -52 Looking into the site - http://hextodecimal.com/index.php?hex=CC The Decimal Representation of byte CC is 204. In my application I am getting Index Out Of Bounds Exception just because index at -52 doesn't exist in the bounds. So how is this byte coming negative and what is the clear solution.
has comment: http://stackoverflow.com/comment/39586352
tagged with: hex
upvote count: 2
tagged with: decimal
type: AnsweredQuestion
score: 0
downvote count: 2
linked to: http://stackoverflow.com/q/7401550
tagged with: java
has comment: http://stackoverflow.com/comment/39583725
has answer: http://stackoverflow.com/a/25379627
answer count: 1
tagged with: arrays
has title: Wrong Decimal Representation of Hexadecimal Value
has comment: http://stackoverflow.com/comment/39584607
has comment: http://stackoverflow.com/comment/39581374
has comment: http://stackoverflow.com/comment/39584188

http://stackoverflow.com/q/25316012
has title: Log4j - Tomcat ignoring logging events with level below ERROR
tagged with: java
score: 1
tagged with: log4j
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: tomcat7
tagged with: tomcat
tagged with: logging
favorite count: 0
has body: I'm trying to use log4j-1.2.16 in an application. First of all, the application uses GWT. In development the application is deployed in the embedded jetty of the GWT plugin for Eclipse. In development the logging works fine: I can see the log messages in the console as expected (from DEBUG to WARN in stdout and from ERROR to FATAL in stderr as configured - check log4j.xml configuration file bellow). In production the application is deployed in Tomcat 7. In production I want the messages to be logged in the ${catalina.home}/logs/app.log daily rolling file (with level range from INFO to FATAL) plus the stdout and stderr (tomcat.stdout and tomcat.stderr) as mentioned above (check log4j.xml configuration file bellow). The problem is that when I deploy the application in tomcat any log message with level bellow ERROR is not logged (not to the rolling file nor to the stdout). ERROR and FATAL messages are logged correctly though (to the rolling file and to the stderr). Does anyone know why this is happening or have had the same problem? Bellow you can see the log4j.xml configuration file. It looks fine to me and it works in jetty. <throwableRenderer class="org.apache.log4j.EnhancedThrowableRenderer" /> <priority value="ERROR" /> <appender-ref ref="LOGFILE" /> <appender-ref ref="stdout" /> <appender-ref ref="stderr" /> <priority value="ERROR" /> <appender-ref ref="LOGFILE" /> <appender-ref ref="stdout" /> <appender-ref ref="stderr" /> <priority value="ERROR" /> <appender-ref ref="LOGFILE" /> <appender-ref ref="stdout" /> <appender-ref ref="stderr" /> <priority value="ERROR" /> <appender-ref ref="LOGFILE" /> <appender-ref ref="stdout" /> <appender-ref ref="stderr" /> <priority value="DEBUG" /> <appender-ref ref="LOGFILE" /> <appender-ref ref="stdout" /> <appender-ref ref="stderr" /> Thanks in advance. PS: stackoverflow removed the enclosing log4j:configuration tags. File structure is not the problem.

http://stackoverflow.com/a/25361953
downvote count: 1
has comment: http://stackoverflow.com/comment/39547207
type: Answer
answers question: http://stackoverflow.com/q/25361420
has body: You should write either a collection (with a size), or a put a marker before each object: try { for (;in.readBoolean();) { MyObject o = (MyObject) in.readObject(); } } catch (EOFException e) { // ... } When you write your object, write a boolean just before (it will however take 1 byte if I do remember well that part): for (MyObject o : iterable) { out.writeBoolean(true); out.writeObject(o); } out.writeBoolean(false); If iterable is a collection or map, you can use default serialization: out.writeObject(iterable); // default collection serialization Beside, don't catch an exception for each item, catch it globally (especially EOFException!): it is better for performance reasons. I don't know if you work with Java 7, but your code + my for loop can be written like this: try (ObjectInputStream in = new ObjectInputStream(new FileInputStream( filename))) { for (;in.readBoolean();) { MyObject o = (MyObject) in.readObject(); } } catch (EOFException e) { // ... } // no need to close, the try-with-resources do the job for you.
upvote count: 2
score: 1
has comment: http://stackoverflow.com/comment/39545671

http://stackoverflow.com/q/25372660
has body: Using Play, the controller class has several methods with the pattern: public static Promise&lt;Result&gt; getFoo() { Promise&lt;Response&gt; resp = WS.url("/api/foo").get(); return resp.map(new Function&lt;Response, Result&gt;() { @Override public Result apply(Response arg0) throws Throwable { String body = arg0.getBody(); return Results.ok(body); } }); } I considered creating seperate mapping function: private static Function&lt;Response, Result&gt; mapResponse = new Function&lt;Response, Result&gt;() { @Override public Result apply(Response arg0) throws Throwable { String body = arg0.getBody(); return Results.ok(body); } }; So that I can then reuse this in multiple static methods: public static Promise&lt;Result&gt; getFoo() { Promise&lt;Response&gt; resp = WS.url("/api/foo").get(); return resp.map(mapResponse); } public static Promise&lt;Result&gt; getBar() { Promise&lt;Response&gt; resp = WS.url("/api/bar").get(); return resp.map(mapResponse); } Intuitively I think this may cause problems as multiple methods will be reusing the same static mapping method, but I realized that I am not sure of the actual behavior. I am wondering if reusing a static variable could bottleneck concurrent calls, or the JVM will automatically instantiate multiple copies to handle processing in different methods. What are the drawbacks of such an approach, or will it actually work properly? If not, what are my options to reduce the boilerplate mapping code used in multiple methods? Note: I don't think the question above is actually specific to Play but is more of a generic Java coding question, hence not using Play as a tag.
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39566058
type: Question
type: UnansweredQuestion
has title: Reuse static method for Function mapping
tagged with: java
has comment: http://stackoverflow.com/comment/39566958

http://stackoverflow.com/comment/39354888
type: AnswerComment
comment on: http://stackoverflow.com/a/25237635
score: 0
type: Comment
has text: wait I'm sorry ahaha getting crazy here :D hahaha sorry.. I've read it wrong

http://stackoverflow.com/comment/39429485
has text: @PatrickDuncan Please provide a [Short, Self Contained, Correct (Compilable), Example](http://www.sscce.org/).
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25298289
type: AnswerComment

http://stackoverflow.com/comment/39483433
has text: Instead of posting screenshots, could you copy and paste the actual text.
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/25327822

http://stackoverflow.com/a/25234710
has comment: http://stackoverflow.com/comment/39353953
has comment: http://stackoverflow.com/comment/39392716
has comment: http://stackoverflow.com/comment/39314546
has comment: http://stackoverflow.com/comment/39311486
upvote count: 3
has comment: http://stackoverflow.com/comment/39392598
has comment: http://stackoverflow.com/comment/39392746
downvote count: 0
has body: How can I continuously ping the server, to determine if the server is up? Use a timer of some sort to schedule a regular callback and make your test there. Pinging a server (in this context) could be as simply as trying to make a connection to it... You could also use InetAddress#isReachable as well... Why is it when I click the button the server can only receive once Because the server is no longer processing your connection. Take a look at your server code... while(true) { //^Reading the message from the client // Wait for a NEW client connection socket = serverSocket.accept(); // Process request... InputStream is = socket.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String message = br.readLine(); System.out.println(message); String[] received=message.split("~"); console.append(received[1]+": requesting for "+received[0]+"\n"); // ... No longer monitoring for new content... } serverSocket.accept(); is waiting for a NEW client connection, not monitoring existing connections. What you should be doing is spawning of a Thread of some kind, passing a reference to the client Socket connection and processing it there, within it's own loop...providing either a timeout or possible exit condition so that the socket and thread can be closed... Determine when the Server is disconnected Basically, if you try and send something to the server (or client), it will throw some kind of Exception, which is a pretty good indication that the connection has disconnected for some reason. You could, also, use some kind of timer to periodically send a "health" check message to the server, but, you would need to ensure that you are synchronizing your communications, so two (client side) threads don't try and send a message at the same time. Side Note Your current code will block the Event Dispatching Thread when sending messages. This might not be a big thing when you test locally, but, depending on the speed of the conne…
has comment: http://stackoverflow.com/comment/39432588
has comment: http://stackoverflow.com/comment/39392471
has comment: http://stackoverflow.com/comment/39316802
has comment: http://stackoverflow.com/comment/39311817
score: 3
has comment: http://stackoverflow.com/comment/39311846
has comment: http://stackoverflow.com/comment/39312144
has comment: http://stackoverflow.com/comment/39392658
has comment: http://stackoverflow.com/comment/39354013
has comment: http://stackoverflow.com/comment/39319016
has comment: http://stackoverflow.com/comment/39311780
has comment: http://stackoverflow.com/comment/39392612
has comment: http://stackoverflow.com/comment/39315782
has comment: http://stackoverflow.com/comment/39312054
has comment: http://stackoverflow.com/comment/39354590
type: Answer
has comment: http://stackoverflow.com/comment/39392534
has comment: http://stackoverflow.com/comment/39311336
answers question: http://stackoverflow.com/q/25234619
has comment: http://stackoverflow.com/comment/39433455
has comment: http://stackoverflow.com/comment/39392770

http://stackoverflow.com/a/25281068
type: Answer
score: 0
has body: 4 months age, when I tried to generate signed apk with android studio build &gt; Generate Signed APK, google play said this is not signed apk. So here is my solution if the first one still is not working. Open terminal in your project path ./gradlew --gui It should open a window for you In Task Tree tab, click on arrow key beside your project name, to expand it. then inside there, right click on assembleRelease, and select Execute.
answers question: http://stackoverflow.com/q/25280707

http://stackoverflow.com/comment/39331988
has text: E.throw1 is not static in the code you posted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25246357
score: 3

http://stackoverflow.com/comment/39565356
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25354532
has text: Thank you so much! Now things getting in the right place, I appreciate it!

http://stackoverflow.com/comment/39489358
type: AnswerComment
has text: Thanks, I meant should we use Selenium Grid or some other way to host these test on a server and let QA team execute from their browsers?
comment on: http://stackoverflow.com/a/25329985
score: 0
type: Comment

http://stackoverflow.com/comment/41151527
type: Comment
type: AnswerComment
has text: will let you know if I figure this out somehow @albciff
comment on: http://stackoverflow.com/a/26224052
score: 0

http://stackoverflow.com/a/25399850
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25378455
score: 2
has body: I got an answer to this, there are non-printable characters on the database but it is part of data which I can't try to clean or delete them because they are part of data. Retrieving them on a web service will be not allowed because there is no representation of data that is why I'm getting the error "Invalid staring element" to resolve this I have to enable Escaping non printable characters which is a feature introduced from WSO2 DSS 3.1.0 onwards and can be turned on using the WSO2 DSS UI.
answers question: http://stackoverflow.com/q/25378455
type: Answer

http://stackoverflow.com/a/74722428
answers question: http://stackoverflow.com/q/25272391
has body: You could test with MockRestServiceServer. Then it would return mock response, no matter what RestTemplate method or its overloading you use for POST call - postForEntity, postForObject or exchange. For example: @SpringBootTest public class YourServiceTest { @Autowired private YourService yourService; @Autowired private RestTemplate restTemplate; private MockRestServiceServer mockServer; @BeforeEach public void setUp() { mockServer = MockRestServiceServer.createServer(restTemplate); } @Test public void methodWithPostCallTest() { mockServer.expect(ExpectedCount.once(), requestTo(new URI("post-method-url"))) .andExpect(method(HttpMethod.POST)) .andRespond(withStatus(HttpStatus.OK) .contentType(MediaType.APPLICATION_JSON) .body("mock-response-body") ); String response = yourService.methodWhichExecutesPost(); mockServer.verify(); assertEquals("mock-response-body", response); } } More details: Testing Client Applications
type: Answer
score: 0

http://stackoverflow.com/comment/39416824
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25251767
has text: No, I ended up subclassing `NetworkImageView` and fixing the problem within it.
score: 0

http://stackoverflow.com/q/25328174
tagged with: android
has title: Fail to post to URL with "java.lang.IllegalArgumentException: Illegal character in path"
has comment: http://stackoverflow.com/comment/39484422
linked to: http://stackoverflow.com/q/10786042
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/25328215
possible better answer: http://stackoverflow.com/a/25328215
score: 1
tagged with: java
tagged with: url
has answer: http://stackoverflow.com/a/25328569
accepted answer: http://stackoverflow.com/a/25328569
has body: This is my url String serverUrl = http://mob.krill.order-line.co.uk/MobileService.svc/UploadFile/721/Universal Image Loader @#&amp;=+-_.,!()~'%20.png here Universal Image Loader @#&amp;=+-_.,!()~'%20.png is just name of file which is dynamically given to string. HttpPost httpPost = new HttpPost(serverUrl); I get: java.lang.IllegalArgumentException: Illegal character in path at index 76: http://mob.krill.order-line.co.uk/MobileService.svc/UploadFile/721/Universal Image Loader @#&amp;=+-_.,!()~'%20.png what are the remedies?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39484995
answer count: 2
downvote count: 2

http://stackoverflow.com/a/25340810
has body: Ok, the problem was solved. I've made a small mistake in my dispatcher-config.xml: So instead of &lt;mvc:annotation-driven/&gt; &lt;context:component-scan base-package="web.tmh"/&gt; I had to write &lt;mvc:annotation-driven/&gt; &lt;context:component-scan base-package="web.tmh.controller"/&gt; I thought that component-scan worked recursively, but seems like it didn't...
has comment: http://stackoverflow.com/comment/54669254
accepted answer of: http://stackoverflow.com/q/25339451
type: Answer
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/25339451

http://stackoverflow.com/a/56468396
answers question: http://stackoverflow.com/q/25230861
has body: I've this security config for check AuthUser by /public/auth: @Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().authorizeRequests() .antMatchers("/api/skills/**", "/api/profile/**", "/api/info/**").authenticated() .antMatchers("/api/**").hasAuthority(Role.ROLE_ADMIN.getAuthority()) .antMatchers("/public/auth").permitAll() .and().httpBasic() .and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and().csrf().disable(); } @GetMapping(value = "/public/auth") private ResponseEntity&lt;User&gt; getAuthUser(@AuthenticationPrincipal AuthUser authUser) { return authUser == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(authUser.getUser()); }
type: Answer
score: 0

http://stackoverflow.com/comment/39430679
score: 0
has text: If I recall correctly, you can provide webapp specific xml files which will be incorporated into the effective server.xml by Tomcat. You might go through the Tomcat documentation, or the comments in the default server.xml file, to find the details.
comment on: http://stackoverflow.com/q/25288602
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39449353
comment on: http://stackoverflow.com/a/25309586
score: 0
has text: copyLarge has no effect but using Files.copy works fine - it always takes only the time needed for copy (there is no stream closing and the Files.copy itself takes the same time as IOUtils).
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25243615
has comment: http://stackoverflow.com/comment/39331779
answer count: 1
has comment: http://stackoverflow.com/comment/39327535
has comment: http://stackoverflow.com/comment/39327586
type: Question
has comment: http://stackoverflow.com/comment/39328720
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/25246284
has answer: http://stackoverflow.com/a/25246284
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39327572
has body: I saw that version 1.3.0 of libgdx was available so I got it and when I use the project setup to setup a project I check advanced > build for eclipse and hit generate but when I try to import it into eclipse it says no projects found. Version 1.2.0 worked perfectly for me before 1.3.0 was released now I can't even get that version to build eclipse files. Any fixes and I don't use gradle.
linked to: http://stackoverflow.com/q/24031573
has title: Libgdx 1.3.0 doesn't build eclipse files
type: AnsweredQuestion
tagged with: java
score: 0

http://stackoverflow.com/q/25341533
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27728702
has title: Creating instances of a JavaFX Video Player class
tagged with: javafx
linked to: http://stackoverflow.com/q/24611789
downvote count: 0
answer count: 1
upvote count: 1
has body: Fairly new to Java and trying to teach myself a little about JavaFX. I'm trying to create a simple JavaFX video/media player that runs when I click a video file. I want to create the actual player as a separate class that accepts the video file location as an a string argument. When I run the below, public class BLPlayer{ public static void main(String[] args) { if(args.length &gt; 0){ VideoPlayer vp = new VideoPlayer(args); }else{ //showGUI(); } } } public class VideoPlayer extends Application { String path; MediaPlayer player; Scene scene; MediaView view; Group root; Media media; VideoPlayer(String[] args){ path = args[0]; path = path.replace("\\", "/"); launch(args); } @Override public void start(final Stage stage) throws Exception { File f = new File(path); root = new Group(); media = new Media(f.toURI().toString()); player = new MediaPlayer(media); view = new MediaView(player); root.getChildren().add(view); scene = new Scene(root, 400, 400, Color.BLACK); stage.setScene(scene); stage.show(); player.play(); } } I get the error: Exception in Application constructor Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class player.VideoPlayer at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoSuchMethodException: player.VideoPlayer.&lt;init&gt;() at java.lang.Class.getConstructor0(Class.java:2971) at java.lang.Class.getConstructor(Class.java:1812) at com.sun.javafx.application.LauncherImpl$7.run(LauncherImpl.java:790) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298) at java.security.AccessController.doPrivileged(…
favorite count: 0
type: Question

http://stackoverflow.com/a/25258924
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I think the problem you are having is that the authors of the schema chose to make tag1 a local element declaration rather than a global element declaration. If it were a global declaration, you could validate a free-standing tag1 element (people sometimes complain about this feature of XSD, but in your case it's what you want), but since its a local declaration, it is only accessible in the context of its parent envTeste element. Moreover, the envTeste requires other sibling elements to be present, so you can't simply wrap your tag1 in an envTeste prior to validation. In this particular case your local element declaration has no dependencies on other schema components, and there are no namespaces involved so you could extract it textually to form a new schema as others have suggested. In the general case however this will not work. The schema wasn't designed to be used the way you are trying to use it.
answers question: http://stackoverflow.com/q/25250005

http://stackoverflow.com/comment/49777472
type: Comment
score: 0
comment on: http://stackoverflow.com/a/29496098
type: AnswerComment
has text: Yeah, but it's better than getting nothing. :) You can always do a "e.printStackTrace();" inside a catch block that pushes the output to standard out, which should end up in the redirection file (you could force an error condition if needed).

http://stackoverflow.com/q/25286088
has title: SQL Server connection using JDBC - JTDS
type: AnsweredQuestion
has body: I'm using the JTDS driver to communicate with the SQL Server and I'm having trouble managing the connection loss. I am not able to check if connection is dropped. I will detail my problem: This is my method that creates the connection: public synchronized Connection NewConnection (ConnectionParameters params) { try { String url = ""; if (params.getTipoBanco (). equals ("MySQL")) { if (! mySqlDriverLoaded) return null; url = "jdbc:mysql://"+params.getIpServidor()+":"+params.getPorta()+"/"+params.getNomeBanco()+"?user="+params.getUsuario()+"&amp;password="+params.getSenha(); } else if (params.getTipoBanco (). equals ("SQL Server")) { if (! sqlServerDriverLoaded) return null; url = "jdbc:jtds:sqlserver://"+params.getIpServidor()+":"+params.getPorta()+"/"+params.getNomeBanco()+";user="+params.getUsuario()+";password="+params.getSenha(); } else { throw new IllegalArgumentException("Type of database invalid data"); } return DriverManager.getConnection(url); } Catch (Exception e) { e.printStackTrace (); message = "Error in connection:" + e.getMessage (); return null; } } If the server is offline in creating the connection, you can check because a SQLException will be thrown. The problem lies in the connection drop after it is successfully performed: Connection connSqlserver = ConnectionFactory.getInstance().newConnection(paramSqlserver); PreparedStatement stSqlServer = connSqlserver.prepareStatement("select * from operator"); ResultSet rsSqlserver = stSqlserver.executeQuery(); If the connection is dropped before or during the executeQuery(), the application gets locked in the method expecting the connection back. No exception is thrown. I've tried to use the following means to verify the connection drop: 1 DriverManager.setLoginTimeout(x); 2 statement.setQueryTimeout(x); 3 loginTimeout=x parameter in the connection string With none of these got success. If you can give me some more guidance, will be grateful. Thank you!
downvote count: 0
answer count: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25288164
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25288164
tagged with: sql-server
score: 1
tagged with: java
tagged with: jtds
tagged with: jdbc

http://stackoverflow.com/a/25310222
answers question: http://stackoverflow.com/q/25309389
has comment: http://stackoverflow.com/comment/39452804
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: As the id of the view you want appears multiple times in your list, you need to make sure you get the view with that id that appears in the same list item as your TextView. If you change ImageButton editButton = (ImageButton) findViewById(R.id.editButton); to ImageButton editButton = (ImageButton) ((ViewGroup) v.getParent()).findViewById(R.id.editButton); This only searches within the ViewGroup that is the parent of your TextView, so will find the correct instance of R.id.editButton. UPDATE Alternatively, you can change ViewHolder holder = null; to final ViewHolder holder; and then you don't need to have your variable editButton at all, as you can change the code to holder.button.setVisibility(View.VISIBLE); and also call setOnClickListener on holder.button instead of editButton. I'd also move the call to setOnClickListener outside the onLongClick method.
has comment: http://stackoverflow.com/comment/39452510
has comment: http://stackoverflow.com/comment/39453475
accepted answer of: http://stackoverflow.com/q/25309389
type: Answer

http://stackoverflow.com/comment/39609992
has text: We have explicit dependencies. So we declare all our dependencies in a a target and fetch them before we run any builds.we add this folder to our library
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25374568
type: Comment

http://stackoverflow.com/comment/39431129
score: 0
has text: that line is `String filePath = chooser.getSelectedFile().getAbsolutePath();`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25292465

http://stackoverflow.com/q/25340654
upvote count: 1
tagged with: string-concatenation
accepted answer: http://stackoverflow.com/a/25340674
has title: is it possible to get user's input to multiple txtfields [by getText()] and then concatenate it?
has comment: http://stackoverflow.com/comment/39507735
has answer: http://stackoverflow.com/a/25340674
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25340671
has answer: http://stackoverflow.com/a/25340678
answer count: 3
score: 1
has answer: http://stackoverflow.com/a/25340671
has body: is it possible to get user's input to multiple txtfields [by getText()] and then concatenate it? Say, I have 5 txtfields and I would like to get the letter he inputted to each txtfield and then compare it to the right word (it's like a 4pics1word game). String s1 = field1.getText(); String s2 = field2.getText(); String s3 = field3.getText(); String s4 = field4.getText(); String s5 = field5.getText(); if (s1 + s2 + s3 + s4 + s5 == "hello") { lvl++; } Is this even possible? (Lol. Sorry I'm a beginner) And if not, what would you suggest I'd do instead? Thank you
tagged with: java
has comment: http://stackoverflow.com/comment/39507721
favorite count: 0
type: Question
tagged with: concatenation
downvote count: 0

http://stackoverflow.com/comment/39591033
comment on: http://stackoverflow.com/q/25374325
score: 1
has text: You wouldn't have to deal with this if you wrote a simple Java web service that the C++ clients could call to record time. If the C++ clients can send HTTP GET requests to the web service they don't have to know or care what language it's written in.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39388555
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25276846
type: Comment
has text: Your last comment is a bit ambiguous I think. I guess you are meaning that the variable should be a class variable.

http://stackoverflow.com/a/25378979
has body: As already pointed out your code should already work. Additionally you should not make your JLabel public in the NewJFrame class. Declare it as private and access it with getter and setter methods. Something like this: public class NewJFrame extends JFrame{ private JLabel myLabel; public String getMyLabel() { return myLabel.getText(); } public void setMyLabel(String string) { myLabel.setText(string); } } Now you can set your label with: nf.setMyLabel("Set my label to this string");
upvote count: 2
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/25378611
type: Answer

http://stackoverflow.com/q/25373200
score: 1
tagged with: java
tagged with: android-notifications
answer count: 1
downvote count: 0
upvote count: 1
tagged with: notificationmanager
favorite count: 0
type: Question
has body: I am having an issue where, no matter what notification the user touches, I am always receiving the same notification, even though it is cancelled. The first notification a user touches is the only notification that will ever be delivered to my pending intent, until device reboot (then the first touched notification becomes the new Hotel California notification). Here is how I am constructing the notifications: final Bundle extras = new Bundle(); final int notificationId = Integer.parseInt(payload.getObjectId()); extras.putInt(NOTIFICATION_ID, notificationId); final Intent intent = new Intent(context, PushNotificationLauncherActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtras(extras); final NotificationCompat.Builder builder = new NotificationCompat.Builder( context); builder.setContentTitle(context.getString(R.string.app_name)); builder.setContentText(payload.getText()); builder.setSmallIcon(R.drawable.icon_launcher); builder.setAutoCancel(true); final PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0, extras); builder.setContentIntent(pIntent); final Notification notification; if (Build.VERSION.SDK_INT &lt; 16) { notification = builder.getNotification(); } else { notification = builder.build(); } notification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(notificationId, notification); Then I have this in my PushNotificationLauncherActivity: final Bundle extras = getIntent().getExtras(); final int notificationId = extras .getInt(SocialcastGoogleCloudMessageReceiver.NOTIFICATION_ID); final NotificationManager notificationManager = (NotificationManager) this .getSystemService(NOTIFICATION_SERVICE); // please go away notificationManager.cancel(notificationId); Log.d(PushNotificationLauncherActivity.class.getSimpleName(), "Touched notification ID: " + String.valueOf(notificationId)); No matter which notification I touch, in the log Touched notification ID: 1234 will always show, even if the notifi…
tagged with: android
has comment: http://stackoverflow.com/comment/39566990
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3479428
accepted answer: http://stackoverflow.com/a/25373295
has title: Cancelled Notification being redelivered when other notification is touched. Android
tagged with: notifications
has answer: http://stackoverflow.com/a/25373295

http://stackoverflow.com/q/25356928
tagged with: c++
has title: Using DLL's written in C# from Java
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: java
has body: This is my first time working with DLL's and I am at a bit of a loss. Not because I don't understand the code. But because all of the tutorials Im following and they are breaking at some points. First I attempted this, but my work was cut short when the javah command would not work erroring out with the message: Error: Could not find or load main class com.sun.tools.javah.Main I then moved on to make my own ddl's so that I can call them from C a library. Found this video and I was able to follow it and its page on the Microsoft page to make the dll. Note that I am fully capable of following the example. The one part that I struggle with is what happens if I don't have the header file or a lib file to the DLL. So then I started following this example and visual studios is saying that import my not exist. I found that others were able to get the same exact thing working. What am I doing wrong? End goal, I'd like to know how to create a DLL file like in the video. And only with the DLL file in my possession, access its functions. So if the DLL was created with the following: Header namespace nmspace { class myclass{ public: static __declspec(dllexport) void Crap(); }; } Source.cpp #include "Header.h" using namespace std; #include &lt;iostream&gt; namespace nmspace { void myclass::Crap(){ cout &lt;&lt; "Some Crap"; } } How would I call it via LoadLibarary or LoadLibararyA. Note that this did not work for me To read the dll: #include &lt;Windows.h&gt; #include &lt;iostream&gt; using namespace std; void PrintFullPath(char * partialPath) { char full[_MAX_PATH]; if (_fullpath(full, partialPath, _MAX_PATH) != NULL) printf("Full path is: %s\n", full); else printf("Invalid path\n"); } int main(){ HMODULE hMod = LoadLibrary("SimpleDLL.dll"); if (NULL == hMod) { cout &lt;&lt; "LoadLibrary failed\n"; PrintFullPath(".\\"); system("PAUSE"); return 1; } } In the above code, I print out the current working directory. In that directory I have placed my dll. Still the dll is not being …
has answer: http://stackoverflow.com/a/25357241
accepted answer: http://stackoverflow.com/a/25357241
favorite count: 0
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/6031431
tagged with: dll
answer count: 1
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
linked to: http://stackoverflow.com/q/10708782

android-activity
tags question: http://stackoverflow.com/q/25292321
tags question: http://stackoverflow.com/q/25387114
tags question: http://stackoverflow.com/q/25354253
tags question: http://stackoverflow.com/q/25291676
tags question: http://stackoverflow.com/q/25313620
tags question: http://stackoverflow.com/q/25326975
tags question: http://stackoverflow.com/q/25365152
tags question: http://stackoverflow.com/q/25234610
tags question: http://stackoverflow.com/q/25344431
tags question: http://stackoverflow.com/q/25249164
tags question: http://stackoverflow.com/q/25267057
tags question: http://stackoverflow.com/q/25335715
tags question: http://stackoverflow.com/q/25245517
tags question: http://stackoverflow.com/q/25352352
tags question: http://stackoverflow.com/q/25339169
tags question: http://stackoverflow.com/q/25270111
tags question: http://stackoverflow.com/q/25275898
tags question: http://stackoverflow.com/q/25334395
tags question: http://stackoverflow.com/q/25332171
tags question: http://stackoverflow.com/q/25322645
tags question: http://stackoverflow.com/q/25290213
tags question: http://stackoverflow.com/q/25343243
tags question: http://stackoverflow.com/q/25329275
tag name: android-activity
tags question: http://stackoverflow.com/q/25361204
tags question: http://stackoverflow.com/q/25265567
tags question: http://stackoverflow.com/q/25310777
tags question: http://stackoverflow.com/q/25295154
tags question: http://stackoverflow.com/q/25320950
tags question: http://stackoverflow.com/q/25232589
tags question: http://stackoverflow.com/q/25235954
tags question: http://stackoverflow.com/q/25348587
tags question: http://stackoverflow.com/q/25257441
tags question: http://stackoverflow.com/q/25252951
tags question: http://stackoverflow.com/q/25366900
tags question: http://stackoverflow.com/q/25237200
tags question: http://stackoverflow.com/q/25322189
tags question: http://stackoverflow.com/q/25360769
type: Tag
tags question: http://stackoverflow.com/q/25242947

http://stackoverflow.com/a/25354255
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25354048
has body: Going by the spec file://storage/emulated/0/folder1/folder2/hello.html is invalid. storage here should represent a host name. While using the file URI scheme you may choose to ignore the host that represents a path. This is described on the wiki page, which I quote below. A file URI takes the form of file://host/path where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form directory/directory/.../name. If host is omitted, it is taken to be "localhost", the machine from which the URL is being interpreted. Note that when omitting host, the slash is not omitted ("file:///foo.txt" is valid, while "file://foo.txt" is not, although some interpreters manage to handle the latter). My guess is that webView.loadUrl is lenient and accepts file URIs that do not conform to the spec. Uri.fromFile() also provides an example on the right format. Example: "file:///tmp/android.txt"
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25354048
upvote count: 3

http://stackoverflow.com/a/25245723
has comment: http://stackoverflow.com/comment/39330806
has comment: http://stackoverflow.com/comment/39331037
answers question: http://stackoverflow.com/q/25245345
type: Answer
has comment: http://stackoverflow.com/comment/39330958
has body: Use column model to set a renderer for your column. Instead of tbl_patchstand.getColumn(columnnames[actcol]) use tbl_patchstand.getColumnModel().getColumn(actcol) Index must be unique for each column. This should solve your problems.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25245345

http://stackoverflow.com/q/25313155
has answer: http://stackoverflow.com/a/25313435
tagged with: java
score: 4
has title: Java Threading- Am I writing thread-safe code?
has comment: http://stackoverflow.com/comment/39456210
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25313551
has answer: http://stackoverflow.com/a/25313288
type: UnansweredQuestion
tagged with: multithreading
has body: I'm currently trying to get into parallel processing, so to do this, I'm writing a program that processes an image, giving information about its color values overall- I am doing some tests on this one class with a randomly generated array of integers, and 4 threads are running to process every 4th pixel, from their respective starting places. I was just wondering if this read is thread-safe? Can multiple threads read the same data structure if that's what I want? import java.awt.image.BufferedImage; import java.lang.Thread; public class ImageProcessor extends Thread { public static void main(String[] args) { int[] z = new int[10000000]; for (int i = 0; i &lt; 10000000; i++) { double a = (Math.random()*1000000); z[i] = (int) a; } ImageProcessor ip = new ImageProcessor(); ip.imgRGBPercent(z); } public ImageProcessor() { } public void process(int[] x, int startPoint) { (new Thread(new ReadThread(x, startPoint))).start(); } public int[] imgRGBPercent(int[] x) { ReadThread first = new ReadThread(x, 0); ReadThread second = new ReadThread(x, 1); ReadThread third = new ReadThread(x, 2); ReadThread fourth = new ReadThread(x, 3); Thread a = (new Thread(first)); Thread b = (new Thread(second)); Thread c = (new Thread(third)); Thread d = (new Thread(fourth)); long timeMetric = System.currentTimeMillis(); a.start(); b.start(); c.start(); d.start(); try { a.join(); } catch (Exception e) { } try { b.join(); } catch (Exception e) { } try { c.join(); } catch (Exception e) { } try { d.join(); } catch (Exception e) { } int redTotal, blueTotal, greenTotal; redTotal = first.getRGBTotals()[0] + second.getRGBTotals()[0] + third.getRGBTotals()[0] + fourth.getRGBTotals()[0]; blueTotal = first.getRGBTotals()[1] + second.getRGBTotals()[1] + third.getRGBTotals()[1] + fourth.getRGBTotals()[1]; greenTotal = first.getRGBTotals()[2] + second.getRGBTotals()[2] + third.getRGBTotals()[2] + fourth.getRGBTotals()[2]; System.out.println(greenTotal); System.out.println(System.currentTimeMillis() - timeMe…
downvote count: 0
tagged with: image-processing
favorite count: 0
has comment: http://stackoverflow.com/comment/39456120
tagged with: colors
answer count: 3

http://stackoverflow.com/comment/39529835
has text: I did as you suggested and now I am getting _NumberFormatException: For input string: ""_ error. Number column expects int.
type: AnswerComment
comment on: http://stackoverflow.com/a/25352589
score: 0
type: Comment

http://stackoverflow.com/q/25290599
has comment: http://stackoverflow.com/comment/39439236
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39415725
has comment: http://stackoverflow.com/comment/39438099
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39438111
has comment: http://stackoverflow.com/comment/39437985
accepted answer: http://stackoverflow.com/a/25323735
has comment: http://stackoverflow.com/comment/39438158
has comment: http://stackoverflow.com/comment/39438034
has body: I need to inject some JavaScript into my web page that I'm loading into a WebView, but injecting it at onPageFinished is too late and onPageStarted is too soon. Any way I can inject it between this two events? webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); progress.setVisibility(view.GONE); view.loadUrl("javascript:registerObjectDetailsCallback(" + "function(details) {" + "if (details.length == 1) {" + "window.location.href = 'callback:' + escape(details[0]);" + "} else if (details.length &gt; 1) {" + "alert('Error: callback set by registerObjectDetailsCallback was passed multiple selection');" + "}" + "}" + ");"); Log.d("onPageFinished: ", "JavaScript registered."); } }
answer count: 1
has answer: http://stackoverflow.com/a/25323735
has comment: http://stackoverflow.com/comment/39415642
tagged with: javascript
tagged with: webview
has comment: http://stackoverflow.com/comment/39414518
has title: Android WebView inject JavaScript between onPageStarted and onPageFinished
type: Question

http://stackoverflow.com/q/25307945
has answer: http://stackoverflow.com/a/25308065
score: 0
tagged with: list
tagged with: java
has title: String to lists Java
answer count: 1
tagged with: string
type: Question
linked to: http://stackoverflow.com/q/4355046
has body: I am doing XML unmarshalling using java jaxb and converting them into strings and calling the function that stores the string in a sql table. Now I want to store all of string in a list and insert them in a sql table. Based on the length of list, I ll do them bulk insert I don't want to call the table insert function everytime.I need help on modifying the code accordingly XMLInputFactory xif = XMLInputFactory.newFactory(); Reader reader = new StringReader(response.toString()); XMLStreamReader xsr = xif.createXMLStreamReader(reader); while(xsr.hasNext()) { if(xsr.isStartElement() &amp;&amp; xsr.getLocalName().equals("customer")) { JAXBContext jc = JAXBContext.newInstance(Customer.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Customer jb = unmarshaller.unmarshal(xsr,Customer.class).getValue(); String customer_name=jb.getNAME(); String customer_id=jb.getCUSTOMERID(); String entity_id=jb.getENTITY(); System.out.println("Customer Name" +customer_name); System.out.println("Customer ID" +customer_id); System.out.println("Entity ID" +entity_id); String insertStatement = "TABLEINSERT (customer_id, customer_name, entity_id)"; insertStatements.add(insertStatement); } xsr.next(); } if(insertStatements.size() &gt; 10){ TABLEINSERT (customer_id, customer_name, entity_id); } else { System.out.println("Nothing"); } private static void TABLEINSERT (String CustomerID,String CustomerName, String EntityID) { try { System.out.println("Inserting...."); PreparedStatement statement = con.prepareStatement("INSERT INTO intacct_customer (customer_id,customer_name,entity_id) VALUES ( ?, ?,?)"); statement.setString(1, CustomerID); statement.setString(2, CustomerName); statement.setString(3, EntityID); statement.execute(); } catch (Exception e) { System.out.println(e.getMessage()); System.exit(0); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39446771

http://stackoverflow.com/comment/39553114
comment on: http://stackoverflow.com/q/25366168
score: 0
has text: Ah, good point. Its LSB
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39494149
type: QuestionComment
has text: In purely SQL terms, you'd use a white list for keywords. I don't know if spring has some magic to make this easier in a cross-platform way.
score: 0
comment on: http://stackoverflow.com/q/25333102
type: Comment

http://stackoverflow.com/a/25382228
score: 0
answers question: http://stackoverflow.com/q/25382143
type: Answer
has body: Static variables are used in a static context, i.e. a static block or a static method. Instead of creating a static method which will have to be called somewhere, the authors of the tutorial created a static block which will be called when the class is initialized (instead of being called explicitly in a method).

http://stackoverflow.com/comment/39394854
type: AnswerComment
score: 0
has text: 1°) Please support with official documentation 2°) `ServerSocket.setSocketFactory` will set the default factory for the whole application without having to explicitly called the factory
type: Comment
comment on: http://stackoverflow.com/a/25250095

http://stackoverflow.com/comment/39418155
type: Comment
comment on: http://stackoverflow.com/a/25292846
has text: So what exactly does this do for me? What is ANT anyhow? I guess I'm confused, I am starting from a concrete problem - how to run the Java app I made outside Eclipse.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39718106
has text: The expiration parameter is required, but you could set it to a value hundreds of years in the future.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25389602

http://stackoverflow.com/q/25284410
linked to: http://stackoverflow.com/q/19831660
tagged with: gwt
type: AnsweredQuestion
score: 3
upvote count: 3
downvote count: 0
tagged with: java
answer count: 1
tagged with: user-interface
tagged with: smartgwt
has body: I would like to have select all option for a select item where multiple set as true. Can I place it like a button or by using some other components ? I have tried by using some buttons but it doesn't looks good.
has answer: http://stackoverflow.com/a/34604317
has title: SmartGwt Select all option for Selectitem
favorite count: 0
accepted answer: http://stackoverflow.com/a/34604317
type: Question
tagged with: smartgwt-pro
has comment: http://stackoverflow.com/comment/39422274
has comment: http://stackoverflow.com/comment/39432864

http://stackoverflow.com/comment/39417016
score: 0
has text: please see the accepted answer of [what exactly Activity.finish() method is doing?](http://stackoverflow.com/questions/10847526/what-exactly-activity-finish-method-is-doing)
comment on: http://stackoverflow.com/q/25291676
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/115662347
has text: [duct-tape](https://github.com/rnorth/duct-tape/) is another dependency-free alternative to awaitility
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25325830
type: Comment

http://stackoverflow.com/comment/39510763
has text: Needs code. `setBackground()` always worked for me.
score: 7
comment on: http://stackoverflow.com/q/25342528
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25380716
downvote count: 0
has answer: http://stackoverflow.com/a/25385865
has comment: http://stackoverflow.com/comment/39590229
has comment: http://stackoverflow.com/comment/39580576
tagged with: hql
favorite count: 0
has comment: http://stackoverflow.com/comment/39587833
type: Question
has title: hql - Getting error that unexpected token
upvote count: 2
linked to: http://stackoverflow.com/q/9909709
has comment: http://stackoverflow.com/comment/39586781
has comment: http://stackoverflow.com/comment/39585105
has body: I am using Hibernate and I have this query: List list = session.createQuery(" From as Project project where project.properties.pr_id = '4711' ").list(); and this hbm file for Project: &lt;hibernate-mapping auto-import="true"&gt; &lt;class dynamic-insert="true" dynamic-update="true" entity-name="Project" name="de.planta.server.hibernate.pojo.DynamicPojo" table="DT461"&gt; &lt;dynamic-component name="properties"&gt; &lt;property column="`DI041544`" default="0" name="miscel_pay_oblig" type="de.planta.server.hibernate.types.DefaultValueDoubleType" /&gt; &lt;property column="`DI051881`" length="10" name="report_pls_report_id" type="de.planta.server.hibernate.types.DefaultValueStringType" /&gt; &lt;property column="`DI059017`" length="8" name="active_process_phase" type="de.planta.server.hibernate.types.DefaultValueStringType" /&gt; &lt;property column="`DI001001`" length="18" name="pr_id" type="de.planta.server.hibernate.types.DefaultValueStringType" /&gt; ... and this error message, but why ??? 14:51:44.157 ERROR session=33 o.h.hql.internal.ast.ErrorCounter - line 1:23: unexpected token: p 14:51:44.158 ERROR session=33 o.h.hql.internal.ast.ErrorCounter - line 1:23: unexpected token: p antlr.NoViableAltException: unexpected token: p at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3716) [hibernate-core-4.3.4.Final.jar:4.3.4.Final] at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3376) [hibernate-core-4.3.4.Final.jar:4.3.4.Final] at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3248) [hibernate-core-4.3.4.Final.jar:4.3.4.Final] at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2954) [hibernate-core-4.3.4.Final.jar:4.3.4.Final] at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:590) [hibernate-core-4.3.4.Final.jar:4.3.4.Final] at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBasePa…
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39589825
accepted answer: http://stackoverflow.com/a/25385865
has comment: http://stackoverflow.com/comment/39581171
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/39580528

http://stackoverflow.com/a/25381820
type: Answer
score: 0
has body: On Eclipse, go to Window>Preferences>Java>Code Style>Formatter, edit the active profile, and you'll find what you're looking for under the tab Line Wrapping. Then, select all your code (CTRL+A) and use CTRL+Shift+F to format the text using these new setttings.
has comment: http://stackoverflow.com/comment/39584044
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25381397
has comment: http://stackoverflow.com/comment/39583061
accepted answer of: http://stackoverflow.com/q/25381397

http://stackoverflow.com/comment/39595903
type: Comment
comment on: http://stackoverflow.com/a/25311537
type: AnswerComment
has text: You downvoted valid answers that work? I don't see how any of them are confusing. That's kind of a jerk move, IMO.
score: 0

http://stackoverflow.com/q/25249674
has comment: http://stackoverflow.com/comment/39338709
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/39339334
has comment: http://stackoverflow.com/comment/39339115
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/39339634
has answer: http://stackoverflow.com/a/25250090
type: Question
has comment: http://stackoverflow.com/comment/39338359
has title: How to solve StackOverflowError with nested ArrayLists?
has comment: http://stackoverflow.com/comment/39338644
has comment: http://stackoverflow.com/comment/39338433
has comment: http://stackoverflow.com/comment/39339822
tagged with: android
has answer: http://stackoverflow.com/a/25249848
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39339648
has comment: http://stackoverflow.com/comment/39339877
tagged with: memory
tagged with: arraylist
has body: I'm running my project on some Android devices, and I'm getting errors that I think have to do with nested ArrayLists. Here's the basic setup - I have a figure made up of limbs (think of them as nodes). Each node can have more children nodes and so on and so on. So, each Node class has a member ArrayList&lt;Node&gt; childrenNodes containing any number of children Nodes. I can't exactly pinpoint why things go wrong, but after adding ~220 nodes in succession to each other (essentially creating a long string of connected nodes), the app crashes. E/AndroidRuntime(9299): FATAL EXCEPTION: GLThread 674 E/AndroidRuntime(9299): Process: __, PID: 9299 E/AndroidRuntime(9299): java.lang.StackOverflowError E/AndroidRuntime(9299): at __.Node.getSelectedNode(Node.java:283) E/AndroidRuntime(9299): at __.Node.getSelectedNode(Node.java:273) E/AndroidRuntime(9299): at __.Node.getSelectedNode(Node.java:273) E/AndroidRuntime(9299): at __.Node.getSelectedNode(Node.java:273) ...etc The function Node::getSelectedNode iterates down the tree of nodes, originating from the main node, to find which one is being clicked, it looks like this (stripped of unrelated code): public Node getSelectedNode(float x, float y) { Node node = null; // First look through children (look at front-most child first, the last one). // --------------------------------------------------------------------------- for (int i = _childrenNodes.size() - 1; i &gt;= 0; --i) { node = _childrenNodes.get(i).getSelectedNode(x, y); if (node != null) break; } // If still not found, check this node. // ------------------------------------ if (node == null) { // if (this node is being clicked) { node = this; } return node; } So I guess when I call this function, the Stack gets filled up with a ton of calls to getSelectedNode() depending on the number of descendents a node has, leading to a StackOverflowError? Is that right? If so, I really don't know how to go about fixing this, should I not be using an ArrayList? Any advice appreci…

html-parsing
tags question: http://stackoverflow.com/q/25348008
tag name: html-parsing
type: Tag
tags question: http://stackoverflow.com/q/25332240

http://stackoverflow.com/q/25262184
type: UnansweredQuestion
tagged with: jboss
has title: JBoss configuration : Where should JMS Bridge configuration be?
score: 0
has body: I'm new to JMS programming (Java). I have a machine M1, in a domain D1 and a machine M2 in another domain D2. I have in M1 a JMS producer. And in M2 a JMS consumer. Both have as servers JBoss 7.2. So it seems the only solution is to create a JMS bridge. I'm reading the official documentation. So I wonder if creating an SSH tunnel is necessary. Second, in which hornetq-configuration.xml file should I set the following configuration? jms.queue.sausage-factory jms.queue.mincing-machine <filter-string="name='aardvark'"/> <transformer-class-name> org.hornetq.jms.example.HatColourChangeTransformer </transformer-class-name> 1000 true <retry-interval-multiplier>1.0</retry-interval-multiplier> -1 <failover-on-server-shutdown>false</failover-on-server-shutdown> <use-duplicate-detection>true</use-duplicate-detection> <confirmation-window-size>10000000</confirmation-window-size> foouser foopassword remote-connector <!-- alternative to static-connectors <discovery-group-ref discovery-group-name="bridge-discovery-group"/> --> Should it be in the in JBoss server of the JMS producer machine or consumer machine? My third question is, is there a difference in settings between JMS bridge and core bridge? I would be so thankful for any additional information and explainations! Thank you a lot!
tagged with: java
answer count: 1
tagged with: jms
tagged with: hornetq
has answer: http://stackoverflow.com/a/26795050
type: Question
tagged with: jboss-messaging

http://stackoverflow.com/a/25358683
type: Answer
has body: That kind or redirection if normally not the job of the application server (jetty, tomcat, glassfish, etc.), but of a reverse proxy you add on the chain before the servlet of JEE container. Among the most common, you find the excellent Apache HTTPserver, or nginx. For exemple, with Apache httpd, you would use the mod_proxy module and a virtual host : &lt;VirtualHost *:1234&gt; ServerName com.example.myserver RequestHeader set X-Forwarded-Proto "http" ProxyPass / http://com.example.myserver:5678/ ProxyPassReverse / http://com.example.myserver:5678/ &lt;/VirtualHost&gt; Those kink of reverse proxies are currently used to secure application servers : only the proxy is accessible from the outside.
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25278350

http://stackoverflow.com/q/25328155
answer count: 2
has comment: http://stackoverflow.com/comment/39484593
has body: In my application, we are trying to get java.sql.Connection from Spring, Connection conn = DataSourceUtils.getConnection(this.getJdbcTemplate().getDataSource()); I use this connection object to set the prepare statment and execute query to get result set. I am aware of the concept that when we are using jdbcTemplate, the burden of opening the connection, closing the connection etc is taken by spring itself and we don't need to handle in the code explicitly. But I am little bit confused in this case, Since we get the connection object explicitly from the jdbcTemplate, do we need to handle the connection closing also in the code explicitly ? We are using a connection pool. Thanks in advance. BD
type: UnansweredQuestion
tagged with: spring
tagged with: jdbctemplate
score: 0
has comment: http://stackoverflow.com/comment/39485501
tagged with: sql
tagged with: java
has answer: http://stackoverflow.com/a/25329484
has answer: http://stackoverflow.com/a/25328422
tagged with: connection
type: Question
has title: Getting java.sql.connection from Spring jdbc : getJdbcTemplate()

http://stackoverflow.com/comment/39496055
type: AnswerComment
comment on: http://stackoverflow.com/a/25334000
type: Comment
score: 0
has text: Also, if you want your variables from the class callBlockOptions to be static, you will want the class variables to be static, not the class itself. Then you can get and set them with callBlockOptions.variableName without having to instantiate a callBlockOptions object.

http://stackoverflow.com/comment/39343716
score: 0
type: Comment
type: AnswerComment
has text: I tried doing a event like that, but it only works if it's a jframe, which it's not. No idea why it's like that :/ (it's from "Jeu", a open source 2d rpg java game). I'll add that to the Quit button though
comment on: http://stackoverflow.com/a/25252250

http://stackoverflow.com/a/25302637
score: 1
downvote count: 0
has body: synchronised block is used only because of the wait() method. Without it, wait() method would be called over and over again until estimated time expiry. With synchronised block wait() method is executed once(assuming it's not interrupted) Normally you would implement only your application logic there. On the same site you linked, above the sample code, there is a crucial sentence: Creates a work queue that passes one intent at a time to your onHandleIntent() implementation, so you never have to worry about multi-threading.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25301277

http://stackoverflow.com/comment/39575890
score: 1
type: Comment
type: QuestionComment
has text: My guess: field `gid` of class `SHMapTile` is `static`. Is it? Can you share the code for that class?
comment on: http://stackoverflow.com/q/25377855

http://stackoverflow.com/q/25310004
tagged with: jarbundler
type: Question
has comment: http://stackoverflow.com/comment/39449951
has comment: http://stackoverflow.com/comment/39451128
tagged with: ant
has comment: http://stackoverflow.com/comment/39452064
has body: I am trying to bundle my Java application to an Mac OS X .app bundle. I am currently using appbundler and I followed Oracle's guide. The Ant task works fine in Netbeans and the corresponding .app package is built correctly (on Windows). But when trying to execute the .app package to my MacBookPro (OS X 10.7.5), I get the following error in the log: [0x0-0x72072].ch.lawsuite.core.Servitus: Error: Unable to access jarfile LawSuiteSE.jar I already checked the permissions for the .jar file and the execution bits are set for the main-jar and all the jars in the lib-folder. The application just runs fine when typing the following to the terminal: java -jar /Applications/Servitus.app/Contents/Java/LawSuiteSE.jar --installer For clarification, here's the final folder structure: Servitus.app |_Contents |_Java |_LawSuiteSE.jar |_lib |_lib1.jar |_lib2.jar |_subfolder1 |_lib3.jar |_subfolder2 |_lib4.jar |_etc... |_MacOS |_JavaAppLauncher |_PlugIns |_Resources |_en.lproj |_Localizable.strings |_kplus.icns |_Info.plist |_PkgInfo By the way, my application has lots of external dependencies, all located in the "lib" folder which are properly linked by the class-path property within the MANIFEST.MF file of the executable main-jar file "LawSuiteSE.jar". Do I need to copy these libs within the appbundle-ant-task or is it okay to copy them subsequently by hand? I also tried to build the application and the corresponding .app package on the MacBook Pro, but the same error message. Here's my Ant-task: &lt;!-- Define the appbundler task --&gt; &lt;taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"/&gt; &lt;!-- Create the app bundle --&gt; &lt;target name="bundle-macosx"&gt; &lt;bundleapp outputdirectory="macosx" name="Servitus" displayname="Servitus" identifier="ch.lawsuite.core.Servitus" shortversion="1.0" applicationCategory="public.app-category.business" icon="src/ch/lawsuite/data/icons/gmbh/osx/kplus.icns" mainclassname="ch.lawsuite.core.Servitus"&gt; &lt;classp…
has answer: http://stackoverflow.com/a/25312006
accepted answer: http://stackoverflow.com/a/25312006
tagged with: build
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has title: How to bundle a Java application to a Mac OS X *.app bundle?
tagged with: macos

http://stackoverflow.com/comment/39496671
score: 0
has text: maybe try frame.dispose() instead?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25334518

http://stackoverflow.com/q/25291756
tagged with: eclipse
has answer: http://stackoverflow.com/a/25291892
has body: I'm want to execute a Java class through the terminal. When I execute it, I'll need several properties and configuration files that are on a folder X. That folder X has more subfolders with files inside them that I also need. If I simply add the main file to the project in Eclipse as an External Class Folder, everything is in place. With the terminal, I've tried: java -cp FOLDER_X MyClass.class but that doesn't seem to manage to include the subfolder and what's inside them. How should I do this?
score: 0
tagged with: java
tagged with: eclipse-classpath
answer count: 1
tagged with: classpath
tagged with: terminal
type: Question
has title: Set correct Classpath to an External Class Folder on Terminal
type: UnansweredQuestion

http://stackoverflow.com/comment/39316056
score: 0
has text: Please try implementing Serializable interface for your entity (although this is not imposed by Hibernate). Also rename _BankBranchContactId to id. And enable hibernate_sql logging to see the sql query fired. Also check if the schema "stserptest" is created properly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25237147

http://stackoverflow.com/comment/39313581
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25236339
has text: @AndrewThompson oh. Is that not allowed? Well not that I'm seeking a tutor. I just want to know how to do that.

http://stackoverflow.com/a/25251266
accepted answer of: http://stackoverflow.com/q/25251083
answers question: http://stackoverflow.com/q/25251083
type: AcceptedAnswer
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39341779
has body: This error Caused by: java.lang.ClassNotFoundException: org.junit.Assert means that you need junit.jar to be on your classpath when you run your tests.

http://stackoverflow.com/comment/39392829
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25270664
type: QuestionComment
has text: Two suggestions: (1) Check for the maximum value of scaling factors `(radius + radius) - distance) / distance`. Values significantly larger than 1 might appear to throw balls far away from the point of collision. (2) A ball can be bounced more than once, because the position of `ballB` is updated immediately after collision with some `ballA`. A copy of the List should be made, and all collisions for time t should be computed using the old list.

http://stackoverflow.com/comment/39536987
has text: Thanks a lot. I like to play with dcm4che. Is it feasible for HL7 v2.7 messages also?
comment on: http://stackoverflow.com/a/25340708
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25246991
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/39415195
has comment: http://stackoverflow.com/comment/39334021
has comment: http://stackoverflow.com/comment/39335338
upvote count: 3
score: 3
tagged with: java
tagged with: swt
has comment: http://stackoverflow.com/comment/39415801
has comment: http://stackoverflow.com/comment/39413704
favorite count: 0
has answer: http://stackoverflow.com/a/35039468
type: Question
downvote count: 0
type: UnansweredQuestion
tagged with: jface
has body: I am developing a flashcard application using eclipse. I have a TreeViewer in a ViewPart, and I use it to display various categories. However, I cannot find a way to process a background click event. I do not have much experience with eclipse development, so maybe background is the wrong word. I need something like this: TreeViewer.setOnBackGroundClickListener(new ClickListener() {}); Screenshot
has comment: http://stackoverflow.com/comment/39381571
answer count: 1
has title: Eclipse TreeViewer/ViewPart background click

http://stackoverflow.com/q/25350724
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41512053
has comment: http://stackoverflow.com/comment/41540608
tagged with: android
has body: I'm trying to upload a file to a web-service that is protected with SSL and requires a client-side certificate (signed by an in-house CA). The communication to the web-service works well (Downloading files, Querying, running commands and performing all sorts of POSTs works well as expected), except for uploading files. When uploading files I get an SSLException (javax.net.ssl.SSLException) that says "Write error: ssl=0x5fe209c0: I/O error during system call, Connection reset by peer". I have created a duplicate server and removed the SSL and Client-Certificate requirements, and tried to upload over 'vanilla' HTTP, and it works perfectly. I've tried using setFixedLengthStreamingMode(int) and setChunkedStreamingMode(int) without success. When using them, the exception is thrown from the write method, and when not using any of them, the same exception is thrown from the call to getResponseCode(). I couldn't find anything about the error in the server's EventVwr. Our other client (iOS client) is able to upload files there, so it must be something that I do - but I can't figure out what. I'm not sure how to debug this issue further. Please help. Edit 1 We've done a lot of debugging efforts, and found that: Small files are uploaded as expected (44kb is the size of the largest file that was uploaded successfully, and it uploaded in ~1200ms). An 46kb file failed to upload. The failure took ~2 minutes (134120ms). Edit 2 After what you'll read in the remarks, now I got Fiddler to play nice (Thanks to this question). Fiddler got the file, but did not succeed in sending it. The requests (raw) looks like: POST https://192.168.2.2/rest/transfer/strong/Upload/Full?Path=%5C20140807_113255_20.jpg&amp;Root=2 HTTP/1.1 SessionToken: 1234 // We use this for session management FileMetadata: {"FileSize":"1315496","FileName":"GrumpyCat.jpg"} Connection: Keep-Alive User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.1.1; GT-N7100 Build/JRO03C) Host: 192.168.2.2 Accept-Encoding: gzip Content-Type:…
has comment: http://stackoverflow.com/comment/39658637
tagged with: ssl
has comment: http://stackoverflow.com/comment/41783145
has comment: http://stackoverflow.com/comment/41759708
has comment: http://stackoverflow.com/comment/39667690
tagged with: ssl-certificate
score: 25
upvote count: 25
has answer: http://stackoverflow.com/a/26648627
has comment: http://stackoverflow.com/comment/39616344
linked to: http://stackoverflow.com/q/9046593
answer count: 2
has comment: http://stackoverflow.com/comment/39546633
downvote count: 0
has answer: http://stackoverflow.com/a/41552513
has comment: http://stackoverflow.com/comment/39524994
tagged with: java
linked to: http://stackoverflow.com/q/16862916
has comment: http://stackoverflow.com/comment/41840931
has comment: http://stackoverflow.com/comment/39617701
has comment: http://stackoverflow.com/comment/40584622
has title: Uploading a file over SSL with Client Side Certificate and Android's HttpsURLConnection
has comment: http://stackoverflow.com/comment/40675693
tagged with: https
favorite count: 0
has comment: http://stackoverflow.com/comment/41511508
has comment: http://stackoverflow.com/comment/41901388
has comment: http://stackoverflow.com/comment/39547346
type: Question
has comment: http://stackoverflow.com/comment/41906826
has comment: http://stackoverflow.com/comment/39641011

http://stackoverflow.com/q/25362255
tagged with: fuseki
possible better answer: http://stackoverflow.com/a/25362462
type: AnsweredQuestion
tagged with: semantic-web
score: 0
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25364461
has answer: http://stackoverflow.com/a/25364461
has comment: http://stackoverflow.com/comment/39548513
has answer: http://stackoverflow.com/a/25362462
has body: I am using Ubuntu 14.04, but I think this question and its answers could be relevant to a beginner in Jena Fuseki using any operating system (if adapted slightly). I am trying to install Jena Fuseki, however, the instructions in all the tutorials I have found and on the website are unclear to me. I downloaded this file jena-fuseki-1.1.0-distribution.tar.gz and unzipped it into my home directory. I then ran the following commands: cd jena-fuseki-1.1.0 mkdir dataDir chmod +x fuseki-server s-* fuseki-server --update --loc=dataDir /myDataSet However this was the output in my terminal after the last command: fuseki-server: command not found I suspect there is something I haven't installed, but require to get this working. i.e. Do I need Java on my machine? Do I need Apache? Do I need Apache Jena? Or perhaps it is something entirely different that I am missing. Keep in mind I am a beginner, so skipping over the obvious will not help me.
type: Question
linked to: http://stackoverflow.com/q/11141889
tagged with: jena
has title: What perquisites, if any, are there for installing Jena Fuseki?

http://stackoverflow.com/a/25375512
score: 0
answers question: http://stackoverflow.com/q/25375431
has comment: http://stackoverflow.com/comment/39607514
has comment: http://stackoverflow.com/comment/39571456
has body: Cast level to int. Use / for integer division by 10, yielding 0, 1, 2 .. 10. Multiply by 10 to get 0, 10, 20 .. 100. double level = ... ; // level is between 0.0 and 100.0 inclusive. int progressBarValue = ((int)level / 10) * 10;
has comment: http://stackoverflow.com/comment/39571610
type: Answer
has comment: http://stackoverflow.com/comment/39571765
has comment: http://stackoverflow.com/comment/39571819

http://stackoverflow.com/comment/39367781
comment on: http://stackoverflow.com/q/25265474
type: QuestionComment
has text: @Talib look to the answer of bbz you try to get the currency value, before you get the curreny field.
score: 0
type: Comment

http://stackoverflow.com/q/25248969
tagged with: google-maps
has title: MapFragment inside ViewPager crash on change orientation
type: UnansweredQuestion
tagged with: android
has body: When I change the orientation of the screen the application crashes. Error is in map.java, line 23. In fact if I delete this line, the application does not crash when I change the orientation of the screen, but in stead crashes if I go to Tab3 and then return back to the Map(Tab). Does anyone know a solution to this problem? MainActivity.java package com.example.map; import com.example.map.TabsPagerAdapter; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.app.ActionBar; import android.app.FragmentTransaction; import android.app.ActionBar.Tab; import android.os.Bundle; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Map", "Tab2", "Tasb3" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayShowTitleEnabled(true); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this)); } viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } @Override public void onTabReselected(Tab arg0, FragmentTransaction arg1) { // TODO Auto-gene…
has comment: http://stackoverflow.com/comment/39341582
tagged with: fragment
answer count: 2
has comment: http://stackoverflow.com/comment/39341127
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25326277
downvote count: 0
tagged with: screen-orientation
upvote count: 1
has comment: http://stackoverflow.com/comment/39337241
favorite count: 0
has answer: http://stackoverflow.com/a/25251357
type: Question

http://stackoverflow.com/a/25405920
has comment: http://stackoverflow.com/comment/39711559
has comment: http://stackoverflow.com/comment/39695651
has comment: http://stackoverflow.com/comment/39629530
has comment: http://stackoverflow.com/comment/39711252
accepted answer of: http://stackoverflow.com/q/25384939
has comment: http://stackoverflow.com/comment/39721032
type: Answer
has comment: http://stackoverflow.com/comment/39656552
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/39708483
has body: I had a similar problem. I donwload all the smack github I import smack.jar from /lib/ and add the 3 java files from /src/main/java/org/jivesoftware/smack/ I tried to fix it by importing smack-bosh-3.2.2-jar-with-dependencies.jar from /target/. I don't know why this diddn't work. Finally, I read here that you need to download all the dependencies libraries : jbosh-0.6.0.jar xlightweb-2.5.jar xSocket-2.4.6.jar xpp3-1.1.3.3.jar dom4j-1.6.1.jar So I used smack.jar from /lib/ with all thoses libraries and this problem was solved. As i said in comments, you need after to retreive RID. I used jbosh sources and add following lines : In com.kenai.jbosh.BOSHClient class //I introduced a new property private Long rid; //commented the following code //long rid = requestIDSeq.getNextRID(); //and at that place added this.rid = requestIDSeq.getNextRID(); //and finally added a new getter for rid public Long getRid() { return rid;} Then in smack-bosh : In BOSHConnection.java public Long getRid() { return client.getRid();} public String getSid() { return sessionID;} Now I'm blocked cause my session is disconected. According to my openFire logs, it's because of overactivity. So I'm looking for a solution to reduce the number of presence messages.
has comment: http://stackoverflow.com/comment/39799468
has comment: http://stackoverflow.com/comment/39633010
has comment: http://stackoverflow.com/comment/39720995
has comment: http://stackoverflow.com/comment/39690139
downvote count: 0
has comment: http://stackoverflow.com/comment/39767542
has comment: http://stackoverflow.com/comment/39708623
answers question: http://stackoverflow.com/q/25384939
type: AcceptedAnswer

http://stackoverflow.com/comment/39425777
has text: What should be preferred way here? is declaring the helperMethod as private a good way?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25296224
type: Comment

http://stackoverflow.com/comment/39501200
type: QuestionComment
type: Comment
has text: Make the class names start with capital letters and be camel case e.g. "Account" or "BankMain". Are you sure you want to use `if(choice == "ex")` this tests for reference equality, not value. What is `account.balance()` I don't see a balance method, did you mean `getBalance()`? If you want to edit and add the syntax errors you are getting people will be more inclined to help.
score: 0
comment on: http://stackoverflow.com/q/25336914

http://stackoverflow.com/comment/39651163
score: 0
type: Comment
has text: Thanks for the answer. I actually figured out the problem. Another part of the app is actually wiping out the truststore path which causes the SSL communication to fail.
type: AnswerComment
comment on: http://stackoverflow.com/a/25394695

http://stackoverflow.com/comment/39464634
type: Comment
has text: OMG! Thank you thank you thank you! Is there a short answer why "==" would work for newline, but not for others? No big deal, I can always look it up later. Cheers.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25317667

http://stackoverflow.com/comment/39540198
comment on: http://stackoverflow.com/a/25358915
has text: @RuchiraGayanRanaweera The OP is **not** asking for how to use recursion, he is asking for how to repeat the promt for the file name. As I explained in the comment to your answer, recursion is a bad solution for solving this problem. Also, the explicit check is flawed as I explained in a comment to another answer.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/39385269
type: Comment
score: 0
type: AnswerComment
has text: Hello, thank you for your answer, but if I wanted `foo` to be a String, it will not throw any Exception.
comment on: http://stackoverflow.com/a/25274159

http://stackoverflow.com/a/44402678
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25311536
has body: Add configuration below would solve the problem! spring.velocity.prefer-file-system-access=false spring.velocity.prefix=/templates

http://stackoverflow.com/comment/93001773
type: Comment
comment on: http://stackoverflow.com/a/25324120
type: AnswerComment
has text: @gdbcool Sonarqube just parses coverage results provided to it. You need to look into which coverage tool you're using (Clover, Cobertura, JaCoCo, etc) and investigate whether PowerMockito is supported in the version you're using. If it's not, look into upgrading / converting to something that supports it. As noted above, Clover is one option that works.
score: 0

http://stackoverflow.com/comment/39306664
has text: Why does storing a data exception object with PK of 0 trigger a database grab? Also if I didnt want to use a set, is there something else I could use?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25232700

http://stackoverflow.com/q/25377944
has answer: http://stackoverflow.com/a/25384490
tagged with: web-services
tagged with: wsdl2java
has body: I used cxf's wsdl2java to create the java stubs to use an external webservice and it uses dates as XMLGregorianCalendar, where in the wsdl they are xs:date. Having looked it up this does seem correct. I am able to call the web service with no problems, but when I send a date, the copy of my request that comes with the response always has -2,147,483,648 in the hours, minutes, seconds and timezone fields, making my date very wrong! As the webservice is meant to be responding with data that matches my request, it is of course giving me the wrong information. I am working on viewing what I actually send out (see Viewing SOAP request from Java client) but can't download any extra software and am having trouble with handlers. As far as debugging the java goes, I am not sending out these values from java, but I can't tell if it is a conversion issue in my generated java to soap request conversion or if it is at the external service. Does anyone have any advice for debugging this problem, or has anyone seen this before with wsdl2java and XMLGregorianCalendar to xs:date?
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/25327807
tagged with: java
answer count: 1
tagged with: wsdl
tagged with: soap
type: Question
has title: XMLGregorianCalendar hours maximum negative integer on conversion to xs:date
accepted answer: http://stackoverflow.com/a/25384490

scroll
type: Tag
tag name: scroll
tags question: http://stackoverflow.com/q/25360048
tags question: http://stackoverflow.com/q/25346803
tags question: http://stackoverflow.com/q/25290277
tags question: http://stackoverflow.com/q/25264419

http://stackoverflow.com/q/25280707
score: 0
has body: I just Installed the latest version of Android Studio and I noticed that I can't create a signed APK, it just create a file named "app-release.apk" which can't be installed(In the phone).
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25281068
has answer: http://stackoverflow.com/a/25280800
has comment: http://stackoverflow.com/comment/39610931
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: apk
has title: How to create a Signed APK on the latest version of Android Studio

http://stackoverflow.com/comment/39566368
type: Comment
score: 0
type: QuestionComment
has text: Very much related: http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
comment on: http://stackoverflow.com/q/25372876

http://stackoverflow.com/a/25287664
score: 0
type: Answer
has body: Your CSV source has a problem, change your csv source file as the following "4728", "1" ,"369" , "37128682" , "Gomez, Joanne" I believe OpenCSV can handle it well.
answers question: http://stackoverflow.com/q/25285296

http://stackoverflow.com/a/25353336
type: AcceptedAnswer
downvote count: 0
upvote count: 1
score: 1
has body: I finally figured out how to mock a bean properly at run time that takes constructor parameters. The complexity here lies in that the bean is scoped to a prototype so I had to do some reading on the IoC container inside of spring. I hope that this helps anyone that may be as confused as I was when I started down this path. This is my testApplicationContext.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;bean name="serviceLocator" class="com.maddonkeysoftware.donkeydesktopmonitor.MockBeanProvider"&gt; &lt;!-- inject any dependencies required by this locator bean --&gt; &lt;/bean&gt; &lt;bean name="url" factory-bean="serviceLocator" factory-method="fetchMockUrl" scope="prototype"&gt; &lt;constructor-arg value="0"&gt;&lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/beans&gt; Here is the provider. package com.maddonkeysoftware.donkeydesktopmonitor; import java.util.LinkedList; import java.util.Queue; import com.maddonkeysoftware.donkeydesktopmonitor.requests.UrlWrapper; public class MockBeanProvider { private static Queue&lt;UrlWrapper&gt; urlWrapperQueue = new LinkedList&lt;UrlWrapper&gt;(); private MockBeanProvider() {} public static void enqueueMockUrl(UrlWrapper mock){ urlWrapperQueue.add(mock); } public Object fetchMockUrl(String args) { return urlWrapperQueue.poll(); } } Here is the final version of my unit test. @Test public final void baseRequest_PostResponseReturned() throws IOException { // NOTE: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html // Go to the section 4.3.1 and look at the factory for providing c…
accepted answer of: http://stackoverflow.com/q/25308524
type: Answer
answers question: http://stackoverflow.com/q/25308524

http://stackoverflow.com/q/25337182
tagged with: eclipse
type: Question
tagged with: buildpath
has body: I'm having a problem with Eclipse on by Mac OSX Mountain Lion. I have recently installed Android SDK and in my java projects I get the following message: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files Reading about this issue, it would seem that I do not have a valid JRE defined in the build path of my project. Checking the project's build path with Properties > Java Build Path > Libraries I see that The JRE System Library has a red cross next to it. However when I click Add Library... > JRE System Library I get the message: An error has occured. See error log for more details. java.lang.NullPointerException I then try clicking Eclipse > Preferences > Java > Installed JREs and see an empty list. I try to Add... a Standard VM but I cannot find the location of my JRE. /Library/Java/JavaVirtualMachines/ is empty and /System/Library/Frameworks/JavaVM.framework does not exist. Does anyone know how I might fix this problem?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39501513
has title: The type java.lang.object cannot be resolved - Eclipse buildpath not working
downvote count: 0
has answer: http://stackoverflow.com/a/25339381
upvote count: 7
has answer: http://stackoverflow.com/a/38886407
has comment: http://stackoverflow.com/comment/39501547
favorite count: 0
has answer: http://stackoverflow.com/a/30257909
linked to: http://stackoverflow.com/q/12073222
answer count: 3
score: 7
tagged with: java

http://stackoverflow.com/comment/39409948
score: 0
has text: I'm not sure I understand your data model, and you are building a different Object model on top of it. If you have an existing DB and it is using the sequence, I don't see how you can change your object model to start using a composite PK and composite foreign keys. You usually have to use what is there already. And if the DB is using a1 as a unique key, I don't see why the app would start using a1,a2,a3 as one unique key when a1 will do.
type: QuestionComment
comment on: http://stackoverflow.com/q/25267432
type: Comment

google-oauth-java-client
tags question: http://stackoverflow.com/q/25342403
type: Tag
tag name: google-oauth-java-client

http://stackoverflow.com/comment/39517806
score: 0
has text: Why did u specified $1 in code, it was giving me error . Instead I used `origString.replaceAll("(?I)"+texttohighlight,""+texttohighlight+"");` but that changes the highlighted text case in order to match the query.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25325548

http://stackoverflow.com/q/25370974
has title: Third type of jdbc driver(through intermeditae server). How does it work?
has body: I have read following article: http://tutorials.jenkov.com/jdbc/driver-types.html#type-3-jdbc-driver I didn't understand third type of jdbc driver. What the intermediate server? Is it part of my implementation or this server supply with driver or maybe with database? I cannot find this driver type for MS SQL or MySql and thus I cannot try to use it.
tagged with: middleware
tagged with: api
has comment: http://stackoverflow.com/comment/39562874
tagged with: database
upvote count: 1
type: UnansweredQuestion
downvote count: 1
answer count: 1
favorite count: 0
type: Question
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25371025
tagged with: jdbc

http://stackoverflow.com/q/25250526
possible better answer: http://stackoverflow.com/a/25250724
has comment: http://stackoverflow.com/comment/39340158
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39340265
has comment: http://stackoverflow.com/comment/39340045
has answer: http://stackoverflow.com/a/25250724
score: -1
downvote count: 1
favorite count: 0
type: Question
has body: So im making this txt document that a string writes too with diffrent information about 100-2000 lines . From this I want to be able to copy specific parts such as a name and write them too a new file so I was wondering if someone could help do a example I want just name,adress and phone pullout of a string as example downbelow and write it to a file : nameadress=johndoe&amp;adress=newyork163thdowntown&amp;phone=+341431242 basicly I want find nameadress ,adress ,phone copy everything between = and &amp; and so on and if there's garbage data inbetween i want that ignored :) so I only get these :)
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/39340372
has answer: http://stackoverflow.com/a/25250696
linked to: http://stackoverflow.com/q/1129996
has title: Search for specific parts in a string
has comment: http://stackoverflow.com/comment/39340574
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39340146
has comment: http://stackoverflow.com/comment/39340215
accepted answer: http://stackoverflow.com/a/25250696
linked to: http://stackoverflow.com/q/10755365

http://stackoverflow.com/comment/39375732
score: 0
has text: Thank's, for what it's worth for anyone else having the same issue I ended up using a TaskQueue forwarding any messages from "abc" module to "default" module. This however wasn't trivial either (https://code.google.com/p/googleappengine/issues/detail?id=10457). It's working now, however the solution is not perfect since using TaskQueue also means additional quota costs, but I guess this is Google's business model.
comment on: http://stackoverflow.com/a/25243297
type: Comment
type: AnswerComment

http://stackoverflow.com/a/64230719
answers question: http://stackoverflow.com/q/25316691
has body: You can use Zimbra libraries for calling SOAP API: package com.example.test import com.zimbra.common.account.ZAttrProvisioning; import com.zimbra.common.service.ServiceException; import com.zimbra.common.soap.AdminConstants; import com.zimbra.common.soap.Element; import com.zimbra.common.soap.SoapHttpTransport; import com.zimbra.cs.account.AccountServiceException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; public class ZimbraApi { private static SoapHttpTransport soapHttpTransport = null; private String baseUrl = "https://mail.example.com:7071/service/admin/soap/"; public String getAdminToken(String username, String password) { URL url = new URL(baseUrl); soapHttpTransport = new SoapHttpTransport(url.toURI().toString()); soapHttpTransport.setVoidOnExpired(true); Element request = Element.XMLElement.mFactory.createElement(AdminConstants.AUTH_REQUEST); request.addAttribute(AdminConstants.E_NAME, username); request.addAttribute(AdminConstants.E_PASSWORD, password); Element response = soapHttpTransport.invoke(request); String token = response.getAttribute(AdminConstants.E_AUTH_TOKEN); soapHttpTransport.setAuthToken(token); return token; } public void createAccount(String username, String password) { Element request = Element.XMLElement.mFactory.createElement(AdminConstants.CREATE_ACCOUNT_REQUEST); request.addAttribute(AdminConstants.E_NAME, username); request.addAttribute(AdminConstants.E_PASSWORD, password); soapHttpTransport.invoke(request); } }
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39404235
has text: OK thanks. How can I mark this question as solved by you ? (I'm quite new to this forum...)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25282056
score: 0

http://stackoverflow.com/comment/39350121
comment on: http://stackoverflow.com/q/25255811
score: 0
type: QuestionComment
has text: Start by doing a search for `[java] joda time dates between` and `[java] calendar dates between` and see what you come up with...
type: Comment

http://stackoverflow.com/comment/39355543
type: AnswerComment
comment on: http://stackoverflow.com/a/25237635
has text: hm ok sorry... I'll try to fix it first... so does this mean I have to make the server also send a message to the client?
score: 0
type: Comment

http://stackoverflow.com/comment/47052088
comment on: http://stackoverflow.com/q/25335495
has text: @Flo when is the last time you tried this? Have you updated your plugins?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39389464
has text: If I were extending String, wouldn't this be a bit confusing if I needed to do something in the substring method? I would need to know that substring was implemented like this and know to override only the substring with two parameters.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25277377
type: Comment

http://stackoverflow.com/comment/39379917
score: 0
has text: It makes sense if you use it like I described in my edit (in a real use-case).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25271168

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

http://stackoverflow.com/a/25239551
score: 1
downvote count: 0
upvote count: 1
has body: its better (less confusing) to use a single return statement. public Connection OpenDatabase() { Connection conn =null; try { Class.forName( "com.mysql.jdbc.Driver" ) ; conn = DriverManager.getConnection("jdbc:mysql://localhost/promitheas?user=me&amp;password=iwontsay") ; } catch (Exception e) { e.printStackTrace(); } return conn;//returns null in case of exception. }
type: Answer
answers question: http://stackoverflow.com/q/25239413

http://stackoverflow.com/q/25257284
has answer: http://stackoverflow.com/a/25257361
has comment: http://stackoverflow.com/comment/39352986
favorite count: 0
type: Question
has body: I'am checking out apis for the Assert class and found two for that class.(http://junit.sourceforge.net/junit3.8.1/javadoc/junit/framework/Assert.html and http://junit.sourceforge.net/javadoc/org/junit/Assert.html) Is there a reason that these two do not have the same methods? The first one had a assertequals(int a, int b) I was able to call but the second one didn't have that method. I was confused because they are both from the same site and seem to be about the same class.
has comment: http://stackoverflow.com/comment/39353094
accepted answer: http://stackoverflow.com/a/25257361
type: AnsweredQuestion
has title: Why do these two apis for the same site not have the same methods?
tagged with: assert
score: 1
tagged with: java
tagged with: junit
tagged with: javadoc
downvote count: 0
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39352869

http://stackoverflow.com/comment/105697331
comment on: http://stackoverflow.com/q/25382733
type: QuestionComment
has text: Yes, I do know the advantages of ElGamal and Homomorphic encryption and I've actually used them myself. However, PKIX is a widely recognized system. RSA is commonly used for places that need encryption. In that case it makes little sense to define something that is recognized by nobody else, regardless if it is secure or not. That said, I've added an additional link in my answer, in case you want to set up a proprietary PKI, possibly including a few organizations that you'd want to communicate with.
type: Comment
score: 0

http://stackoverflow.com/q/25264168
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39364868
has answer: http://stackoverflow.com/a/25264261
has comment: http://stackoverflow.com/comment/39364945
tagged with: java
has comment: http://stackoverflow.com/comment/39364888
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39365016
type: Question
has title: Not able to get count using JDBC connection
has comment: http://stackoverflow.com/comment/39364913
has body: I'm not able to get the number of rows by making a query. I've used JDBC connection for it. But, rather it doesn't show any error, but it stops executing the process. Here is my code Transaction transaction=null; Connection c = null; Statement stmt = null; ResultSet result; try { Class.forName("org.postgresql.Driver"); c = DriverManager.getConnection( "jdbc:postgresql://192.168.1.7:5432/"+userDB, "postgres", "openerp"); } catch (Exception e) { e.printStackTrace(); System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } int count = 0; try { LOGGER.info("In try of get"); factory = HibernateUtil.connectDB(userDB); LOGGER.info("Connected to DB"); //Open Session session = factory.openSession(); //Begin Transaction transaction = session.beginTransaction(); LOGGER.info("Beginning the transaction"); stmt = c.createStatement(); String sql = "SELECT COUNT(*) FROM mycontent_messages where status = '0'"; count = stmt.executeUpdate(sql); LOGGER.info("successfully got count : "+count); c.commit(); stmt.close(); c.close(); Exception which I'm getting is org.postgresql.util.PSQLException: A result was returned when none was expected. at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:307) at net.vsspl.mycontent.daoimpl.contentImpl.getUnreadCount(contentImpl.java:379) at net.vsspl.mycontent.services.countUnreadMessages.main(countUnreadMessages.java:49) It logs upto "Beginning the transaction". After that it doesn't show anything. Is there any issue in my code?
accepted answer: http://stackoverflow.com/a/25264289
has answer: http://stackoverflow.com/a/25264289
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25264261
has answer: http://stackoverflow.com/a/25264661

http://stackoverflow.com/comment/39617930
has text: Thanks @Victar, your version works. There are subtle differences in the configurations and versions in your POM. I'll move these over to mine. Many thanks.
type: Comment
comment on: http://stackoverflow.com/a/25381423
type: AnswerComment
score: 0

http://stackoverflow.com/a/25342424
has comment: http://stackoverflow.com/comment/39513124
answers question: http://stackoverflow.com/q/25342294
accepted answer of: http://stackoverflow.com/q/25342294
type: Answer
has body: I'd suggest you to subclass very useful Sprite class and use TextureAtlas to contain player textures. here is the stub of implementation: public class Player extends Sprite { TextureAtlas textureAtlas; public Player(TextureAtlas atlas) { super(atlas.getRegions().get(0)); textureAtlas = atlas; } public void setTexture(String textureName) { setRegion(textureAtlas.findRegion(textureName))); } } Here is a very nice tutorial explaining how to use TextureAtlas. Also, instead of implementing whole InputProcessor, use InputAdapter which provides an empty implementation of this interface. This will be much more clearer. It can be a field in your Player class: private InputProcessor inputProcessor = new InputAdapter() { // Override only methods you need here }; Of course, don't forget to register this InputProcessor: Gdx.input.setInputProcessor(inputProcessor);
has comment: http://stackoverflow.com/comment/39512222
score: 0
has comment: http://stackoverflow.com/comment/39577543
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39511701

http://stackoverflow.com/comment/39388375
has text: You're presumably missing some dependencies. Try `mvn eclipse:eclipse` and re-import the project.
type: QuestionComment
comment on: http://stackoverflow.com/q/25276747
type: Comment
score: 4

http://stackoverflow.com/comment/39508321
type: Comment
has text: Also, be careful when you evaluate arithmetic expressions by hand. `2-1 + 2-2`= `1 + 0`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25340791

http://stackoverflow.com/a/25248887
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39338100
answers question: http://stackoverflow.com/q/25248840
has body: The problem is missing curly braces around the else block: although you have indented the block correctly, the indentation does not matter: only the first line item = input.nextLine(); is considered part of else; the remaining ones are executed unconditionally. Note that there is only one place where you set done to true, you could replace the do/while loop with a "forever" loop, and use break to exit the loop in the middle: while (true) { ... if (ans.equals("Done")) { break; } ... } This makes declaring done variable unnecessary.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39338274

http://stackoverflow.com/q/25253260
score: 1
tagged with: eclipse
favorite count: 0
type: Question
has body: I am writing a RCP plugin development application and am getting the following error. I am following the model service pattern demonstrated in Vogella's "Eclipse 4 RCP" book. I have two service plugins that I have created and one of the service plugins is dependent on the other. I am getting the following error when I try to run the application org.eclipse.e4.core.di.InjectionException: Unable to process "IService": no actual value was found for the argument "IServiceImpl()" This happens to be the Plugin that the other plugin depends on. I declared the plugin as a required plugin in the dependent plugin's Manifest file as well as in the feature and main application plugin. I would appreciate any insight as to what may be causing the issue.
answer count: 0
upvote count: 1
type: UnansweredQuestion
has title: RCP Plug in development- org.eclipse.e4.core.di.InjectionException: Unable to process "": no actual value was found for the argument ""
has comment: http://stackoverflow.com/comment/39355156
tagged with: java
downvote count: 0
tagged with: rcp
has comment: http://stackoverflow.com/comment/39369450

http://stackoverflow.com/a/59631475
answers question: http://stackoverflow.com/q/25237176
type: Answer
has body: I confirm that this problem still exists in 2020, when testing in an emulator and having WiFi enabled, this error consistently appears (even with Android 10). Switching off WiFi in the emulator seems to solve the problem.
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/114541551

http://stackoverflow.com/q/25378778
type: UnansweredQuestion
tagged with: swt
has title: swt section disable collapse
has answer: http://stackoverflow.com/a/25379934
tagged with: java
has comment: http://stackoverflow.com/comment/39577471
answer count: 1
tagged with: eclipse
score: 0
type: Question
has body: How can i disable collapse for section element. Client element should be enabled. I have one option, but it looks not good. timeSettingsSection.addExpansionListener(new IExpansionListener() { @Override public void expansionStateChanging(ExpansionEvent e) { } @Override public void expansionStateChanged(ExpansionEvent e) { if (!e.getState()) { timeSettingsSection.setExpanded(true); return; } if (stopSection.isExpanded()) stopSection.setExpanded(false); if (cabinTypeSection.isExpanded()) cabinTypeSection.setExpanded(false); if (airlinesSection.isExpanded()) airlinesSection.setExpanded(false); sectionExpanded(); useDepartTime.setFocus(); } }); Yes it is org.eclipse.ui.forms.widgets.section timeSettingsSection = getToolkit().createSection(mainGroup, Section.LEFT_TEXT_CLIENT_ALIGNMENT | Section.TWISTIE); timeSettingsSection.setText("Time"); GridUtils.fillHorz(timeSettingsSection); Composite group = getToolkit().createComposite(timeSettingsSection, SWT.NONE); GridUtils.gridLayoutObj(group).numColumns(3).noMargins(); getToolkit().paintBordersFor(group); timeSettingsSection.setClient(group);

http://stackoverflow.com/comment/39500947
comment on: http://stackoverflow.com/q/25336811
type: Comment
type: QuestionComment
has text: Without the stack trace you are basically giving the keys to the mechanic and telling him "something is wrong" and walking away.
score: 0

http://stackoverflow.com/comment/39493322
type: QuestionComment
comment on: http://stackoverflow.com/q/25329588
has text: Actually anotherMethod() was invoked successfully. And it printed a message only once.
type: Comment
score: 0

http://stackoverflow.com/comment/39320455
type: Comment
has text: You should make sure you do not pass a `null` value for the `samples` parameter.
type: AnswerComment
comment on: http://stackoverflow.com/a/25239503
score: 0

http://stackoverflow.com/q/25372599
has comment: http://stackoverflow.com/comment/39566227
tagged with: internet-radio
tagged with: media
has comment: http://stackoverflow.com/comment/39589545
has comment: http://stackoverflow.com/comment/39566097
tagged with: java
tagged with: javafx
has body: Im trying to make an App that streams an online radio (http://syl.mooo.com:9000/stream) (No Life Radio) but MediaPlayer won't react, if i check the status it says UNKNOWN. What am i doing wrong? My code: @Override public void run() { final CountDownLatch latch = new CountDownLatch(1); SwingUtilities.invokeLater(new Runnable() { public void run() { new JFXPanel(); // initializes JavaFX environment latch.countDown(); } }); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } Media media = new Media("http://syl.mooo.com:9000/stream"); mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay(true); } } } App only consists on a button that says "Play" EDIT: After adding error handling i got: MediaException: UNKNOWN : [com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer@b1f29c7] ERROR_MEDIA_INVALID: ERROR_MEDIA_INVALID at javafx.scene.media.MediaException.getMediaException(MediaException.java:160) at javafx.scene.media.MediaPlayer$_MediaErrorListener.onError(MediaPlayer.java:2660) at com.sun.media.jfxmediaimpl.NativeMediaPlayer$EventQueueThread.HandleErrorEvents(NativeMediaPlayer.java:685) at com.sun.media.jfxmediaimpl.NativeMediaPlayer$EventQueueThread.run(NativeMediaPlayer.java:41 9) Addded code: @Override public void run() { .... media = new Media("http://radio.nolife-radio.com:9000/stream"); if (media.getError() == null) { media.setOnError(new Runnable() { public void run() { System.out.println("error media"); } }); } mediaPlayer = new MediaPlayer(media); if (mediaPlayer.getError() == null) { mediaPlayer.setOnError(new Runnable() { public void run() { mediaPlayer.getError().printStackTrace(); } }); mediaPlayer.setAutoPlay(true); } } Also, sometimes it makes java crash with: APPCRASH fxplugins.dll EDIT2: it seems that shoutcast isnt supported by javafx (Streaming audio/radio in Java?) so i will try JLayer (http://www.javazoom.net/projects.html) now and update again.
type: Question
has title: JavaFX MediaPlayer status Unknown (streaming from http) Mpeglayer3
answer count: 0
linked to: http://stackoverflow.com/q/10438351
type: UnansweredQuestion
score: 0
tagged with: audio-streaming

http://stackoverflow.com/comment/39402205
has text: @Antony take a look at my answer. It should cover your examples.
score: 0
comment on: http://stackoverflow.com/a/25284216
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39362850
comment on: http://stackoverflow.com/a/25262792
type: AnswerComment
has text: @user49193 `num1` will be assigned the current value of `v.first.size()`. It's hard to provide more specific advice in your case, since your code example doesn't compile.
score: 0
type: Comment

http://stackoverflow.com/a/25266441
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25266320
has body: You have to use an extra Dateformat to parse the input: String testDate = "20140812163222"; SimpleDateFormat inDateFormet = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat setDateFormet = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); .... Date parseDate = inDateFormet.parse(testDate); String resultdate = setDateFormet.format(parseDate);
accepted answer of: http://stackoverflow.com/q/25266320
type: Answer
score: 2

http://stackoverflow.com/q/25371351
accepted answer: http://stackoverflow.com/a/25373305
tagged with: java
has comment: http://stackoverflow.com/comment/39564630
has answer: http://stackoverflow.com/a/25373305
linked to: http://stackoverflow.com/q/273452
tagged with: c#
has comment: http://stackoverflow.com/comment/39563636
has title: Encrypt data in windows phone 8 using AES if I already have the key (as a string)
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39563541
tagged with: encryption
answer count: 1
upvote count: 1
tagged with: windows-phone-8
downvote count: 1
favorite count: 0
type: Question
has body: I am working on a wp8 app that requires encryption and decryption. Actually I need a way to encrypt some data using AES. I already have the key(as a string). I need a c# equivalent for the below java code can somebody help? public static String encryptWithAES(String payload, String aesKey) { byte[] raw = aesKey.getBytes(); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES/ECB/PKCS5Padding"); try { Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted; encrypted = cipher.doFinal(payload.getBytes()); cipher = null; return Base64.encodeToString(encrypted, Base64.DEFAULT); } catch (Exception e) { System.out.println("Error in encryptWithAES!!!"); e.printStackTrace(); } return null; } Here is what i did : public static byte[] EncryptWithAES(string dataToEncrypt, String Key) { byte[] encryptedData; byte[] keyBytes = System.Text.Encoding.UTF8.GetBytes(Key); using (AesManaged aesEnc = new AesManaged()) { aesEnc.Key = keyBytes; aesEnc.IV = new byte[16]; //Create encryptor for converting ICryptoTransform encryptor = aesEnc.CreateEncryptor(aesEnc.Key, aesEnc.IV); using (MemoryStream memStream = new MemoryStream()) { using (CryptoStream crypStream = new CryptoStream(memStream, encryptor, CryptoStreamMode.Write)) { using (StreamWriter srmWriter= new StreamWriter(crypStream)) { srmWriter.Write(dataToEncrypt); } encryptedData = memStream.ToArray(); } } } return encryptedData; } The error I am getting is where i set the key: ie aesEnc.Key= keyBytes;

http://stackoverflow.com/comment/39392808
type: Comment
comment on: http://stackoverflow.com/a/25278863
type: AnswerComment
score: 1
has text: That worked, one more question, how can i chech if that int is number? because I get int from that substring but it may also be normal character.

http://stackoverflow.com/q/25230297
has answer: http://stackoverflow.com/a/25230484
has title: parse string array to get integer value in java
has comment: http://stackoverflow.com/comment/39301073
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25230515
tagged with: int
score: 0
answer count: 2
upvote count: 2
has body: I have an string like"2=33=file". I can get the first number from the string by char[] cArray = new char[4]; int nValue = Integer.parseInt(String.valueOf(cArray[0])); How can i get the value "33" from the string .Also if i have in String like "2=3=file" also i want to get the value "3". Sorry if this is a very simple question to ask or may be this being very specific case.
tagged with: java
downvote count: 2
tagged with: string
accepted answer: http://stackoverflow.com/a/25230515
favorite count: 0
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/39301135
has comment: http://stackoverflow.com/comment/39301101
possible better answer: http://stackoverflow.com/a/25230484

http://stackoverflow.com/comment/39475074
type: Comment
type: QuestionComment
has text: @Sayse, for the Java, C#, C++ and PHP the same information about static keyword - "static members belong to the class instead of a specific instance. It means that only one instance of a static field exists[1] even if you create a million instances of the class or you don't create any. It will be shared by all instances."
comment on: http://stackoverflow.com/q/25323202
score: 0

http://stackoverflow.com/comment/39339081
type: QuestionComment
comment on: http://stackoverflow.com/q/25247160
score: 0
has text: Whats the error message you get? And can you append a screenshot of the unfold javazoom folder? Didn't you have a jar file?
type: Comment

http://stackoverflow.com/comment/39320885
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25240315
type: Comment
has text: I tried with Hapi but hapi don't have support for 2.7. It's throwing me exception. I have JL7 from google, but not usable. So could you please suggest some better tool.

http://stackoverflow.com/comment/39382620
has text: logcat hamine ke ferestadam dige try 1,2 dorost kar mikone vali try shomare3 mire dar catch .errorhaye logcat ham baraye catch hast
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25272803
type: QuestionComment

http://stackoverflow.com/q/25326343
has comment: http://stackoverflow.com/comment/39480551
has body: So I have an desktopPane on a JFrame, on the desktopPane is a JInternalFrame. Now I set the location of the internalFrame to the center of the desktopPane, but when I resize the whole Frame the InternalFrame stays where it was and does not change the position to the new center. public void openLogin(){ JInternalFrame iFrame = new LoginScreen(appMain); desktopPane =new JDesktopPane(); add(desktopPane); frameSize = getSize(); desktopPane.setSize(frameSize); Dimension desktopSize = desktopPane.getSize(); Dimension jInternalFrameSize = iFrame.getSize(); iFrame.setLocation((desktopSize.width - jInternalFrameSize.width)/2, (desktopSize.height- jInternalFrameSize.height)/2); desktopPane.add(iFrame); } This is the method where I set the location, how to change it so it matches the new center? I tried it with some listeners but nothing works right. Ok, so because I have no time to use the answer from @Hovercraft full of Eels, I tried again a componentlistener: public void openLogin(){ JInternalFrame iFrame = new LoginScreen(appMain); desktopPane =new JDesktopPane(); add(desktopPane); frameSize = getSize(); newSize=frameSize; desktopPane.addComponentListener(new ComponentListener() { @Override public void componentShown(ComponentEvent e) { } @Override public void componentResized(ComponentEvent e) { newSize = getSize(); } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } }); if(newSize != frameSize){ desktopPane.setSize(newSize); Dimension desktopSize = desktopPane.getSize(); Dimension jInternalFrameSize = iFrame.getSize(); iFrame.setLocation((desktopSize.width - jInternalFrameSize.width)/2, (desktopSize.height- jInternalFrameSize.height)/2); desktopPane.add(iFrame); } else{ desktopPane.setSize(frameSize); Dimension desktopSize = desktopPane.getSize(); Dimension jInternalFrameSize = iFrame.getSize(); iFrame.setLocation((desktopSize.width - jInternalFrameSize.width)/2, (desktopSize.height- jInternalFrameSize.…
type: UnansweredQuestion
tagged with: swing
score: 0
answer count: 2
tagged with: jdesktoppane
tagged with: java
has title: How to resize a JDesktopPane dynamically
has answer: http://stackoverflow.com/a/25326537
has answer: http://stackoverflow.com/a/25327394
has comment: http://stackoverflow.com/comment/39480653
type: Question

http://stackoverflow.com/a/25346614
type: Answer
accepted answer of: http://stackoverflow.com/q/25346591
has body: What will happen if one calls a return statement or System.exit on try or catch block ? Will finally block execute? In the case of a return, Yes. If you want the gory details, they are specified in JLS section 14.20.2. (Note that in the JLS terminology, a return counts as an abrupt termination. But that doesn't matter, because when you analyse the spec carefully, you will see that the finally gets executed for both normal and abrupt terminations.) In the case of a System.exit(), No. The call to the exit method never returns, and it doesn't throw an exception either. Therefore the "enclosing" finally clauses for the thread never get executed. (In JLS parlance, the exit() call doesn't "terminate" at all. It conceptually the same as a method going into an infinite loop that (magically) doesn't use any CPU time. All of the activity associated with JVM shutdown happens on other threads.)
type: AcceptedAnswer
downvote count: 0
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/25346591

http://stackoverflow.com/q/25359748
score: 0
has body: In my Java application, I need to copy multiple files from HDFS to Local File System. Which of the below two approaches will be faster ? 1. Sequentially copy files one-by-one 2. Run parallel threads to copy each file.
tagged with: java
type: Question
tagged with: hadoop
has title: Copy Multiple files from HDFS to local: Multithreading?
tagged with: apache
tagged with: multithreading
answer count: 1
tagged with: hdfs
has answer: http://stackoverflow.com/a/25359819
accepted answer: http://stackoverflow.com/a/25359819
type: AnsweredQuestion

http://stackoverflow.com/comment/39337049
comment on: http://stackoverflow.com/q/25248840
score: 0
type: Comment
type: QuestionComment
has text: Are you sure the loop isn't exiting? Since you're missing curly braces as others have said, the program could be printing the message even when `done` is `true` and the loop actually exits. One other thing to check: your message says to type `done` but the program actually checks for `Done`. Probably use `equalsIgnoreCase` instead of `equals`.

http://stackoverflow.com/a/25287808
score: 11
answers question: http://stackoverflow.com/q/25287767
upvote count: 11
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25287767
downvote count: 0
type: Answer
has body: Yes. It is possible. You can Consume (access and read) a REST web service in Swing desktop application. You can achieve it using HTTPClient. An example - http://www.mkyong.com/webservices/jax-rs/restful-java-client-with-apache-httpclient/

http://stackoverflow.com/q/25354617
tagged with: android-asynctask
has title: Android Iterate Over List -MapView
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39531604
answer count: 1
tagged with: arrays
type: Question
score: 0
has answer: http://stackoverflow.com/a/25354640
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm attempting to iterate over an array list but I am running into errors when I try to create a dynamic map marker on the MapView. Casting the values do not seem to work at the bottom of this method when I try to get the for loop to iterate over both the latitude and longitude values in the allPostMarkers JSON array. Please let me know if you need more information from me and I will be happy to provide more code. I'm still certain just iterating over the array list is the problem. private JSONArray allPostsMarkers = null; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; mPostsMarkerList; public void updateJSONdata() { // Instantiate the arraylist to contain all the JSON data. // we are going to use a bunch of key-value pairs, referring // to the json element name, and the content, for example, // message it the tag, and "I'm awesome" as the content.. mPostsMarkerList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Bro, it's time to power up the J parser JSONParser jParser = new JSONParser(); // Feed the beast our comments url, and it spits us // back a JSON object. Boo-yeah Jerome. JSONObject json = jParser.getJSONFromUrl(MAP_POSTS_URL); // when parsing JSON stuff, we should probably // try to catch any exceptions: try { // I know I said we would check if "Posts were Avail." (success==1) // before we tried to read the individual posts, but I lied... // mComments will tell us how many "posts" or comments are // available allPostsMarkers = json.getJSONArray(TAG_POSTS); // looping through all posts according to the json object returned for (int i = 0; i &lt; allPostsMarkers.length(); i++) { JSONObject c = allPostsMarkers.getJSONObject(i); // gets the content of each tag String content = c.getString(TAG_MESSAGE); //String username = c.getString(TAG_USERNAME); String longitude = c.getString(TAG_LONGITUDE); String latitude = c.getString(TAG_LATITUDE); String category = c.getString(TAG_CATEGORY); System.out.print(latitude); System.out.print(longitude); Sy…
accepted answer: http://stackoverflow.com/a/25354640

http://stackoverflow.com/q/25359358
tagged with: java
possible better answer: http://stackoverflow.com/a/25359427
has answer: http://stackoverflow.com/a/25359507
tagged with: generics
has body: I have a question around the topic Generics in Java: Let's say I have following generic (static) method in class. In this method, I want to have access to certain method/fields of the real class. Is there some typesafe way in the static language Java? Or are there any workarounds? public class GenericClassUtil { public static &lt;T&gt; void workWithRealTypeAttr(T objectClass) { //here get access to values of Easel, Cat, Dog or some other class } } In main code: GenericClassUtil.workWithRealTypeAttr(new Easel()); GenericClassUtil.workWithRealTypeAttr(new Cat()); GenericClassUtil.workWithRealTypeAttr(new Dog());
has answer: http://stackoverflow.com/a/25359427
has comment: http://stackoverflow.com/comment/39540338
has title: Typesafe cast in generic
accepted answer: http://stackoverflow.com/a/25359460
has answer: http://stackoverflow.com/a/25359490
has answer: http://stackoverflow.com/a/25359455
has answer: http://stackoverflow.com/a/25359460
answer count: 6
has answer: http://stackoverflow.com/a/25359477
has comment: http://stackoverflow.com/comment/39540340
type: Question
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25349344
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25317539
accepted answer of: http://stackoverflow.com/q/25317539
has body: Access the interface IYouNameIt and not the implementation class YouNameIt: IYouNameIt youNameIt = context.getBean("myProxy", IYouNameIt.class); See here for a full Spring remoting example.
score: 2

http://stackoverflow.com/comment/39327888
score: 0
type: Comment
has text: Redundant? you mean innecesary?
type: AnswerComment
comment on: http://stackoverflow.com/a/25244230

http://stackoverflow.com/q/25287722
accepted answer: http://stackoverflow.com/a/68146430
downvote count: 2
tagged with: java-7
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/68146430
upvote count: 1
has title: Date formatting not working
linked to: http://stackoverflow.com/q/4772425
linked to: http://stackoverflow.com/q/8307417
possible better answer: http://stackoverflow.com/a/25287771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25287771
has answer: http://stackoverflow.com/a/25288220
tagged with: java
has answer: http://stackoverflow.com/a/25300641
linked to: http://stackoverflow.com/q/4216745
score: -1
tagged with: date
has comment: http://stackoverflow.com/comment/39410149
answer count: 4
has body: I am trying to convert the string to date and i want that date to be in this format 'yyyy-MM-d HH:mm:ss' and i no how to get this format in string my question is i want to get Date in above format not as string but as 'Date '? i am doing in this way for(int k=0;k&lt;12;k++)//for the months { //i have added if condtion for the months with 31 and 30 and 28 days Calendar dateFromCal = Calendar.getInstance(); dateFromCal.setTime(date); dateFromCal.set(year, k, 1, 0, 0, 0); Calendar dateToCal = Calendar.getInstance(); dateToCal.setTime(date); dateToCal.set(year, k, 31, 23, 59, 59); //i have set the date format as 'yyyy:MM:dd HH:mm:ss' dateFrom = dateFormat.format(dateFromCal.getTime()); dateTo = dateFormat.format(dateToCal.getTime()); fromdate = (Date)dateFormat.parse(dateFrom); todate = (Date)dateFormat.parse(dateTo); } by using above code i am getting the date in the following format Sat Nov 01 00:00:00 GMT 2014 but i want the date format to be as 2014-11-01 00:00:00 NOTE:I want this result as Date not as String Please give me solution for this Thanks....
favorite count: 0
has comment: http://stackoverflow.com/comment/39433220
type: Question
tagged with: liferay
has comment: http://stackoverflow.com/comment/129755910
has comment: http://stackoverflow.com/comment/39408399
has comment: http://stackoverflow.com/comment/39408923

http://stackoverflow.com/comment/39525255
comment on: http://stackoverflow.com/a/25350639
has text: @user3324788 I tried something similar (running a main method from a JSP), and it worked. Can you edit your question with the full code of the JSP with the changes I suggested? Perhaps you have some syntax error somewhere.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25281367
tagged with: twitter4j
tagged with: java
answer count: 1
tagged with: twitter
has answer: http://stackoverflow.com/a/25285904
type: Question
type: UnansweredQuestion
has body: I am using Twitter4j for searching tweets. But the results returned are very different from the ones that are returned on the website. Should I not expect the results to be nearly same? The code that I am using is the same as shown in their code examples page: Twitter twitter = TwitterFactory.getSingleton(); Query query = new Query("Halloween"); QueryResult result = twitter.search(query); for (Status status : result.getTweets()) { System.out.println("@" + status.getUser().getScreenName() + ":" + status.getText()); }
has title: Different search results with Twitter4j and twitter.com
score: 0

http://stackoverflow.com/comment/39591017
type: QuestionComment
comment on: http://stackoverflow.com/q/25385966
has text: I found a previous post that could help you: http://stackoverflow.com/questions/4828757/cannot-run-or-jai-imageio-or-imageio-getimagereadersbyformatname-cannot-get-obje
score: 0
type: Comment

http://stackoverflow.com/comment/39484831
has text: I also have doubts about all the `TextFieldTableCell`'s without string converters, but that's another question.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25319447
score: 1

http://stackoverflow.com/q/25324433
type: AnsweredQuestion
has title: Read the contents of files in a specific package
score: 1
has answer: http://stackoverflow.com/a/25328114
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
tagged with: inputstream
has comment: http://stackoverflow.com/comment/39477424
linked to: http://stackoverflow.com/q/12007012
has comment: http://stackoverflow.com/comment/39483991
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39483587
has body: I'm surprised I couldn't find an answer to this question on stackoverflow, but please forgive me if this is a duplicate. I have some text files sitting in a package in my web application. I know what the package is called, but I don't necessarily know what the files are called. I want to be able to read the contents of each of the text files in this package. I know I could read the contents of individual files using getClass().getResourceAsStream("filename.txt"), but as I say I don't necessarily know the names of the files, just the package they reside in. So, given a package name, how can I get the contents of all the files contained within that package?
tagged with: package
accepted answer: http://stackoverflow.com/a/25328114

http://stackoverflow.com/comment/39329341
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25244799
has text: If you want to reduce (mem)size, you will always lose some information. You can crop an Image, reduce dpi or downscale it (or a combination of all). I guess what you want is downscaling without reducing dpi? Please clearify what you mean exactly with "Quality".
type: QuestionComment

http://stackoverflow.com/a/38235777
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25270191
downvote count: 0
upvote count: 1
has body: To people who might come to this issue again , If you try to read data from xml string it might not work but if you can get data in InputStream you can pass it to XMLStreamReader It works fine. Great blog by @Blaise. I used xjc to pick out the schema manually created the Javaobject and then used XMLStreamReader to parse the jax-rs reponse and get the Input Stream. Will try to remove the manual step and update post if successful. XMLInputFactory xif = XMLInputFactory.newFactory(); StreamSource xml = new StreamSource(httpResponse.getEntity().getContent()); XMLStreamReader xsr = xif.createXMLStreamReader(xml); xsr.nextTag(); while (!xsr.getLocalName().equals("GetAccountInfoResults")) { xsr.nextTag(); } JAXBContext jc = JAXBContext.newInstance(GetAccountInfoResults.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); JAXBElement&lt;GetAccountInfoResults&gt; jb = unmarshaller.unmarshal(xsr, GetAccountInfoResults.class); xsr.close(); GetAccountInfoResults result = jb.getValue();

http://stackoverflow.com/q/25346055
type: AnsweredQuestion
score: 0
has title: How can I make a JProgressBar fill up during a certain interval?
tagged with: java
tagged with: window
has body: Your solution works with the timer JProgressBar fill up during a certain interval however when btn is pressed the timer doesnt start any suggestions I have included the full code ? Here is the full code: //Packages import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.Timer; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; //Class public class PickUp { private JFrame frmPickUp; /** * Launch the application. */ public static void NewScreen2() { EventQueue.invokeLater(new Runnable() { public void run() { try { PickUp window = new PickUp(); window.frmPickUp.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } @SuppressWarnings("serial") public class ProgressBar extends JFrame { private int c = 0; private Timer t; private JButton btn; private JProgressBar pBar; private long currentTime; // 15 minutes in milliseconds private final int waitingTime = 15 * 60 * 1000;//900000 milliseconds private final int delay = waitingTime / 100;//9000 == 9 seconds public ProgressBar() { // delay in milliseconds //inside the internal anonymous class, we write the code we want the timer to execute each delay t = new Timer(delay, new ActionListener() { public void actionPerformed(ActionEvent e) { if(c &lt;= 100) pBar.setValue(++c); } }); btn = new JButton("Start Timer"); // Adding an action listener: when you click the button, the timer starts btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // starting the timer, which causes it to sending ActionEvents to its Listeners t.start(); } }); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); getContentPane().add(btn);//Adding the button to the co…
answer count: 1
tagged with: windowbuilder
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25346293
type: Question
has answer: http://stackoverflow.com/a/25346293
tagged with: progress-bar

http://stackoverflow.com/comment/39450235
type: AnswerComment
has text: I would say "linked lists" and not "`LinkedList`" to avoid confusion with `java.util.LinkedList`.
comment on: http://stackoverflow.com/a/25310173
score: 0
type: Comment

rss
type: Tag
tags question: http://stackoverflow.com/q/25262264
tag name: rss
tags question: http://stackoverflow.com/q/25289539

http://stackoverflow.com/a/25254180
answers question: http://stackoverflow.com/q/25251643
upvote count: 3
downvote count: 0
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39370852
has body: You're right it would be solvable for the simple use-case and should also solved. Unfortunately the current APIs don't return the labels as part of the node so we would have to rewrite the inner workings to generate the extra meta-information and return all of that correctly. One idea is to use RETURN {id:id(n), labels:labels(n), data:n)} as n for the full representation. The problem is this breaks with user defined queries. Not sure when and how we can schedule that work. Feel free to raise it as JIRA issue or watch/upvote any related issues.

http://stackoverflow.com/comment/39382335
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25262095
has text: Possibly, I come from C# and most of the containers do convention over configuration so "hard coding" the construction into the toInstance method doesn't seem right but it will certainly be nicer than the way I've been going.

http://stackoverflow.com/a/25335997
downvote count: 0
answers question: http://stackoverflow.com/q/25335954
score: 2
has body: your driver class for postgresql should be org.postgresql.Driver for version 7 and later, in your database.properties file. Please refer to this link to know driver class name. Also, looks like your url is incorrect too: Please have a look at following : PostgreSQL (v6.5 and earlier) url : jdbc:postgresql://&lt;HOST&gt;:&lt;PORT&gt;/&lt;DB&gt; driver : postgresql.Driver PostgreSQL (v7.0 and later) url : jdbc:postgresql://&lt;HOST&gt;:&lt;PORT&gt;/&lt;DB&gt; driver : org.postgresql.Driver
type: Answer
has comment: http://stackoverflow.com/comment/39499649
has comment: http://stackoverflow.com/comment/39499500
upvote count: 2

http://stackoverflow.com/comment/39516726
has text: Have you actually tried typing this into Eclipse and dealing with the errors that it shows you?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25345924

http://stackoverflow.com/q/25317103
has answer: http://stackoverflow.com/a/25317320
answer count: 3
downvote count: 0
has body: I'm making a coding game for the Java class I TA. The game is to manage a fleet of trucks (Truck extends Thread) on an undirected graph to deliver parcels to their various destinations using as little time/fuel as possible. The student extends an abstract manager class that fills in the gaps in the Truck's behavior (what to do upon reaching a destination, etc). The truck class's run method is a event loop that waits for user instruction and then follows it when it receives travel destinations. Here's the event loop: @Override /** The Truck's main running routine. While the travel directions are empty, * Waits for more instructions in WAIT_TIME intervals. While the travel directions * are not empty, pops off the next travel direction */ public void run(){ while(game.isRunning()){ setGoingTo(null); while(travel.isEmpty() &amp;&amp; game.isRunning()){ try{ Thread.sleep(WAIT_TIME); } catch (InterruptedException e){ e.printStackTrace(); } setStatus(Status.WAITING); game.getScore().changeScore(Score.WAIT_COST); } while(!travel.isEmpty() &amp;&amp; game.isRunning()){ Edge r = getTravel(); try { travel(r); } catch (InterruptedException e) { e.printStackTrace(); } } } } The first inner while loop loops while there are no travel instructions to follow. As you can see, every WAIT_TIME milliseconds (a frame), the score is decreased by the wait cost - the cost of the truck idling. I realized, however, that a way for a potential solution to get around this cost is to tell the truck (thread) to wait while it doesn't have instructions, then notify it once the user has computed instructions for it. I'd like to prevent this programmatically, rather than just put in the instructions not to do it. Is this even possible? Perhaps a method in the thread class to override? Can a class that extends Thread be prevented from waiting (on anything?) I'd settle for any kind of exception being thrown if a truck thread tries to execute .wait(). Thanks for reading and for any suggestions for how to…
has comment: http://stackoverflow.com/comment/39464005
tagged with: java
has title: Prevent Thread Subclass from waiting
has comment: http://stackoverflow.com/comment/39463690
has comment: http://stackoverflow.com/comment/39467083
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39475470
has comment: http://stackoverflow.com/comment/39480365
has answer: http://stackoverflow.com/a/25328017
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25317314
has comment: http://stackoverflow.com/comment/39464260
score: 2
upvote count: 2

http://stackoverflow.com/a/34902360
has body: Here is the java code to calculate skew angle: Mat source = Imgcodecs.imread(input.getName(),0); Size size = source.size(); Core.bitwise_not(source, source); Mat lines = new Mat(); Imgproc.HoughLinesP(source, lines, 1, Math.PI / 180, 100, size.width / 2.f, 20); double angle = 0.; for(int i = 0; i&lt;lines.height(); i++){ for(int j = 0; j&lt;lines.width();j++){ angle += Math.atan2(lines.get(i, j)[3] - lines.get(i, j)[1], lines.get(i, j)[2] - lines.get(i, j)[0]); } } angle /= lines.size().area(); angle = angle * 180 / Math.PI;
has comment: http://stackoverflow.com/comment/84480608
has comment: http://stackoverflow.com/comment/84526537
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/25346712
type: Answer
upvote count: 6

http://stackoverflow.com/comment/95978443
score: 7
type: Comment
has text: In this way you removed all security, the '.anyRequest().permitAll()' will permit all requests, you must find the right path to your resources and use it. If you use spring security, then usually anyRequest() has to be authenticated()
type: AnswerComment
comment on: http://stackoverflow.com/a/38942664

http://stackoverflow.com/a/25253508
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39346695
accepted answer of: http://stackoverflow.com/q/25253418
answers question: http://stackoverflow.com/q/25253418
type: Answer
has body: check http://txt2re.com/index-java.php3?s=%2012%20170%200.11918&amp;11&amp;5&amp;12&amp;4&amp;13&amp;1 you're probably interested in the int1, int2 and float1 below public static void main(String[] args) { String txt=" 12 170 0.11918"; String re1="(\\s+)"; // White Space 1 String re2="(\\d+)"; // Integer Number 1 String re3="(\\s+)"; // White Space 2 String re4="(\\d+)"; // Integer Number 2 String re5="(\\s+)"; // White Space 3 String re6="([+-]?\\d*\\.\\d+)(?![-+0-9\\.])"; // Float 1 Pattern p = Pattern.compile(re1+re2+re3+re4+re5+re6,Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); if (m.find()) { String ws1=m.group(1); String int1=m.group(2); String ws2=m.group(3); String int2=m.group(4); String ws3=m.group(5); String float1=m.group(6); System.out.print("("+ws1.toString()+")"+"("+int1.toString()+")"+"("+ws2.toString()+")"+"("+int2.toString()+")"+"("+ws3.toString()+")"+"("+float1.toString()+")"+"\n"); } }
has comment: http://stackoverflow.com/comment/39346393

http://stackoverflow.com/comment/39425535
has text: @user2733436 Whoops! I had a bug. Try the updated code - that looks better.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25293751

http://stackoverflow.com/comment/39520157
comment on: http://stackoverflow.com/a/25347147
type: Comment
score: 0
type: AnswerComment
has text: duh! so sorry.. let me check.. the code should work.. I edited the code I had, for this answer, maybe I forgot something.. you may edit the answer if there's a minor mistake somewhere.. :)

http://stackoverflow.com/a/25386681
has body: You are executing your cmd in UNIX system , you should follow convention of unix : don't use \ as directory separator, use / instead. don't use ; as classpath separator , use : instead. so you have to move to the directory where your myJar.jar is located, if the main class that you want to execute is supposed to be in the jar ,then check that it's really there using the command : jar tf jar-file that will print the content of your jar.if you have a folder bin in the same folder you can add it to the classpath then use java -cp "bin/:lib/myJar.jar" com.example.MyClass
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25386143
score: 2
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25386143

http://stackoverflow.com/q/25254958
has comment: http://stackoverflow.com/comment/39350466
tagged with: java
has answer: http://stackoverflow.com/a/25256044
has comment: http://stackoverflow.com/comment/39348683
favorite count: 0
type: Question
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/25255223
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39348901
has comment: http://stackoverflow.com/comment/39348663
has body: IF constructors in Java does not return any value- they do not have any return type then when an object is created like ClassOne objectOne=new ClassOne(); how a reference referring to the object of ClassOne is returned. IS it JVM which returns the reference.
score: -4
has comment: http://stackoverflow.com/comment/39348740
has comment: http://stackoverflow.com/comment/39348641
has title: Constructors do not have return type in Java

http://stackoverflow.com/comment/39323481
has text: I already shared my code have a look. TheLostMind: I cannot use shift function.I have to do it mathematically.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25241768

http://stackoverflow.com/comment/39603284
type: AnswerComment
score: 0
has text: If you don't know where it is you likely don't have it. Keytabs for SPNEGO are not installed by default. You can use ktutil to look in /etc/krb5.keytab, but that's just a guess.
type: Comment
comment on: http://stackoverflow.com/a/25388316

http://stackoverflow.com/q/25361173
has comment: http://stackoverflow.com/comment/39543715
has title: Usage of "this" in Thread constructor
has body: Could someone explain me what is the meaning of "this" in this line "th = new Thread( this, name);" of the following program? The Thread constructor currently used is Thread(Runnable threadOb, String name). Why do I have to use the word "this" in the above expression? For example, in case I write "th = new Thread( newOb, name);", eclipse mentions ob cannot be resolved to a variable. Do I always have to use "this" in this case, and if so, why? Many thanks in advance. class MyThread implements Runnable{ int count; Thread th; MyThread(String name){ th = new Thread( newOb, name); count =0; th.start(); } public void run(){ System.out.println(th.getName() + " starting "); try{ do{ Thread.sleep(500); System.out.println(" in " + th.getName() + " count is " + count); count++; }while(count&lt;5); } catch(InterruptedException e){ System.out.println(e); } System.out.println(th.getName() + " terminating"); } } public class UseThreads { public static void main(String[] args) { System.out.println("main thread"); MyThread mt = new MyThread("thread1"); do{ System.out.println("."); try{ Thread.sleep(100); } catch(InterruptedException e){ System.out.println(e); } }while(mt.count!=5); System.out.println("main thread terminating "); } }
tagged with: java
accepted answer: http://stackoverflow.com/a/25361321
has comment: http://stackoverflow.com/comment/39543556
has answer: http://stackoverflow.com/a/25361321
tagged with: constructor
downvote count: 4
upvote count: 0
score: -4
tagged with: multithreading
tagged with: this
answer count: 1
has comment: http://stackoverflow.com/comment/39543561
favorite count: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/39482642
type: Comment
comment on: http://stackoverflow.com/a/25322782
type: AnswerComment
has text: Downvote for misinformation. It is not possible to "deep copy" anything that it is possible to use the "++" operators on in Java, and stating that optimizers cannot optimize away the operation when it is used in a comparison is also misinformation.
score: 5

http://stackoverflow.com/q/25244379
has body: i can't understand what is wrong with this code, and why is thrown this exception,i have installed the latest google play services rev 19, manifest file: &lt;?xml version="1.0" encoding="utf-8"?&gt; manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.testing" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /&gt; &lt;permission android:name="com.example.testing.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="com.example.testing.permission.MAPS_RECEIVE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.testing.MainActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="my app key" /&…
tagged with: android
accepted answer: http://stackoverflow.com/a/25244877
type: AnsweredQuestion
score: 0
tagged with: java
has title: maps application force quit on emulator
answer count: 1
has answer: http://stackoverflow.com/a/25244877
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/a/53579451
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25349182
has body: Try to use filter file.canRead()) to avoid any access exceptions.

http://stackoverflow.com/comment/39403206
has text: @Prabakaran - You cannot - not without risking collisions. You need to put both longs in your DB and adjust your distinct clause to use both. See [here](http://stackoverflow.com/a/54430/823393) for how.
comment on: http://stackoverflow.com/a/25281923
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39580855
has text: Where is the var formattedValue declared?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25380855

http://stackoverflow.com/q/25232441
favorite count: 0
type: Question
tagged with: key-bindings
upvote count: 5
score: 5
has body: If you add a Key Binding in java with a mask - let's just say the ActionEvent.ALT_MASK with KeyEvent.VK_A - and then you perform that key (ALT + A) BUT, you release the alt key just before the 'A' key, you will usually encounter a problem where the actionPerformed() in a class (implementing ActionListener) will keep being activated. This probably (98% sure) means that the Key Binding never registered that the key was released. If you release the 'A' key before the alt key, you are fine, but - like I said - if you release the alt key perhaps 1/10 of a second before the other key, it keeps repeating. Note: This only happens - apparently - in my program (here) Try it for yourself if you don't believe me. Here is a snippet of my code: public ConwayPanel() { super(); setBackground(new Color(245, 255, 245, 255)); // BG slightly green - all ready paused = true; // nothing to play... in FUTURE put cool organism in startX = 0; // starting position of the left of the grid startY = 0; // starting position of the top of the grid zoom = 15; // the width of each cell (EXCLUDING the lines that make up the boundaries) cellNum = 1000; // The number of cells cells = new boolean[cellNum][cellNum]; // populate cells with false/dead currentX = 0; // current x cursor position currentY = 0; // current y cursor position flipBoundaries = new int[4]; hideCurrentPos = false; // don't want to hide cursor position unless explicitly told to do so defineMaps(); // creates Key enums setKeyBindings(); // defines Key and KeyNoMask key bindings Timer timer = new Timer(100, new KeyListener()); timer.start(); setupMouseListeners(); // creates MouseListener, MouseMotionListener and MouseWheelListener setFocusable(true); // make isFocusable() true requestFocusInWindow(); // get focus for listeners } private void defineMaps() { for (KeyAltMask key : KeyAltMask.values()) { keyMap.put(key, false); // value true when key is pressed - all initiated to false } for (KeyNoMask key : KeyNoMask.values()) { keyNoMa…
has comment: http://stackoverflow.com/comment/39305558
accepted answer: http://stackoverflow.com/a/25232832
has title: KeyBindings stuck on actionPerformed()
has comment: http://stackoverflow.com/comment/39305962
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39305593
downvote count: 0
has comment: http://stackoverflow.com/comment/39305955
has answer: http://stackoverflow.com/a/25232832
tagged with: java
has comment: http://stackoverflow.com/comment/39305748
answer count: 1
tagged with: swing

http://stackoverflow.com/q/25351817
has body: I'm implementing a web app based on spring 3.2.8, jpa2.1 and hibernate 4.3.5. I'd like to know how I can prevent hibernate caching a specific Named Stored Procedure Query. I'd tried entityManager.clear(), but I think it clears all cached entity values so it can't be an optimal solution!! Notice: I used @NamedStoredProcedureQueries to define stored procedures and call it by entityManager.createNamedStoredProcedureQuery() method to get results Added: Table person: person{p# as PK, ...} Table person_value: person_value{pv# as PK, p# as foreign key from table person, ...} View view1: select *,check_value(dbo.person.p#) as has_value from person Function check_value(input): returns 1 if there's a record in person_value with p# equals to input. Stored procedure SPS_VIEW1: select * from view1 where p#=@p# Entity class of sql server view view1: @Entity @Table(name = "view1") @NamedStoredProcedureQueries( @NamedStoredProcedureQuery(name = "getV1Records", procedureName = "SPS_VIEW1", resultClasses = View1.class, @parameters = {@StoredProcedureParameter(name = "p#", type = String.class))) public class View1{ @Id @Column(name = "p#") private String personId; @Column(name = "hasValue") private boolean value; &lt;getters and setters&gt; } Service class: @Service("personService") public class PersonService() { ... private EntityManager entityManager; &lt;getters and setters&gt; ... public List&lt;View1&gt; getAll(String pno) { SqlParameterValue p = new SqlParameterValue(new SqlParameter("p#", Types.VARCHAR), pno); StoredProcedureQuery spq = entityManager.createNamedStoredProcedureQuery("getV1Records"); spq.setParameter(p.getName(), p.getValue()); return list; } } Controller class: @Controller("PersonController") public class PersonController { ... @Autowired private PersonService personService; ... @RequestMapping("/person") public personInfo(HttpServletRequest request) { String pno = request.getParameter("pno"); ModelAndView mv = new ModelAndView("person"); List&lt;View1&gt; list …
type: Question
tagged with: jpa-2.1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25352252
has comment: http://stackoverflow.com/comment/39538332
has answer: http://stackoverflow.com/a/25351918
tagged with: spring
score: 0
answer count: 2
has title: How to prevent hibernate 4 caches for NamedStoredProcedureQueries?
has comment: http://stackoverflow.com/comment/39548402
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/25307032
has body: The jar should exist in your JDK/lib directory. You need to check which default JDK your IDE uses, or if there is a special one declared in your POM. Looks like you need a never version, or a JRE is set as default. To find the default runtime in Eclipse: Click "Window" -> "Preferences" -> type "jre" -> click "installed JREs". The one with the arrow is the default runtime.
answers question: http://stackoverflow.com/q/25306883
type: Answer
has comment: http://stackoverflow.com/comment/39444789
score: 0

http://stackoverflow.com/q/25262727
possible better answer: http://stackoverflow.com/a/25262832
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/25262842
type: AnsweredQuestion
answer count: 2
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25262832
has title: Java - Add/Remove JPanel classes
tagged with: swing
has body: I'm trying to make the JPanels swap from one to another. Sounds simple, but I'm struggling due to having my panels all in different classes. I have 4 classes: - GUI (Main class) - BankingAppMainFrame (JFrame class) - BankingAppStartPanel (JPanel class) &lt;- I want to remove this JPanel - BankingAppLoginPanel (JPanel class) &lt;- I want to add this JPanel Here is my relevant JFrame code: //This is the only way i didn't get errors xD public void panelSwap(JFrame z, JPanel x, JPanel y) { z.remove(x); z.add(y); } Here is my relevant BankingAppStartPanel code: LoginButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { //I thought I'd need to instance all my classes BankingAppMainFrame mainFrame = new BankingAppMainFrame(); BankingAppStartPanel startPanel = new BankingAppStartPanel(); BankingAppLoginPanel loginPanel = new BankingAppLoginPanel(); //This is calling the panelSwap method from the main Class mainFrame.panelSwap(mainFrame, startPanel, loginPanel); } }); The BankingAppLoginPanel is just a blank panel at the moment until I can get this to work. What I'm trying to do is remove the current Panel (In this case "BankingAppStartPanel" and replace it with the "BankingAppLoginPanel".
has comment: http://stackoverflow.com/comment/39362370
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25262842
tagged with: jframe

http://stackoverflow.com/comment/39454066
comment on: http://stackoverflow.com/a/25311526
type: Comment
has text: the("password") only makes sure the password entered matches the "password" parameter, i've tried that several days ago that wasn't it unfortunately but i think that since I'm creating a new session each time, that probably is the cause of the pop up
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39547149
has text: @peeskillet..I have tried creating a JDesktopPane and then add my JFrame into it first...when I clicked the button..then only the JDesktopPane add the internal frame...but I got an error saying java.lang.IllegalArgumentException: adding a window to a container
comment on: http://stackoverflow.com/q/25362409
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25368985
has comment: http://stackoverflow.com/comment/39559825
has comment: http://stackoverflow.com/comment/39559241
type: Answer
has comment: http://stackoverflow.com/comment/39558993
has comment: http://stackoverflow.com/comment/39559152
has comment: http://stackoverflow.com/comment/39559012
has body: Status is a nested enum type inside Book class, not a field. You should be declaring a field of type Status. The assignment in your constructor is also suspicious. You are assigning a value of type Status to enum itself. That wouldn't compile. Have a variable declared in your Book class as: private Status status; ... and use it like: if (b.status == Book.Status.FORISSUE) Apart from that, you've numerous other compilation errors. Your if block as below is missing closing parenthesis: if(b.BookName == is.readUTF() Moreover, you're using == to compare string, which is not a compilation error, but functionally that will most certainly fail. Another thing is, you don't need to declare your enum static. Nested enums are by default static only. Lastly, please follow Java naming convention. It is so hard to read your code right now. Class name should start with UpperCase alphabets, and variable name with lowerCase alphabets. I am using Book as a static class because I read that enums only exist in static classes. Where did you read that? Please quote your sources. You can declare an enum in a non-static class too.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25368907
has comment: http://stackoverflow.com/comment/39559729
has comment: http://stackoverflow.com/comment/39559384

http://stackoverflow.com/comment/39326553
type: Comment
comment on: http://stackoverflow.com/a/25243406
type: AnswerComment
has text: Wow, I did not know about JHipster but looks pretty well. And about spring data, I have thought on, but need some test to know how it works. If finally JHipster gives me what I want, I will give you the tick.
score: 0

http://stackoverflow.com/q/25254514
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39350659
tagged with: xsd
has comment: http://stackoverflow.com/comment/39349898
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39350378
has answer: http://stackoverflow.com/a/25273996
has body: each time I run my app engine application in the devserver locally the appengine-application.xml file seems to be automatically re-generating. Each time it reverts back to a version with a simple syntax error. Question: where is the file regenerated/copied from? How do I edit it and cause the changes to persist? There is an opening < missing at the beginning of this file. I have done the following to attempt to edit and save the file:used terminal commands vi- vim- and nano as an admin and a root user, as well as xcode and a plain text editor. here is the file with the error, appengine-application.xml ( missing and oppening '<' before '?xml version="1.0 encoding=...'). file path:../guestbook/guestbook-ear/target/guestbook-ear-1.0-SNAPSHOT/META-INF/appengine-application.xml ?xml version="1.0" encoding="utf-8" standalone="no"?> single-loop-665 here is the appengine-application.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://appengine.google.com/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="appengine-application" type="ns:appengine-applicationType" xmlns:ns="http://appengine.google.com/ns/1.0"/> <xs:complexType name="appengine-applicationType"> <xs:all> <xs:element type="xs:string" name="application"/> </xs:all> </xs:complexType> </xs:schema> this is the error: [INFO] Caused by: com.google.apphosting.utils.config.AppEngineConfigException: XML error validating /Users/jamesjohnson/guestbook/guestbook-ear/target/guestbook-ear-1.0-SNAPSHOT/META-INF/appengine-application.xml against /Users/jamesjohnson/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.8/appengine-java-sdk/appengine-java-sdk-1.9.8/docs/appengine-application.xsd
has comment: http://stackoverflow.com/comment/39381418
tagged with: java
has comment: http://stackoverflow.com/comment/39348874
answer count: 1
has title: XML error validating .xml against .xsd file
has comment: http://stackoverflow.com/comment/39348992
has comment: http://stackoverflow.com/comment/39350076
has comment: http://stackoverflow.com/comment/39349195
has comment: http://stackoverflow.com/comment/39349909
has comment: http://stackoverflow.com/comment/39350348
has comment: http://stackoverflow.com/comment/39349227
type: Question
has comment: http://stackoverflow.com/comment/39349046
accepted answer: http://stackoverflow.com/a/25273996

http://stackoverflow.com/comment/39373414
comment on: http://stackoverflow.com/q/25268657
score: 0
type: QuestionComment
has text: Search with hibernate like query. Is it a typo ?? `myname vs mname` ?
type: Comment

http://stackoverflow.com/comment/39571108
type: Comment
has text: You dont need a executable jar if you dont intend to run your code in a standalone app. In your scenario, you had mentioned that someone else uses your jar/artifact. And they are running the code. In that case you either need a executable jar with all requisite deps. Or you can create the correct classpath (either env variable or passed to the JVM) and then you should be able to run your code.
type: AnswerComment
comment on: http://stackoverflow.com/a/25301407
score: 0

http://stackoverflow.com/q/25323698
has comment: http://stackoverflow.com/comment/39479232
has comment: http://stackoverflow.com/comment/62813712
has comment: http://stackoverflow.com/comment/39533247
tagged with: excel
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/97619173
has comment: http://stackoverflow.com/comment/39476730
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/97619164
has answer: http://stackoverflow.com/a/64036684
has body: I want to open an excel file in POI using OPCPackage and XSSFWorkbook. Since this file will be used in different threads, I want to avoid reopening the file to save time (POI is slow in opening an xlsx file). So what I did was to save the workbook in a global variable then the thread will just access this global variable and reuse the object. The problem that I encountered was when I tried to reuse the object, it affects/modifies the original data of the excel file. I tried to make a copy of the workbook from the global variable by cloning or serialization but I am encountering an error on both processes. Is there a way to create a new copy from an existing XSSFWorkbook object and using this new copy will not affect the data of the original file? Here is my code in opening an excel file: OPCPackage pkg = OPCPackage.open(new File("c:/sample.xlsx")); XSSFWorkbook wb = (XSSFWorkbook) WorkbookFactory.create(pkg); I want to create a new copy of the "wb" object and save it in another variable.
has comment: http://stackoverflow.com/comment/97684607
has comment: http://stackoverflow.com/comment/39533112
tagged with: apache-poi
score: 1
tagged with: java
has title: POI XSSFWorkbook cloning/copy/duplicating
answer count: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39455652
type: Comment
score: 0
type: AnswerComment
has text: Are you sure you've got the code exactly as in my example? I don't see how this could possibly make the text disappear completely. At a minimum, the first instance of "Mytext" should be in exactly the same place as with your original code. If you comment out the last line in my example, then you should be back in exactly the situation as you were in originally, so if you still get no text, you must have changed something else.
comment on: http://stackoverflow.com/a/25312338

http://stackoverflow.com/a/25302884
has comment: http://stackoverflow.com/comment/39439326
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39437272
has comment: http://stackoverflow.com/comment/39533945
accepted answer of: http://stackoverflow.com/q/25302825
has body: Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("image/jpeg"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); //emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,body); emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder() .append("I think you'll like this ") .append(wineName).append(".") .append("&lt;br /&gt;&lt;br /&gt;Scanned it with the ") .append(bottleRating+tastingNote) emailIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://"+winePic)); final PackageManager pm = ShareWineActivity.this.getPackageManager(); final List&lt;ResolveInfo&gt; matches = pm.queryIntentActivities(emailIntent, 0); ResolveInfo best = null; for (final ResolveInfo info : matches) if (info.activityInfo.packageName.endsWith(".gm")|| info.activityInfo.name.toLowerCase().contains("gmail")) best = info; if (best != null) emailIntent.setClassName(best.activityInfo.packageName,best.activityInfo.name); startActivityForResult(emailIntent, 2015);
has comment: http://stackoverflow.com/comment/39438950
has comment: http://stackoverflow.com/comment/39475340
answers question: http://stackoverflow.com/q/25302825
has comment: http://stackoverflow.com/comment/39438414
has comment: http://stackoverflow.com/comment/39439724
has comment: http://stackoverflow.com/comment/39440421
type: Answer
has comment: http://stackoverflow.com/comment/39437919
score: 2
has comment: http://stackoverflow.com/comment/39441603
upvote count: 2

http://stackoverflow.com/comment/39555455
comment on: http://stackoverflow.com/a/25346323
type: AnswerComment
has text: @JonathanViccary Nope, [Parameter object](http://programmers.stackexchange.com/questions/145055/are-there-guidelines-on-how-many-parameters-a-function-should-accept) pattern will solve this.
score: 0
type: Comment

http://stackoverflow.com/q/25270000
has comment: http://stackoverflow.com/comment/39378393
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/39377894
has title: Android - GridView setSelection not working
has comment: http://stackoverflow.com/comment/39376292
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25280804
tagged with: selection
has body: Currently using a tabbar/viewpager with fragments setup for this project. Fragment 2 contains a gridview. At app startup I'm trying to select a gridview cell by default - but no matter what I do it does not 'select'. I'm beginning to wonder if this is because at the time the selection tries to take place, the gridview is off screen (page/fragment 2 of the viewpager). What I'm doing is after the getView method of the GridViewAdapter is initially complete (I'm comparing position to total number of possible cells to determine this) I fire a listener message to select the default cell in the GridView. I did it this way to (a) ensure that the cell I'm trying to select is non-null, and (b) I wondered if the getView method was resetting the selection somehow. public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; // * Other code that sets up the view if (listener!=null) { if ((list.size()-1)==position) { Log.d(TAG, "Today position set: " + todayPosition); listener.todayPositionFound(todayPosition); } } else { Log.d(TAG, "LISTENER IS NULL"); } return row; } and then... public void todayPositionFound(final int position) { // * ------------------------ // * On startup, select today // * ------------------------ mCurrentlySelectedDate = DateHelper.todayAsString(); Log.d(TAG, "Todays Position Found: " + position); View v = calendarView.getChildAt(position); if (v!=null) { Log.d(TAG, "V not NULL - SELECTING"); v.setSelected(true); } Log.d(TAG, "SELECTED? " + calendarView.getSelectedItemPosition()); } All of this goes off without a problem, aside from the fact that the view is then NOT selected. Furthermore, when I getSelectedItemPosition it returns -1 ... even though I just 'selected' position 16. Any thoughts on this would be much appreciated. Thank you!
type: Question
tagged with: gridview
answer count: 2
upvote count: 2
tagged with: android-viewpager
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25271354
downvote count: 0

http://stackoverflow.com/q/25248778
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25248877
possible better answer: http://stackoverflow.com/a/25248877
accepted answer: http://stackoverflow.com/a/25249062
tagged with: http://stackoverflow.com/tag/xml
has body: I am looking for a simple lightweight way to write an XML file using Java. One that does not first build the output up in memory because some of the XML files we create are very large. .NET has this with XmlWriter. Does Java have this anywhere?
type: Question
answer count: 2
downvote count: 0
upvote count: 1
has title: Is there a Java equivalent of the C# XmlWriter?
has answer: http://stackoverflow.com/a/25249062
tagged with: xmlwriter
favorite count: 0
has comment: http://stackoverflow.com/comment/39336693
type: AnsweredQuestion

http://stackoverflow.com/q/25252770
type: AnsweredQuestion
score: 0
has body: Ok so i am making an app which extracts the scynced calendars from the phone and displays them, i have read through many tutorials but i am still unsure how to do this. I want to extract a calendar with the ACCOUNT_TYPE "ca.ryerson" (it is powered by google apps for education), then i wanna get all events from that particular database and only display them when someone clicks on the date provided. So when someone clicks on Sept 5, it shows all the events on sept 5 from the ca.ryerson account, i am fairly new to android development and have almost 0 experience with database handling, i would really like your help with this one. I have read many tutorials and read through the documentation but i still cannot figure out how to do this. Thanks :)
has answer: http://stackoverflow.com/a/25296397
accepted answer: http://stackoverflow.com/a/25296397
tagged with: android
tagged with: java
tagged with: calendarcontract
type: Question
has title: Getting events from a specific calendar and specific date using Calendar Provider/Calendar.Contract
answer count: 1

http://stackoverflow.com/q/25383062
accepted answer: http://stackoverflow.com/a/25388993
tagged with: gmail-api
type: Question
answer count: 1
has title: Gmail API ? how to request for an email using Gmail api with format of raw and how to convert it into normal String
has answer: http://stackoverflow.com/a/25388993
type: AnsweredQuestion
tagged with: java
has body: Can anybody help me out in this? I'm working with gmail-api where I need to read a email. I have gone through the documentation of Gmail API for reading a messages, and I'm able to read email into RFC format. How do I convert it to normal Text? If at all I need to use Java Libraries Mime classes for conversion, how do I use it specifically to read "From address", "To address" and "Message Body?"
downvote count: 0
score: 1
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/25379560
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1842972
tagged with: java
has answer: http://stackoverflow.com/a/25379612
has title: How to run specific class from war file?
tagged with: war
tagged with: class
has body: I have a Maven Web Application that contains only a single class in the Source Packages folder. I have obtained the war file from this project which I would like to copy and run on another machine. I would like to be able to run only that specific class using the commandline. The reason why I still want to use the war file is because that class implements a RESTful service so I don't know if there is another way to go (like making it a jar and end right there). My war file also contains several dependencies and one of them has the provided scope: javax javaee-web-api 7.0 provided This is an extract from the pom.xml file and is the only dependency that does not appear in the WEB-INF/lib folder. However, I don't know if this is the problem. My class is named ClientSide and is under the client package. Running the command: java -cp warFileName.war client.ClientSide resulted in this error: Error: Could not find or load main class client.ClientSide Adding Main-Class: client.ClientSide to the manifest file did not change anything. I have tried the solutions proposed here: How do I run a class in a WAR from the command line? but with no luck. This error would keep repeating. The only way I can run that class is by right-clicking on the class inside the Web Application and select Run File from netbeans, which is very annoying.
score: 1
downvote count: 0
answer count: 1
tagged with: jar
tagged with: maven
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39363044
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25262264
has text: Please post the stack trace of a IOException.
type: Comment

http://stackoverflow.com/comment/39417255
has text: Just curious.. For the second question, are there any other languages that you know of where this may not be the case?
score: 0
comment on: http://stackoverflow.com/a/25275852
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39519254
has text: Sure: for each point `p`, populate a hashmap that counts the angles from other points to `p`, and find the angle with the greatest count `N`. Then accumulate the maximum of `N` while looping over all `p`. By the way, like Marco13 said, if you want this to work, don't represent the angles as floating-point numbers. Instead, you can represent an angle as a pair of integers (dx, dy) where dx and dy are normalized to be relatively prime.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25343779
score: 0

http://stackoverflow.com/comment/39513682
type: AnswerComment
comment on: http://stackoverflow.com/a/25344337
type: Comment
has text: Working perfectly, great annotated answer, especially since I am new to java. Thank you very much!
score: 0

http://stackoverflow.com/q/25296718
type: Question
tagged with: timer
upvote count: 8
duplicate of: http://stackoverflow.com/q/6168179
type: UnansweredQuestion
tagged with: delay
answer count: 1
has title: Repeat an action every 2 seconds in java
linked to: http://stackoverflow.com/q/13812205
has answer: http://stackoverflow.com/a/25296852
has body: I have to repeat a part of my code every 2 seconds how could I do that? don't tell me to use try { Thread.sleep(millisecondi); } catch (Exception e) {} because freeze the application
downvote count: 6
score: 2
tagged with: java
duplicate of: http://stackoverflow.com/q/13812205
linked to: http://stackoverflow.com/q/6168179
has comment: http://stackoverflow.com/comment/39425914
favorite count: 0

http://stackoverflow.com/comment/39315225
type: QuestionComment
comment on: http://stackoverflow.com/q/25237194
score: 0
has text: To add to what others said, the complier (atleast in eclipse) screams - **You are using a raw type** for `ArrayList arr=new ArrayList();`
type: Comment

http://stackoverflow.com/comment/39358281
score: 0
type: Comment
has text: Post full text with imports nd stacktrace
type: QuestionComment
comment on: http://stackoverflow.com/q/25260144

http://stackoverflow.com/q/25341563
has comment: http://stackoverflow.com/comment/39509470
answer count: 1
has body: I am trying to write a simple message to a remote Server using Socket in Android, The remote server was provided to me, here is my attempt, it stops at out.write @Override protected String doInBackground(String... params) { String comment = params[0]; Log.i(TAG_STRING, "Comment is " + comment); String response = null; Socket socket = null; try { socket = new Socket("www.regisscis.net", 8080); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); DataInputStream in = new DataInputStream(socket.getInputStream()); Log.i(TAG_STRING, "Calling Write"); out.writeBytes(comment); out.flush(); String resposeFromServer = in.readUTF(); out.close(); in.close(); response = resposeFromServer; socket.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return response; } Would anyone know what I am doing wrong,
type: Question
type: AnsweredQuestion
has title: Write a String Message to Remote Server Using Socket in Android
tagged with: sockets
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25344812
accepted answer: http://stackoverflow.com/a/25344812
score: 0

http://stackoverflow.com/a/27258414
has comment: http://stackoverflow.com/comment/123132050
upvote count: 57
type: Answer
answers question: http://stackoverflow.com/q/25379051
has comment: http://stackoverflow.com/comment/92046792
has comment: http://stackoverflow.com/comment/81671641
has body: Keep it compact: You can evict multiple caches by enumerating them inside the @CacheEvict annotation: @CacheEvict(value = { "cache1", "cache2" }, allEntries = true)
score: 56
downvote count: 1

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25333795
tags question: http://stackoverflow.com/q/25231752
type: Tag

http://stackoverflow.com/a/25234517
has body: There is a slight difference between the two options. In the first option, the part elseif(obj.getData==null) will be executed whether object.getType is null or not. But, in the second option, the block will be executed only if object.getType is not null. So, I think it depends upon your requirement.
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39311071
has comment: http://stackoverflow.com/comment/39310039
type: Answer
answers question: http://stackoverflow.com/q/25234401

http://stackoverflow.com/q/25310030
tagged with: stack-overflow
favorite count: 0
has answer: http://stackoverflow.com/a/25312622
type: Question
has comment: http://stackoverflow.com/comment/39450903
has comment: http://stackoverflow.com/comment/39451106
score: 5
upvote count: 5
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/25320441
type: AnsweredQuestion
tagged with: sql
answer count: 2
has title: Stackoverflow with Hibernate using sql IN (id, id, id, id..id)
has answer: http://stackoverflow.com/a/25320441
downvote count: 0
tagged with: mysql
has body: I am getting the error below saying there was a stack overflow. This is happening because a SQL statement with IN (id, id, id...id) has a ton of parameters. Is there anyway to fix this? This is happening in my local environment with Eclipse. JPA @Query(value="SELECT p FROM PendingCourseRegistration p WHERE p.sisId IN ?1 AND p.testId = ?2") List<PendingCourseRegistration> findPendingCourseRegistrationInSisIdsAndTestId(List<String> sisIds, Long testID); Error java.lang.StackOverflowError: null at java.lang.Abstract witingBuilder.append(AbstractStringBuilder.java:416) ~[na:1.7.0_17] at java.lang.StringBuffer.append(StringBuffer.java:237) ~[na:1.7.0_17] at antlr.BaseAST.toStringList(BaseAST.java:341) ~[antlr-2.7.7.jar:na] at antlr.BaseAST.toStringList(BaseAST.java:347) ~[antlr-2.7.7.jar:na] at antlr.BaseAST.toStringList(BaseAST.java:347) ~[antlr-2.7.7.jar:na] at antlr.BaseAST.toStringList(BaseAST.java:347) ~[antlr-2.7.7.jar:na] Hibernate Query 2:26.763 [ocPifScheduler-1] DEBUG o.s.o.j.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler - Creating new EntityManager for shared EntityManager invocation 09:52:26.788 [Scheduler-1] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - parse() - HQL: SELECT p FROM com.test.PendingCourseRegistration p WHERE p.sisId IN (:x10_, :x11_, :x12_, :x13_, :x14_, :x15_, :x16_, :x17_, :x18_, :x19_, :x110_, :x111_, :x112_, :x113_, :x114_, :x115_, :x116_, :x117_, :x118_, :x119_, ...:xN) AND p.id = ?2 09:52:26.891 [Scheduler-1] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - --- HQL AST --- \-[QUERY] Node: 'query' +-[SELECT_FROM] Node: 'SELECT_FROM' | +-[FROM] Node: 'FROM' | | \-[RANGE] Node: 'RANGE' | | +-[DOT] Node: '.' | | | +-[DOT] Node: '.' | | | | +-[DOT] Node: '.' | | | | | +-[DOT] Node: '.' | | | | | | +-[DOT] Node: '.' | | | | | | | +-[DOT] Node: '.' | | | | | | | | +-[IDENT] Node: 'com' | | | | \-[IDENT] Node: 'model' | | | \-[IDENT] Node: 'PendingCourseRegistration' | | \-[ALIAS] Node: 'p' | \-[SELECT] …
accepted answer: http://stackoverflow.com/a/25312622

http://stackoverflow.com/a/25370625
type: AcceptedAnswer
type: Answer
score: 2
has body: Your shell script file doesn't seem to have a shebang line, #!/usr/bin/env bash java -cp bin Main read -n1 -r ip "Press any key to continue..." key and make sure it has a execute permissions chmod a+x &lt;script_file&gt;
accepted answer of: http://stackoverflow.com/q/25370596
downvote count: 0
answers question: http://stackoverflow.com/q/25370596
upvote count: 2

http://stackoverflow.com/comment/39419604
comment on: http://stackoverflow.com/a/25292746
type: Comment
has text: I can try it tomorrow and check how it works. Thank you for this idea. Can you explain why I shouldn't use recursive algorithm for it ? And how I should use this function ? What to do with returned visited queue ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/25377900
has body: The problem here is that the property file we use has insanely huge name as the key and most of us run into incorrect key naming issues . so it got me thinking if there's a way to generate the following interface based on the property file. Every change we make to the property file will auto-adjust the Properties interface. Or is there other solution? Property File A=Apple B=Bannana C=Cherry Should Generate The following Interface interface Properties{ public static final String A = "A" // keys public static final String B = "B"; public static final String C = "C"; } So in my application code String a_value = PROP.getString(Properties.A);
has comment: http://stackoverflow.com/comment/39575773
has answer: http://stackoverflow.com/a/25378141
tagged with: properties-file
answer count: 2
upvote count: 2
score: 2
has answer: http://stackoverflow.com/a/25386253
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has title: How to create a dynamic Interface with properties file at compile time?
tagged with: java
has comment: http://stackoverflow.com/comment/39575987

http://stackoverflow.com/a/29615905
type: Answer
answers question: http://stackoverflow.com/q/25292272
has body: For future reference, this issue was filed as GRIZZLY-1703
upvote count: 0
accepted answer of: http://stackoverflow.com/q/25292272
type: AcceptedAnswer
downvote count: 1
score: -1

http://stackoverflow.com/q/25290790
tagged with: android
has comment: http://stackoverflow.com/comment/39538991
has comment: http://stackoverflow.com/comment/39540248
tagged with: android-alertdialog
has title: Building Alert dialog leads to exception when called from TimerTask - Android
tagged with: gps
score: 0
has comment: http://stackoverflow.com/comment/39538289
answer count: 0
tagged with: java
has body: My app originally got GPS coordinates when clicking on one button. In my activity I am getting my click this way (everything is working fine): @Override public void onClick(View arg0) { // create class object gps = new GPSTracker(AndroidGPSTrackingActivity.this); // check if GPS enabled if(gps.canGetLocation()){ double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); }else{ // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } }); GPSTracker is a Service which implements LocationListener and showSettingAlert() build my Alert dialog (if network and gps permissions are not set up) as below public void showSettingsAlert(){ AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext); // Setting Dialog Title alertDialog.setTitle("GPS is settings"); // Setting Dialog Message alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?"); // On pressing Settings button alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); mContext.startActivity(intent); } }); // on pressing cancel button alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); } Now I need to do it every minute so I included one timerTask but when I try and build my Alert dialog I get a null pointer exception here: AlertDialog.Builder alertDialog = new AlertDialog.Builder(MyApp.getContext()); MyApp extends Application because I need to have the context everywhere. My problem seems to be that when I cannot instantiate AlertDialog.Builder …
has comment: http://stackoverflow.com/comment/39419185
type: Question
has comment: http://stackoverflow.com/comment/39538820
type: UnansweredQuestion

http://stackoverflow.com/comment/39484082
type: Comment
comment on: http://stackoverflow.com/a/25328021
score: 0
type: AnswerComment
has text: @JonK It will throw an exception in this case, and then it would expect a new input to be entered.

http://stackoverflow.com/comment/39523604
score: 0
has text: DB2 of course supports sequences -- that's standard SQL. The bigger question is, why do you use Oracle to develop an application for DB2?
comment on: http://stackoverflow.com/q/25344826
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39368164
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25265781
has text: I do know how the two loops work separately. I just want to know how do they work when they interact with each other specially in this program.
type: Comment

http://stackoverflow.com/a/25338846
answers question: http://stackoverflow.com/q/25231177
has comment: http://stackoverflow.com/comment/39505627
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25231177
has body: There are default behaviours that JAXB will use to map classes that aren't annotated. You only need annotations if the mapping you want to define doesn't follow these defaults (e.g. if you want to map anything to attributes rather than elements, or override the element names, add wrapper elements round collections, etc.).
has comment: http://stackoverflow.com/comment/39506555
type: AcceptedAnswer

http://stackoverflow.com/a/25269937
answers question: http://stackoverflow.com/q/25269907
type: AcceptedAnswer
score: 1
has body: You need to add a + before each value you add, so a + after raza (not just before), peso and so on. Thats how string concatenation works in Java. Like this: System.out.println ("El Peso de la" + raza + "es de " + peso + "kg y se alimenta de " + alimeto); See How do I concatenate two strings in Java? http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25269907
upvote count: 2

http://stackoverflow.com/a/25289991
has comment: http://stackoverflow.com/comment/39521148
score: 0
answers question: http://stackoverflow.com/q/25281054
type: Answer
accepted answer of: http://stackoverflow.com/q/25281054
has comment: http://stackoverflow.com/comment/39522526
has comment: http://stackoverflow.com/comment/39576671
has body: You need to enable CORS configuration in the api-manager.xml. And if you use IP address there to indicate "access allow origin parameters" you should use IP address to access api-store portal.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39556704
has comment: http://stackoverflow.com/comment/39548177

http://stackoverflow.com/q/25236272
score: -1
has comment: http://stackoverflow.com/comment/39313816
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39315135
tagged with: onclicklistener
has comment: http://stackoverflow.com/comment/39313408
has comment: http://stackoverflow.com/comment/39313452
upvote count: 0
tagged with: java
tagged with: button
has comment: http://stackoverflow.com/comment/39313392
has title: Android Button OnClickListener Null Pointer
downvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/39314731
has comment: http://stackoverflow.com/comment/39313340
type: Question
has body: Within my onCreate method: add = (Button)findViewById(R.id.add); add.setOnClickListener(new MyOnClickListener()); //null pointer here public class MyOnClickListener implements OnClickListener { @Override public void onClick(View v) { //send information to database } } XML File &lt;Button android:id="@+id/add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/hello" android:layout_alignBottom="@+id/hello" android:layout_alignRight="@+id/id" android:layout_marginRight="72dp" android:text="Add" /&gt; I know there are two ways to do it one using the XML attribute and the other way is the one I chose using setOnClickListener. I read another post and it said to clean the project however I am still getting a null pointer exception. What is wrong?
tagged with: android
has answer: http://stackoverflow.com/a/25236296
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/23653778

http://stackoverflow.com/comment/39397608
has text: Note- By default crontab sends a mail to user account executing the cronjob, why dont you make use of it?
comment on: http://stackoverflow.com/q/25281683
type: QuestionComment
type: Comment
score: 0

jface
tags question: http://stackoverflow.com/q/25241236
tags question: http://stackoverflow.com/q/25278907
tags question: http://stackoverflow.com/q/25384809
tags question: http://stackoverflow.com/q/25239279
tags question: http://stackoverflow.com/q/25313396
tag name: jface
tags question: http://stackoverflow.com/q/25382699
tags question: http://stackoverflow.com/q/25259409
tags question: http://stackoverflow.com/q/25280256
type: Tag
tags question: http://stackoverflow.com/q/25246991

http://stackoverflow.com/q/25313837
type: AnsweredQuestion
tagged with: primefaces
score: 0
tagged with: java
answer count: 1
has title: Primefaces 5 FileUploadEvent, not all files are uploading
has comment: http://stackoverflow.com/comment/39463698
type: Question
accepted answer: http://stackoverflow.com/a/25317387
has answer: http://stackoverflow.com/a/25317387
tagged with: multifile-uploader
tagged with: http://stackoverflow.com/tag/xhtml
has body: I am developing a page in Primefaces 5 and using p:fileUpload tag in advanced mode to upload multiple files. I have got the file upload working fine, but while I was testing I noticed that sometimes not all the files were actualy uploaded. Ex: I upload 6 files and only 4 files actually upload. As I was looking through the trace log I also noticed that the method only ran 4 times (previous example), leading me to believe that only 4 ajax requests out of the expected 6 where made. In Page &lt;h:form enctype="multipart/form-data"&gt; &lt;p:fileUpload fileUploadListener="#{fileUploaderBean.uploadFile}" mode="advanced" dragDropSupport="true" multiple="true" update="filesId" sizeLimit="100000" ajax="true"/&gt; &lt;p:outputPanel id="filesId"&gt; &lt;p:dataTable value="#{fileUploaderBean.uploadedFiles}" var="uploadedFile" id="filesTable" action="#{fileUploaderBean.testAjax}"&gt; &lt;p:column headerText="Uploaded File/s"&gt; &lt;h:outputText value="#{uploadedFile}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;/p:outputPanel&gt; Bean private List&lt;UploadedFile&gt; filesList = Collections.synchronizedList(new ArrayList&lt;UploadedFile&gt;()); private List&lt;String&gt; uploadedFiles = Collections.synchronizedList(new ArrayList&lt;String&gt;()); public void uploadFile (FileUploadEvent fileUploadEvent) throws IOException { LOGGER.info("Running uploadFile fileUploadEvent={}", fileUploadEvent); saveFileToStagingFolder(fileUploadEvent.getFile().getFileName(), fileUploadEvent.getFile().getInputstream()); uploadedFiles.add(fileUploadEvent.getFile().getFileName()); LOGGER.info("uploadFile process complete"); }

http://stackoverflow.com/q/25295006
has comment: http://stackoverflow.com/comment/39422364
has comment: http://stackoverflow.com/comment/39424202
has answer: http://stackoverflow.com/a/25297029
tagged with: objectoutputstream
tagged with: objectinputstream
type: Question
tagged with: client-server
answer count: 1
has title: ObjectOutputStream - client/server communication
has body: I am new to java client server communications and I'm confronted with sending an object from client side to server side. Somehow my programm stucks while trying to transfer an object. The likely reason might be the ObjectOutputStream implementation. Database login button class Handler implements ActionListener { Client client = new Client(); List&lt;String&gt; parameterList = new ArrayList&lt;String&gt;(); ClientParameter parameter; public void actionPerformed(ActionEvent event) { if(event.getSource()==buttonConnect) { parameterList.add(username); parameterList.add(password); parameter = new ClientParameter(parameterList); client.connectToServer(parameter); } Object ClientParameter public class ClientParameter { List&lt;String&gt; parameterList; public ClientParameter(List&lt;String&gt; parameterList) { this.parameterList = parameterList; } public List&lt;String&gt; getParameterList() { return parameterList; } public void setParameterList(List&lt;String&gt; parameterList) { this.parameterList = parameterList; } } Class client public void connectToServer(ClientParameter parameter) { // Verbindung mit dem Server herstellen Socket server = null; try { server = new Socket("localhost", 3141); // programm hangs while reading this 2 lines.. ObjectInputStream objectIn = new ObjectInputStream(server.getInputStream()); ObjectOutputStream objectOut = new ObjectOutputStream(server.getOutputStream()); objectOut.writeObject(parameter); } catch(UnknownHostException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } finally { if(server!=null) { try { server.close(); } catch(IOException e) { System.out.println(e); } } } } And the server class public class Server { private static void handleConnection(Socket client) throws IOException { ObjectInputStream objectIn = new ObjectInputStream(client.getInputStream()); ObjectOutputStream objectOut = new ObjectOutputStream(client.getOutputStream()); ClientParameter parameter; try { parameter = (ClientParameter) objectI…
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39422864
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25297029

http://stackoverflow.com/q/25349181
has title: How to cancel CountDown Timer when home button is pressed?
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/25349209
has answer: http://stackoverflow.com/a/25349209
type: AnsweredQuestion
score: 0
has body: In my game I have a countdown timer, and when I press home button and leave the game, the timer goes on and when it hits 0 my game pops back on, cause the time is up, and I get some info screen for time up. How to kill the timer at least when I hit the home button? I tried with this but it didn't work: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_HOME) { timer.cancel(); return true; } return super.onKeyDown(keyCode, event); }
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39521796

http://stackoverflow.com/a/26737369
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25366009
type: Answer
score: 2
has body: Well, a little bit late, but why your compiler complained about your code is not only because you used a fixed-size (immutable) List as a parameter in your copy method. List&lt;Object&gt; obj = Arrays.&lt;Object&gt;asList(23, "456", 56.89); Collections.copy(obj, intb); It is also because of your (copy) method declaration. public static &lt;T&gt; void copy(List&lt;? super T&gt; des,List&lt;? extends T&gt; scr) { The declaration above has two lists with wildcards. When you use wildcard type &lt;?&gt;, you give message to the compiler that you are ignoring the type information. Whenever you pass arguments to a generic type, the java compiler tries to infer the type of the passed argument as well as the type of the generics and to justify the type safety. Now,(in your copy method) you are trying to use the add() method to insert an element in the list. Since des(your destination list) doesn't know the exact type of object it holds, it is risky to add elements to it. Generics was introduced in the language to ensure type safety in the first place. So you can not use methods like add that modifies the object. I hope the default implementation of the copy method in the java.util.Collections will help clarify it. public static &lt;T&gt; void copy(List&lt;? super T&gt; dest, List&lt;? extends T&gt; src) { int srcSize = src.size(); if (srcSize &gt; dest.size()) throw new IndexOutOfBoundsException("Source does not fit in dest"); if (srcSize &lt; COPY_THRESHOLD || (src instanceof RandomAccess &amp;&amp; dest instanceof RandomAccess)) { for (int i=0; i&lt;srcSize; i++) dest.set(i, src.get(i)); } else { ListIterator&lt;? super T&gt; di=dest.listIterator(); ListIterator&lt;? extends T&gt; si=src.listIterator(); for (int i=0; i&lt;srcSize; i++) { di.next(); di.set(si.next()); } } } I know there already exists the same code block, but there was no explanation for what is the reason behind why we can't use methods like add on Lists with wildcards, and that is mainly to protect type s…

http://stackoverflow.com/comment/39510970
has text: can you do the cssquery with doc.select(); method?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25342632
score: 0

http://stackoverflow.com/a/25250953
has comment: http://stackoverflow.com/comment/39354294
score: 0
type: Answer
has body: It's all about the name of the attributes inside the JSON document your controller will receive. On your action parameters, the type of the parameter must have attributes which will match with the name of the fields on the JSON document it will receive. For example: take a look at this action: @RequestMapping(value="texte/updateMyObject", method=RequestMethod.POST) String doSomething(Person person) { } The person class will look like this: class Person { String name; int age; //getters and setters } Your JSON document must be something like this: {'name':'Henrique', 'age':35}
has comment: http://stackoverflow.com/comment/39349175
has comment: http://stackoverflow.com/comment/39342733
answers question: http://stackoverflow.com/q/25247228

http://stackoverflow.com/comment/39404339
has text: 08-13 11:39:48.007 820-869/com.Office.bilawalkhan.projectmanagment E/JSON Parser﹕ Error parsing data org.json.JSONException: Value Hello of type java.lang.String cannot be converted to JSONObject –
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25282738
score: 0

http://stackoverflow.com/q/25293288
has answer: http://stackoverflow.com/a/25331145
type: Question
type: UnansweredQuestion
tagged with: couchbase
score: 0
has title: Subclassing AbstractCouchbaseEventListener event problems
has body: I'm exploring the option of subclassing the AbstractCouchbaseEventListener to include custom document/entity lifecycle actions. I'm fairly new to Spring so I realize that this may be a sub-optimal way to do this (if it is, what would be a better or more common Spring way?). Currently I'm looking at setting/removing reference documents for entities as they are saved / deleted. For current purposes by "reference document" I mean a document that maps a particular entity classes unique key value to the document that contains it: if User.username is "billyTheKid" and User.id is 12345 then the document User:by:username:12345 contains 12345 and so serves as a pointer to the User document. My current approach is to have an interface ReferenceDocumentOwner that can be implemented by any entity class that wants to store reference documents: public interface ReferenceDocumentOwner&lt;T, R&gt; extends BasicDocument { /* Store the existing (stored) version of the entity. This is called in onBeforeSave() to populate the about-to-be saved instance with its stored version. This previous version can be used to determine the fields and values to populate the returns of getDeleteRefDocMap() and getStoreRefDocMap(). */ public void storePreviousRecord(T recorded); public Class&lt;R&gt; getRepositoryClass(); /* For values that used to be non-empty but are now empty. For example, if the concrete implementation of this interface was User.class and this method returned: electricServiceId =&gt; 12345, garbageServiceId =&gt; AKIE3423 The reference documents {@code User:by:electricServiceId:12345} and {@code User:by:garbageServiceId:AKIE3423} would be deleted in onAfterSave(). */ public Map&lt;String, Object&gt; getDeleteRefDocMap (); /* For values that are non-empty. For example, if the concrete implementation of this interface was User.class and this method returned: email =&gt; someEmailValue, garbageServiceId =&gt; AKIE3423, username =&gt; billyTheKid The reference documents {@code User:by…
tagged with: java
tagged with: spring-data-couchbase
answer count: 1

http://stackoverflow.com/a/25384649
has comment: http://stackoverflow.com/comment/39588756
accepted answer of: http://stackoverflow.com/q/25383751
has comment: http://stackoverflow.com/comment/39588712
answers question: http://stackoverflow.com/q/25383751
has comment: http://stackoverflow.com/comment/58917676
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39588399
has comment: http://stackoverflow.com/comment/39588326
has body: You need to implement your own copy command. Here is the solution. import java.awt.Component; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; public class TableDemo { public static void main(String[] args) { final Vector&lt;String&gt; values = new Vector&lt;String&gt;(); values.add("Val1"); values.add("Val2"); final JTable table = new JTable(new Object[][] { { "key", values }, { "key2", values } }, new String[] { "Col1", "Col2" }); table.getColumnModel().getColumn(1).setCellRenderer(new MyTableCellRenderer()); table.registerKeyboardAction(new CopyAction(), KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_FOCUSED); table.setCellSelectionEnabled(true); final JFrame jf = new JFrame(); jf.getContentPane().add(table); jf.setSize(500, 500); jf.setVisible(true); } private static class CopyAction extends AbstractAction { /** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent e) { final JTable tbl = (JTable) e.getSource(); final int row = tbl.getSelectedRow(); final int col = tbl.getSelectedColumn(); if (row &gt;= 0 &amp;&amp; col &gt;= 0) { final TableCellRenderer renderer = tbl.getCellRenderer(row, col); final Component comp = tbl.prepareRenderer(renderer, row, col); if (comp instanceof JLabel) { final String toCopy = ((JLabel) comp).getText(); final StringSelection selection = new StringSelection(toCopy); final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); } } } } } @SuppressWarnings("serial") class …
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25239362
upvote count: 15
type: Question
has body: I observed a strange behaviour of java.util.GregorianCalendar, and I wonder why it behaves so. I wanted to get the time in UTC, which is the same instant as 26.10.2014 01:00 CET and then get UTC midnight for the same day. So first I set the actual CET date, than changed the timezone to UTC, and finally set the HOUR_OF_DAY to 0. Example: 26.10.2014 01:00 CET is the same as 25.10.2014 23:00 UTC midnight(25.10.2014 23:00 UTC) should be 25.10.2014 00:00 UTC see junit code below: @Test public void testWeird() { GregorianCalendar date = (GregorianCalendar) GregorianCalendar.getInstance(TimeZone.getTimeZone("CET")); date.set(2014, 9, 26, 1, 0, 0); //26.10.2014 System.out.println(date.getTime().toGMTString() + " " + date.getTimeInMillis()); // 25 Oct 2014 23:00:00 GMT 1414278000764 (OK) date.setTimeZone(TimeZone.getTimeZone("UTC")); //date.get(Calendar.YEAR); // uncomment this line to get different results System.out.println(date.getTime().toGMTString() + " " + date.getTimeInMillis()); // 25 Oct 2014 23:00:00 GMT 1414278000764 (OK) date.set(Calendar.HOUR_OF_DAY, 0); System.out.println(date.getTime().toGMTString() + " " + date.getTimeInMillis()); // 26 Oct 2014 00:00:00 GMT 1414281600764 (NOT OK! why not 25 Oct 2014 00:00:00 GMT 1414195200218 ?) } I expected that setting hour=0 on 25.10.2014 23:00 GMT will give me 25.10.2014 00:00 GMT, but it changed to 26.10.2014 00:00 GMT. However, if I uncomment line date.get(Calendar.YEAR);, the date seems to be calculated correctly. The same happens on jdk.1.7.0_10 and jrockit-jdk1.6.0_37.
has comment: http://stackoverflow.com/comment/39324283
answer count: 2
accepted answer: http://stackoverflow.com/a/25258625
tagged with: gregorian-calendar
has answer: http://stackoverflow.com/a/25258625
has comment: http://stackoverflow.com/comment/39322684
has comment: http://stackoverflow.com/comment/39322784
score: 14
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25241030
has comment: http://stackoverflow.com/comment/39331798
tagged with: java
has answer: http://stackoverflow.com/a/25241030
has comment: http://stackoverflow.com/comment/39322813
has title: Why GregorianCalendar changes day when setting HOUR_OF_DAY to 0 in UTC?
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39494423
comment on: http://stackoverflow.com/a/25323589
type: Comment
has text: @Luaan: Please look at the correction Christian made.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25261957
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: If you want the image to fit the entire Jpanel, you should use the following: public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(new Color(230, 100, 100)); g.fillRect(0, 0, 200, 100); g.drawImage(image, 0, 0, getWidth(), getHeight(), null); } This will make your image to be scaled to the whole Jpanel. Of course, you will not see the rectangle because the image will be drawn over it. Also, be sure to actually put something in your image.
accepted answer of: http://stackoverflow.com/q/25261212
type: Answer
answers question: http://stackoverflow.com/q/25261212
score: 1

http://stackoverflow.com/a/25297388
has comment: http://stackoverflow.com/comment/39460419
has comment: http://stackoverflow.com/comment/39456720
has body: The second example does not compile unless you throw the exception from the method, because FileNotFoundException is a checked exception. Compile.java:5: error: unreported exception FileNotFoundException; must be caught or declared to be thrown FileInputStream fis = new FileInputStream("some.file"); The first example also does not compile, because you are missing the appropriate catch block. Here is a compiling example. import java.io.*; public class Compile { public static void main(String[] args) { FileInputStream fis = null; try { fis = new FileInputStream("some.file"); // do something useful with fis if (fis != null) { fis.close(); } } catch (FileNotFoundException fnf) { } catch (IOException ioe) { } finally { } } }
answers question: http://stackoverflow.com/q/25297333
type: Answer
has comment: http://stackoverflow.com/comment/39436175
has comment: http://stackoverflow.com/comment/39428310
has comment: http://stackoverflow.com/comment/39427174
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39427189

http://stackoverflow.com/comment/39429362
type: QuestionComment
comment on: http://stackoverflow.com/q/25298537
score: 0
has text: but do you find it bizarre that tomcat undeploys wars after i end ssh session, but as soon as I ssh in again the wars are deployed. I don't need to restart tomcat, it just auto deploys again.
type: Comment

http://stackoverflow.com/comment/39529152
has text: Pretty nice, but I doubt this is worth the trouble.
comment on: http://stackoverflow.com/a/25353028
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25231947
type: Answer
accepted answer of: http://stackoverflow.com/q/25231752
score: 0
type: AcceptedAnswer
has body: When you perform "Find Usages" search (Alt+F7) for the class (Dao), you can click on search preferences button. There you can choose to find usages of the method That should do the trick
answers question: http://stackoverflow.com/q/25231752

http://stackoverflow.com/comment/72439548
type: QuestionComment
has text: If a connection/channel is closed, unacked messages are pushed back to the origin queue.
comment on: http://stackoverflow.com/q/25262449
type: Comment
score: 0

http://stackoverflow.com/q/25306191
tagged with: java
tagged with: pkcs#11
has comment: http://stackoverflow.com/comment/40263544
downvote count: 0
has title: PKCS#11 instantiation problems
tagged with: digital-signature
favorite count: 0
score: 9
type: Question
has answer: http://stackoverflow.com/a/26224052
has comment: http://stackoverflow.com/comment/39479301
answer count: 2
has comment: http://stackoverflow.com/comment/39481006
upvote count: 9
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39462396
has comment: http://stackoverflow.com/comment/40365306
has comment: http://stackoverflow.com/comment/39480399
tagged with: cryptography
has body: I am trying to sign a pdf file using the smart card and PKCS#11. I link the right .dll and I am making a configuration file dynamically, but I am running into configuration trouble. String config = "name=zz\n" + "library=" + DLL + "\n" + "slotListIndex = " + getSlotsWithTokens(DLL)[0]; ByteArrayInputStream pot = new ByteArrayInputStream(config.getBytes()); Provider providerPKCS11 = new SunPKCS11(pot); and I get the following error: Exception in thread "main" java.security.ProviderException: Initialization failed at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:376) at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:107) at smartCardPKCS11.scPKCS11.main(scPKCS11.java:56) Caused by: java.security.ProviderException: slotListIndex is 52481 but token only has 10 slots at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:357) ... 2 more bit confused on the whole slots thing. Can someone help me out? This how my getSlotsWithTokens looks: public static long[] getSlotsWithTokens(String libraryPath) throws IOException{ CK_C_INITIALIZE_ARGS initArgs = new CK_C_INITIALIZE_ARGS(); String functionList = "C_GetFunctionList"; initArgs.flags = 0; PKCS11 tmpPKCS11 = null; long[] slotList = null; try { try { tmpPKCS11 = PKCS11.getInstance(libraryPath, functionList, initArgs, false); } catch (IOException ex) { ex.printStackTrace(); throw ex; } } catch (PKCS11Exception e) { try { initArgs = null; tmpPKCS11 = PKCS11.getInstance(libraryPath, functionList, initArgs, true); } catch (IOException ex) { ex.printStackTrace(); } catch (PKCS11Exception ex) { ex.printStackTrace(); } } try { slotList = tmpPKCS11.C_GetSlotList(true); for (long slot : slotList){ CK_TOKEN_INFO tokenInfo = tmpPKCS11.C_GetTokenInfo(slot); System.out.println("slot: "+slot+"\nmanufacturerID: " + String.valueOf(tokenInfo.manufacturerID) + "\nmodel: " + String.valueOf(tokenInfo.model)); } } catch (PKCS11Exception ex) { ex.printStackTrace(); } catch (Throwable t) { t.printStackTrace(); } return …
has comment: http://stackoverflow.com/comment/126225179
has answer: http://stackoverflow.com/a/29215677

http://stackoverflow.com/comment/39492924
score: 1
type: Comment
has text: @user3907211 Why don't you try adding `onActivityCreated` to your fragment?
comment on: http://stackoverflow.com/a/25332299
type: AnswerComment

http://stackoverflow.com/comment/39509225
comment on: http://stackoverflow.com/q/25341361
type: QuestionComment
type: Comment
has text: Suppose n=3 and m=3 then print 111%3
score: 0

http://stackoverflow.com/q/25374588
tagged with: java
has answer: http://stackoverflow.com/a/25375817
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39569880
answer count: 2
has title: App says Image Downloaded Successfully but no image shows up in gallery
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39569780
has answer: http://stackoverflow.com/a/25376121
has body: The app gets the image from the given URL and displays the image and on clicking the download button, it says that the image has been downloaded successfully but there is no image in the gallery. Can someone tell me how I can fix this? This is my Image View and Download activity. I have also added proper permissions to the Android Manifest. private Button btnImageDownload; private ProgressDialog pd; private ImageView viewDownloadImage; private Images imageId; private File folderName; private String imageName; private Handler handler = new Handler() { public void handleMessage(android.os.Message msg) { if (msg.what == 1) { if (pd != null) { pd.dismiss(); } Utils.showNetworkAlert(ImageViewAndDownload.this); } else if (msg.what == 2) { if (pd != null) { pd.dismiss(); } Utils.displayMessage("Image downloade succesfully", ImageViewAndDownload.this); // Media scaning sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); } else if (msg.what == 3) { if (pd != null) { pd.dismiss(); } Utils.displayMessage("Image already downloaded ", ImageViewAndDownload.this); } else if (msg.what == 4) { if (pd != null) { pd.dismiss(); } displayImageFromUrl((Bitmap) msg.obj); } } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.imagedisplay); viewDownloadImage = (ImageView) findViewById(R.id.viewImage); btnImageDownload = (Button) findViewById(R.id.btnImageDownload); imageId = new Images(); imageName = imageId.getImageId(); LoadImageFromWeb(Constant.IMAGE_BASE_URL + File.separator + imageName); btnImageDownload.setOnClickListener(this); } public void onClick(View v) { if (v == btnImageDownload) { pd = ProgressDialog.show(ImageViewAndDownload.this, "", "Downloading Image....", true, false); new Thread(new Runnable() { public void run() { try { String imageUrl = Constant.IMAGE_BASE_URL + File.separator + imageName; String isDownloded = download…
score: 0

http://stackoverflow.com/comment/39338764
type: AnswerComment
has text: How could I extract the variable name "team" for example, to compare it to know what value to insert.
type: Comment
comment on: http://stackoverflow.com/a/25249183
score: 0

http://stackoverflow.com/q/25311938
has comment: http://stackoverflow.com/comment/39455549
type: Question
has comment: http://stackoverflow.com/comment/39455533
type: UnansweredQuestion
tagged with: swing
score: 0
has body: I am currently trying to insert a progress bar into my java gui. However, when I click on the "START" button, the progress bar does not run. All the different batch files running in the cmd has to finish then the progress bar runs. But what's the point? I want it to run when the "START" button is pressed and when all the different batch files running in the cmd ends, the progress bar stops too. Here's my code: JLabel ProgressBar = new JLabel("Progress Bar: "); ProgressBar.setFont(new Font("Arial", Font.BOLD, 12)); ProgressBar.setBounds(100, 285, 180, 53); contentPane.add(ProgressBar); final JProgressBar aJProgressBar = new JProgressBar(JProgressBar.HORIZONTAL); aJProgressBar.setBounds(185,305,184,15); contentPane.add(aJProgressBar); //when start button is selected btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent args) { //the process starts JStartTimeTextField.setText(dateFormat.format(date)); //the progress bar should show it running (by right) aJProgressBar.setIndeterminate(true); try { //create new process String command = "cmd /c start /wait" +DetectDrive+"\\starting.bat"; //run process Process p = Runtime.getRuntime().exec(command); //cause this process to stop until process p is terminated p.waitFor(); } catch (IOException | InterruptedException e1) { e1.printStackTrace(); } ...... Date newDate = new Date(); JStartTimeTextField.setText(dateFormat.format(newDate)); //the progress bar should stop running (by right) //aJProgressBar.setIndeterminate(false); } }); So by right... The startTime should show and the progress bar should be running when the "START" button is clicked. However, only when all the batch files in the cmd finishes running then startTime will show. But for now, the Progress Bar is my priority. How can I make it that when the "START" button is clicked, the progress bar runs and when all finish, then the progress bar stops? Any help given will be greatly appreciated!
tagged with: windows
tagged with: java
answer count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/25312192
has title: How do I make my progress bar run when the "START" button is clicked?
tagged with: cmd

http://stackoverflow.com/comment/39425505
comment on: http://stackoverflow.com/q/25296038
score: 0
type: Comment
type: QuestionComment
has text: @JB Nizet: Why does your input has 4 back slashes? On Server side, when i get back the value i see 2 back slashes instead of 1.

http://stackoverflow.com/q/25349574
has comment: http://stackoverflow.com/comment/39634907
upvote count: 3
tagged with: android
tagged with: java
has title: Android Studio says "Cannot resolve symbol" when trying to access method in imported library
linked to: http://stackoverflow.com/q/39353857
has comment: http://stackoverflow.com/comment/39634743
tagged with: gradle
linked to: http://stackoverflow.com/q/20154698
has answer: http://stackoverflow.com/a/25367294
tagged with: android-studio
type: Question
has comment: http://stackoverflow.com/comment/39523041
has comment: http://stackoverflow.com/comment/39522753
has comment: http://stackoverflow.com/comment/39635207
has body: I'm running Android Studio 0.8.6 and imported two Firebase libraries, to use in my project. I manage to create objects of Firebase Simple Login classes, and also default Firebase objects. However. When I try to access any method of these object, Android Studio stubbornly says "Cannot resolve symbol ". This is my code (it's basically Firebase quick start sample code): Firebase myRef = new Firebase("https://xxxxxxxx.firebaseIO.com/"); SimpleLogin authClient = new SimpleLogin(myRef, this); authClient.checkAuthStatus(new SimpleLoginAuthenticatedHandler() { @Override public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) { if (error != null) { // Oh no! There was an error performing the check } else if (user == null) { // No user is logged in } else { // There is a logged in user } } }); authClient.createUser("email@example.com", "very secret", new SimpleLoginAuthenticatedHandler() { public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) { if(error != null) { // There was an error creating this account } else { // We created a new user account } } }); It is the methods '.checkOutStatus' and '.createUser' which cannot be resolved. I've been trying every way descibed here on SO to fix it, but nothing worked out. I also attach my build.gradle file beneath: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { minSdkVersion 16 targetSdkVersion 19 } } dependencies { // Support Libraries compile 'com.android.support:appcompat-v7:19.1.0' compile files('libs/firebase-simple-login-1.4.1.jar') compile files('libs/firebase-client-jvm-1.0.16.jar') compile fileTree(dir: 'libs', include: ['*.jar']) } Thanks in advance! :)
answer count: 2
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39523186
has comment: http://stackoverflow.com/comment/39522776
has comment: http://stackoverflow.com/comment/39522998
favorite count: 0
has comment: http://stackoverflow.com/comment/39634603
tagged with: firebase
score: 3
has comment: http://stackoverflow.com/comment/39634430
has answer: http://stackoverflow.com/a/41866858

http://stackoverflow.com/comment/39587050
comment on: http://stackoverflow.com/q/25383945
type: Comment
type: QuestionComment
score: 0
has text: Of course. That's not a design issue. This is just a simplify example, normally my class have several state and considering several input as well. If you are familiar with finite state machine, that's exactly what I'm implementing.

http://stackoverflow.com/q/25248981
upvote count: 0
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/25265973
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39414747
has comment: http://stackoverflow.com/comment/39368075
has body: I'm currently trying to generate PDF with PDFBox for some manual cover and I was wondering if it was possible to take a precise zone of text in my PDF and move it (to the left) depending on my manuel thickness (which will be determined by the number of pages my manual will have) I manage to create my PDF just fine, but I did not find a way to get only a block of text. Is it possible to do so with PDFBox? Note : I tried to search on the web and on other questions, but none of them were useful. Thanks
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39373200
score: -1
has comment: http://stackoverflow.com/comment/39353286
tagged with: pdfbox
tagged with: pdf-generation
has answer: http://stackoverflow.com/a/25257494
has title: How to move block of text in a PDF (using PDFBox)
answer count: 2

http://stackoverflow.com/a/26574980
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25272664
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25272664
has body: Im kinda late but here is the solution i found:i actually solved the problem converting my project to a maven project. i think the problem was in some version mismatch between some jars in my library. @keyser after the library fix the project is working either with or without the slash in the path

jvm-arguments
tags question: http://stackoverflow.com/q/25309748
tags question: http://stackoverflow.com/q/25294647
tags question: http://stackoverflow.com/q/25261640
tags question: http://stackoverflow.com/q/25279741
type: Tag
tag name: jvm-arguments
tags question: http://stackoverflow.com/q/25297022

http://stackoverflow.com/comment/39416843
score: 1
comment on: http://stackoverflow.com/a/25292246
type: Comment
has text: @Rohit Jain: where do you see a raw type in my answer? Method references will always use type inference to get the right Generic type.
type: AnswerComment

http://stackoverflow.com/comment/39445793
has text: someone tell me that the black screen is caused by the method oncreate because it's a little full that's why it make time to start. i tried to reduce it but the problem persist :(
type: QuestionComment
comment on: http://stackoverflow.com/q/25307460
score: 0
type: Comment

http://stackoverflow.com/q/25232267
has comment: http://stackoverflow.com/comment/39305299
answer count: 0
tagged with: maven
upvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39305267
has comment: http://stackoverflow.com/comment/39305222
has title: java.lang.ClassNotFoundException: org.dom4j.DocumentException even after adding dependency entry
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39305373
has body: I'm getting this exception while deploying my war. Caused by: **java.lang.NoClassDefFoundError: org/dom4j/DocumentException** at com.findmybuddy.restws.utils.HibernateUtil.buildSessionFactory(HibernateUtil.java:13) ... 48 more Caused by: **java.lang.ClassNotFoundException: org.dom4j.DocumentException** at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) ... 49 more I have added dom4j dependency entry in pom.xml also dom4j dom4j 1.6.1 I don't known why I'm getting this exception still.
downvote count: 0
score: 1
tagged with: dom4j
favorite count: 0
type: Question

http://stackoverflow.com/a/46903004
score: 0
has body: I have faced the same issue. I solved it by Going to Settings-> Language &amp; keyboard -> Voice Input-> Then enable the 'Basic Google recognition', as this radio button was disabled in my same HTC phone.
type: Answer
answers question: http://stackoverflow.com/q/25250761

http://stackoverflow.com/q/25375738
has answer: http://stackoverflow.com/a/25375792
has comment: http://stackoverflow.com/comment/39571949
accepted answer: http://stackoverflow.com/a/25375799
has answer: http://stackoverflow.com/a/25375786
score: 1
has answer: http://stackoverflow.com/a/25375799
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25375798
has title: Remove possible sequences from a string using regular expressions?
has body: I have a list of strings, some (not all) that have endings like: "StringSignOut" "String Sign Out" "String SIGNOUT" "StringSO" "String SO" "String S.O." "StringS.O." I want to get rid of all the sign outs and SOs, I'm just not sure how to do the pattern. private static String getGroup(String s, String pat, int g) { Pattern p = Pattern.compile(pat); Matcher m = p.matcher(s); if (m.matches()) { return m.toMatchResult().group(g); } else { return null; } }
has comment: http://stackoverflow.com/comment/39571861
answer count: 5
downvote count: 0
upvote count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/39571980
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39571891
possible better answer: http://stackoverflow.com/a/25375786
has answer: http://stackoverflow.com/a/25375796
tagged with: java

http://stackoverflow.com/comment/39449784
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25307876
has text: I'm assuming you are using one of Spring 3.x versions. Is that right? If the two xml files are not large, can you post them in full here?

http://stackoverflow.com/a/25235967
has comment: http://stackoverflow.com/comment/39314751
has comment: http://stackoverflow.com/comment/39316281
has comment: http://stackoverflow.com/comment/39312892
score: 0
has comment: http://stackoverflow.com/comment/39316398
has comment: http://stackoverflow.com/comment/39312865
type: Answer
has comment: http://stackoverflow.com/comment/39312900
answers question: http://stackoverflow.com/q/25235954
has comment: http://stackoverflow.com/comment/39313124
has comment: http://stackoverflow.com/comment/39313044
has body: yes u can log ur activity which you are currently IN : adb logcat | grep "ActivityManager" Below is ScreenShot showing activity with package name :
has comment: http://stackoverflow.com/comment/39316255

http://stackoverflow.com/q/25289231
linked to: http://stackoverflow.com/q/53049977
favorite count: 0
type: Question
has body: I have the following code: public static void main(String args[]){ try { //String ticket = "Negotiate YIGCBg...=="; //byte[] kerberosTicket = ticket.getBytes(); byte[] kerberosTicket = Base64.decode("YIGCBg...=="); GSSContext context = GSSManager.getInstance().createContext((GSSCredential) null); context.acceptSecContext(kerberosTicket, 0, kerberosTicket.length); String user = context.getSrcName().toString(); context.dispose(); } catch (GSSException e) { e.printStackTrace(); } catch (Base64DecodingException e) { e.printStackTrace(); } } Of course it fails. Here's the exception: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag) I don't know what I'm supposed to do to solve this. Honestly, I don't really understand Kerberos. I got this ticket by sending a 401 with the appropriate header WWW-Authenticate with 'Negotiate' as the value. The browser immediately issued the same request again with an authorization header containing this ticket. I was hoping I could validate the ticket and determine who the user is. Do I need a keytab file? If so, what credentials would I run this under? I'm trying to use the Kerberos ticket for auth for a web-site. Would the credentials be the credentials from IIS? What am I missing? Update 1 From Michael-O's reply, I did a bit more googling and found this article, which led me to this article. On table 3, I found 1.3.6.1.5.5.2 SPNEGO. I have now added that to my credentials following the example from the first article. Here's my code: public static void main(String args[]){ try { Oid mechOid = new Oid("1.3.6.1.5.5.2"); GSSManager manager = GSSManager.getInstance(); GSSCredential myCred = manager.createCredential(null, GSSCredential.DEFAULT_LIFETIME, mechOid, GSSCredential.ACCEPT_ONLY); GSSContext context = manager.createContext(myCred); byte[] ticket = Base64.decode("YIGCBg...=="); context.acceptSecContext(ticket, 0, ticket.length); String user = context.getSrcName().toString(); context.dispose(…
has answer: http://stackoverflow.com/a/25388316
upvote count: 12
type: UnansweredQuestion
tagged with: gssapi
score: 12
has answer: http://stackoverflow.com/a/25450862
tagged with: kerberos
has title: Using GSSManager to validate a Kerberos ticket
has answer: http://stackoverflow.com/a/25370806
answer count: 3
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25298119
answer count: 2
has title: Unit testing a discrete Fourier transformation
score: 1
accepted answer: http://stackoverflow.com/a/25299209
downvote count: 0
has comment: http://stackoverflow.com/comment/39430393
upvote count: 1
tagged with: unit-testing
favorite count: 0
tagged with: fft
type: Question
has answer: http://stackoverflow.com/a/25306587
possible better answer: http://stackoverflow.com/a/25306587
tagged with: java
has answer: http://stackoverflow.com/a/25299209
has body: Several months ago I had to implement a two-dimensional Fourier transformation in Java. While the results seemed sane for a few manual checks I wondered how a good test-driven approach would look like. Basically what I did was that I looked at reasonable values of the DC components and compared the AC components if they roughly match the Mathematica output. My question is: Which unit tests would you implement for a discrete Fourier transformation? How would you validate results returned by your calculation?
type: AnsweredQuestion

http://stackoverflow.com/a/25247700
has comment: http://stackoverflow.com/comment/39345223
type: Answer
accepted answer of: http://stackoverflow.com/q/25242089
score: 0
answers question: http://stackoverflow.com/q/25242089
type: AcceptedAnswer
has body: check the developer tools in chrome... the font files return 404 - NOT FOUND

http://stackoverflow.com/comment/39468849
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25320021
has text: The default response from Salesforce is json, I think.

http://stackoverflow.com/a/25274739
answers question: http://stackoverflow.com/q/25274697
has body: Use Integer instead of int. If it's not set, it will be null. If, for example, 0 is not a valid ID value, you can also leave the type as int and use @RequestParam(value = "id", defaultValue = "0") The parameter will than be equal to 0 if not passed.
type: Answer
accepted answer of: http://stackoverflow.com/q/25274697
type: AcceptedAnswer
downvote count: 0
score: 16
upvote count: 16

http://stackoverflow.com/comment/39554211
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25335001
has text: You know what, your Idea helped me in writing this code although I had to add few things in that but It gave me the right direction. Thank you.

http://stackoverflow.com/q/25364437
has comment: http://stackoverflow.com/comment/39549690
has answer: http://stackoverflow.com/a/25364734
type: AnsweredQuestion
score: 0
has body: How can I automatically run this method of an Activity while the App is in the background? The method contains a pop up dialog box which asks for user input before it sends data to an email. public String TemperatureCatch() { Spinner reeferchoice = (Spinner)findViewById(R.id.optionselecti); String reeferChoicei = reeferchoice.getSelectedItem().toString(); if (reeferChoicei.equals("Yes")) { final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 500); tg.startTone(ToneGenerator.TONE_CDMA_ABBR_ALERT); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Temperature"); alert.setMessage("Input Temperature in F° (-20 to 65) "); final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_PHONE); alert.setView(input); alert.setPositiveButton("Check-In", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { temperaturei = input.getText().toString(); Toast.makeText(getBaseContext(), "Updated", Toast.LENGTH_SHORT).show(); Updater(temperaturei); } }); alert.show(); } else if (reeferChoicei.equals("No")) { temperaturei = "DRY"; Updater(temperaturei); } return temperaturei; }
answer count: 2
has title: How to run a method of an activity automatically in the background
has answer: http://stackoverflow.com/a/25365304
possible better answer: http://stackoverflow.com/a/25365304
has comment: http://stackoverflow.com/comment/39549765
has comment: http://stackoverflow.com/comment/39549613
linked to: http://stackoverflow.com/q/1877417
has comment: http://stackoverflow.com/comment/39549663
type: Question
accepted answer: http://stackoverflow.com/a/25364734
duplicate of: http://stackoverflow.com/q/1877417
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39315457
type: Comment
type: QuestionComment
has text: you could use .jar file and use the class in your current application
comment on: http://stackoverflow.com/q/25237345
score: 0

http://stackoverflow.com/comment/39416852
has text: @RohitJain In which context though? That's OP's problem, that it doesn't compile.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25291771
type: Comment

http://stackoverflow.com/q/25236687
type: Question
has comment: http://stackoverflow.com/comment/39314265
has body: Here is the JSON format in String object which i am trying to convert into JSONObject in android. { "city":[ { "id":"1", "name":"Mumbai" }, { "id":"2", "name":"Delhi" }, { "id":"3", "name":"Chennai" }, { "id":"4", "name":"Kolkatta" } ], "locality":[ { "id":"1", "locality_city_id":"1", "locality_name":"Andheri" }, { "id":"2", "locality_city_id":"1", "locality_name":"Bandra" }, { "id":"3", "locality_city_id":"1", "locality_name":"Dadar" }, { "id":"4", "locality_city_id":"1", "locality_name":"Thane" } ], "diseases":[ { "id":"1", "disease_name":"Blood Pressure" }, { "id":"2", "disease_name":"Diebetes" }, { "id":"3", "disease_name":"Hypertention" }, { "id":"4", "disease_name":"Dyslexia" } ] } I copied it to JSON beautifier and it says it is a valid JSON. But this raises exception. Is there anything wrong in the JSON format ? Code used is: JSONObject jsonObject = new JSONObject(jsonString); Exception stacktrace: 08-11 11:22:33.548: W/System.err(3055): org.json.JSONException: Value {"city":[{"id":"1","name":"Mumbai"},{"id":"2","name":"Delhi"},{"id":"3","name":"Chennai"},{"id":"4","name":"Kolkatta"}],"locality":[{"id":"1","locality_city_id":"1","locality_name":"Andheri"},{"id":"2","locality_city_id":"1","locality_name":"Bandra"},{"id":"3","locality_city_id":"1","locality_name":"Dadar"},{"id":"4","locality_city_id":"1","locality_name":"Thane"}],"diseases":[{"id":"1","disease_name":"Blood Pressure"},{"id":"2","disease_name":"Diebetes"},{"id":"3","disease_name":"Hypertention"},{"id":"4","disease_name":"Dyslexia"}]} of type java.lang.String cannot be converted to JSONObject 08-11 11:22:33.548: W/System.err(3055): at org.json.JSON.typeMismatch(JSON.java:111) 08-11 11:22:33.548: W/System.err(3055): at org.json.JSONObject.(JSONObject.java:158) 08-11 11:22:33.548: W/System.err(3055): at org.json.JSONObject.(JSONObject.java:171)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25237012
tagged with: android
has comment: http://stackoverflow.com/comment/39314096
has title: String to JSONObject in Android raise exception
has comment: http://stackoverflow.com/comment/39314631
has comment: http://stackoverflow.com/comment/39314137
score: 0
has comment: http://stackoverflow.com/comment/39314369
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39314000
answer count: 1

http://stackoverflow.com/comment/39526947
type: Comment
type: QuestionComment
has text: So any solution to this #hovercraft.full.of.eels
score: 0
comment on: http://stackoverflow.com/q/25351966

http://stackoverflow.com/q/25366779
has body: I have been using this regex to validate YouTube links using JavaScript: function is_valid_video(url) { var p = /^(?:http?:\/\/)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&amp;v=))((\w|-){11})(?:\S+)?$/; return (url.match(p)) ? RegExp.$1 : false; } Since I'm learning to develop Android apps, I want to convert this function to use it in Java.
downvote count: 2
tagged with: javascript
upvote count: 1
has comment: http://stackoverflow.com/comment/39555359
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25366881
has title: How to convert a JavaScript regex into Java?
has answer: http://stackoverflow.com/a/25366881
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39554223
score: -1
tagged with: regex
possible better answer: http://stackoverflow.com/a/25366896
type: Question
has answer: http://stackoverflow.com/a/25366896
answer count: 2

http://stackoverflow.com/q/25376045
tagged with: java
tagged with: junit
tagged with: testng
type: Question
has body: I am a new bee to Automation and Java. I am working on a problem which requires me to read the read time stock market data from the database and verify it with the same with the value seen on the UI. I am ok having approximations up to 5% in the value. To verify if these tests have passed its important for me to assert the values with the value in the UI. I have a small logic to verify these values, I wanted to know if this is a good way of coding on java or do i have a better way to achieve these results. Alorigthm. I read the int/float value from db. Calculate 5% of the value in step 1. Get the value in the UI and assert if its greater then or equal to value in step 2. If greater i say Asseert.assertEquals(true,true) else i fail my assert. If any better way to work for these values, request a better answer.
has title: Automate real time data using java
tagged with: automation
has answer: http://stackoverflow.com/a/25376249
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
favorite count: 0
score: 2

http://stackoverflow.com/q/25354148
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25354358
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25354580
has comment: http://stackoverflow.com/comment/39530793
has comment: http://stackoverflow.com/comment/39530704
score: 0
answer count: 2
has body: I am doing a function to download files to android device, works fine but I want to do that if the downloaded file exists already in the device will overwrite it. Here is my code: class DownloadTask extends AsyncTask&lt;String, Integer, String&gt; { private Context context; private PowerManager.WakeLock mWakeLock; public DownloadTask(Context context) { this.context = context; } @Override protected void onPreExecute() { super.onPreExecute(); // take CPU lock to prevent CPU from going off if the user // presses the power button during download PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getClass().getName()); mWakeLock.acquire(); mProgressDialog.show(); } @Override protected void onProgressUpdate(Integer... progress) { super.onProgressUpdate(progress); // if we get here, length is known, now set indeterminate to false mProgressDialog.setIndeterminate(false); mProgressDialog.setMax(100); mProgressDialog.setProgress(progress[0]); } @Override protected void onPostExecute(String result) { mWakeLock.release(); mProgressDialog.dismiss(); if (result != null){ this.finish(); } else { Descargar.this.finish(); } } @Override protected String doInBackground(String... sUrl) { InputStream input = null; HttpURLConnection connection = null; for (i=0; i&lt; sUrl.length; i++) { try { URL url = new URL(sUrl[i]); connection = (HttpURLConnection) url.openConnection(); connection.connect(); // expect HTTP 200 OK, so we don't mistakenly save error report // instead of the file if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { return "Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage(); } // this will be useful to display download percentage // might be -1: server did not report the length int fileLength = connection.getContentLength(); // download the file input = connection.getInputStream(); fOut = openFileOutput(i+".json",MODE_PRIVATE); …
has title: Download function with overwrite
has comment: http://stackoverflow.com/comment/39530878
type: Question
has comment: http://stackoverflow.com/comment/39530737

http://stackoverflow.com/comment/39466618
comment on: http://stackoverflow.com/q/25318732
score: 0
has text: @Edward van Raak Okay, thanks, so how would I get the result _without_ blocking the main thread?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25296038
tagged with: json-lib
has comment: http://stackoverflow.com/comment/39427365
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3020094
has comment: http://stackoverflow.com/comment/39425472
has comment: http://stackoverflow.com/comment/39425182
has comment: http://stackoverflow.com/comment/39425548
has body: I know this question was asked several times before on this forum. But none of it addresses my problem. I am using Jmeter to post json string with content-type "application/json" My Spring mvc app is happy consuming the same and converting it to Java Object. However, when i send a string with a backslash everything seems to fall apart. Here is my Json Input string {"signup":{"firstName":"joe", "lastName":"beedu","email":"jb1407874596956@hotmail.com", "password":"O;\l-wslD6RQ5@M)","confirmPassword":"O;\l-wslD6RQ5@M)", "picImage":[81,109,81,109,109,81,109,109,89]}} Note: password fields have a back slash. More on this later. Here is my java class for the same. @JsonRootName(value = "signup") @XmlRootElement(name = "signup") public class Signup { private String firstName; private String lastName; private String email; private String password; private String confirmPassword; private byte[] picImage; } Removed getters/setters and also validation annotations. Issue number 1: When i manually escape the password field values with an extra slash like "O;\l-wslD6RQ5@M)" My Spring mvc web app is happy, but doesn't automatically unescape the extra back slash for me. I was expecting my spring converter MappingJackson2HttpMessageConverter to read the json payload and do the magic unescape thing for me, but it doesn't. It will be very ugly if i manually unescape every field in json json objects. Any help here to address this? Issue number 2: On the client side, i tried several different ways to see if any library automatically escapes the strings in Json object. Given a raw json string like above, is there a way to escape the string that goes into json object? I tried, StringEscapeUtils from apache escapeJson, it didn't work. I tried json-lib too. None of them were able to handle string "O;\l-wslD6RQ5@M)". I had to manually add extra back slash before i add the json string to Http Body. I would like to use a client side library that escapes json string fields and also on the serve…
has comment: http://stackoverflow.com/comment/39425570
tagged with: spring-remoting
answer count: 0
has comment: http://stackoverflow.com/comment/39425567
has title: Json string handling with back slash
score: 1
has comment: http://stackoverflow.com/comment/39427167
tagged with: java
has comment: http://stackoverflow.com/comment/39428122
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39428032
downvote count: 0
has comment: http://stackoverflow.com/comment/39424745
upvote count: 1
has comment: http://stackoverflow.com/comment/39428136
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39425505
has comment: http://stackoverflow.com/comment/39427200
has comment: http://stackoverflow.com/comment/39425006
has comment: http://stackoverflow.com/comment/39425560

http://stackoverflow.com/a/25301750
answers question: http://stackoverflow.com/q/25299559
accepted answer of: http://stackoverflow.com/q/25299559
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: For RowLayout you can use a RowData layout data object to specify the height of a row: RowData layoutData = new RowData(SWT.DEFAULT, height); tree.setLayoutData(layoutData);
type: Answer

http://stackoverflow.com/comment/39565204
comment on: http://stackoverflow.com/q/25371879
type: Comment
has text: @user2698 tag it with programming language of choice
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39598352
has text: @LuiggiMendoza `So when we change s1, I'd expect the value of s3 also to change, since it's pointing to the same spot in the memory.` To me the OP is confused by the way variables are passed and referred to in java.
comment on: http://stackoverflow.com/q/25389506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25383076
has comment: http://stackoverflow.com/comment/39586208
type: AcceptedAnswer
downvote count: 0
upvote count: 1
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25382931
answers question: http://stackoverflow.com/q/25382931
has comment: http://stackoverflow.com/comment/39585732
has comment: http://stackoverflow.com/comment/39585275
has body: Is Spring aware of SelfServiceClass class? It has to be. You either annotate it with @Component or it is returned by a @Configuration as a @Bean or include it as you did with reloadebleProperty in the xml, i.e.: make it a spring managed bean

http://stackoverflow.com/a/25232894
answers question: http://stackoverflow.com/q/25232818
downvote count: 0
upvote count: 1
has body: You should use the UNIQUE constraint to the user name field in you DB. That way you make sure all values in the collumn are different (you can achieve the same thing making it PK but maybe your ussing another primary key). As for the toast, Im not sure which exception is thrown when the unique constraint is broken, but you should catch that exception, infomr the UI tier and throw the toast.
score: 1
type: Answer

http://stackoverflow.com/a/69817342
has comment: http://stackoverflow.com/comment/123494317
has comment: http://stackoverflow.com/comment/123460724
has body: I came across similar problem to be solved: One process frequently updates file via 'save to tempfile -> move tempfile to final file' using Files.move(tmp, out, ATOMIC_MOVE, REPLACE_EXISTING); Another one or more processes read that file - completely, all-at-once, and closes immediatelly. File is rather small - less than 50k. And it just does not work reliably, at least on windows. Under heavy load reader occasionally gets NoSuchFileException - this means Files.move is not that ATOMIC even on the same file system :( My env: Windows 10 + java 11.0.12 Here is the code to play with: import org.junit.Test; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.file.Files; import java.nio.file.Path; import java.util.Set; import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.StandardCopyOption.ATOMIC_MOVE; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static java.util.Locale.US; public class SomeTest { static int nWrite = 0; static int nRead = 0; static int cErrors = 0; static boolean writeFinished; static boolean useFileChannels = true; static String filePath = "c:/temp/test.out"; @Test public void testParallelFileAccess() throws Exception { new Writer().start(); new Reader().start(); while( !writeFinished ) { Thread.sleep(10); } System.out.println("cErrors: " + cErrors); } static class Writer extends Thread { public Writer() { setDaemon(true); } @Override public void run() { File outFile = new File("c:/temp/test.out"); File outFileTmp = new File(filePath + "tmp"); byte[] bytes = "test".getBytes(UTF_8); for( nWrite = 1; nWrite <= 100000; nWrite++ ) { if( (nWrite % 1000) == 0 ) System.out.println("nWrite: " + nWrite + ", cReads: " + nRead); try( FileOutputStream fos = new FileOutputStream(outFileTmp) ) { fos.write(bytes); } catch( Exception e ) { logException("write", e); } int maxAt…
has comment: http://stackoverflow.com/comment/123446006
has comment: http://stackoverflow.com/comment/123445907
has comment: http://stackoverflow.com/comment/123494364
has comment: http://stackoverflow.com/comment/123460766
has comment: http://stackoverflow.com/comment/123445962
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25238284
upvote count: 1
score: 1

http://stackoverflow.com/a/25272284
has body: You have not shared the JSON but if your JSON is valid, and look like this: [ { "name": "nme" }, { "name": "done" }, { "name": "dinkol" } ] Then the right way to parse it is too put it in a JSONArray object. Loop through the JSONObject and append the value to your list array: JSONArray json_data = new JSONArray(result); List&lt;String&gt; mynamelist = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; json_data.length(); i++){ mynamelist.add(json_data.getJSONObject(i).getString("name")); }
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25270672
has comment: http://stackoverflow.com/comment/39390425
has comment: http://stackoverflow.com/comment/39390173

http://stackoverflow.com/a/25284253
has body: I think I've found a solution to the problem. The issue had to to with running the threads. The startWorking()-method would not give up until it had reached the desired amount, and thus, the earnMoney()-method did not get proper access to the balance-variable, and thus printed out an incorrect value. However, if I simply modify the conditions in the while-loop for the methods: earnMoney() and startWorking(): public synchronized void earnMoney() { //As long as you have not earned 100 dollars while(enoughMoney()) { try { wait(); //Wait for balance to increase } catch(InterruptedException e) { return; } } balance = hourSalary * getNumHours(); //Increment by 15 after each hour setBalance(balance); System.out.println("You have now worked " + numHours + " hours and increased your balance. Dollars earned so far " + getBalance()); notifyAll(); } public synchronized void startWorking() { while(enoughWork()) { try { wait(); } catch(InterruptedException e) { return; } } numHours++; System.out.println("You have worked " + numHours + " hours and earned " + getBalance() + " dollars."); notifyAll(); } It seems to solve the problem.
score: 0
answers question: http://stackoverflow.com/q/25283798
type: Answer

http://stackoverflow.com/comment/39380258
type: QuestionComment
comment on: http://stackoverflow.com/q/25272230
score: 3
has text: can you give us some inputs?
type: Comment

http://stackoverflow.com/comment/39532568
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25355132
has text: I did not use an array because I wanted to store the value as a string and not the index.
score: 0

http://stackoverflow.com/a/25256618
type: Answer
has comment: http://stackoverflow.com/comment/39352144
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25256539
has body: Yes, use replaceAll method : Java String Replace Variant ‘replaceAll’ Unlike the ‘replace’ method, ‘replaceAll’ supports regular expressions. The capability of ‘replaceAll’ makes the complex search of substrings possible within a string object. After a search, each matched substring is replaced with the given replacement. The following is a format of ‘replaceAll’ method: String replaceAll (String regEx, String replacement) String sampleString = new String ("Remove All backslashes"); String resultantString = sampleString.replaceAll ("\\",""); See this java replace and replaceAll method
has comment: http://stackoverflow.com/comment/39352120
answers question: http://stackoverflow.com/q/25256539
has comment: http://stackoverflow.com/comment/39352099

http://stackoverflow.com/comment/40157980
has text: No problem :) I suspect it has to do with ebean enhancements which occur after compilation. Eclipse sees new changes and compiles again, thus messing the code.
type: Comment
comment on: http://stackoverflow.com/a/25664471
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39564348
type: QuestionComment
comment on: http://stackoverflow.com/q/25371698
has text: So what can I do the be sure that `setLoggedIn(true);` happened before I `return loggedIn`? Something like `Thread.sleep();` wouldn't work here I think.
score: 0
type: Comment

http://stackoverflow.com/q/25236798
accepted answer: http://stackoverflow.com/a/25383711
has body: I'm using Java 7 with hibernate 4. Want to use oracle Interval data type (http://psoug.org/definition/INTERVAL.htm) to represent a interval of a certain number of days. Wondering what Java Type to use to map this Oracle Interval Object. I would like to use standard Java objects and not any oracle.sql.* objects as mentioned in this document http://docs.oracle.com/cd/B28359_01/java.111/b31224/datacc.htm. Here's the table I'm playing with: CREATE TABLE "MyTest" ( "ID" NUMBER(14,0) NOT NULL "DELIVERY_PERIOD" INTERVAL DAY (3) TO SECOND (6), CONSTRAINT "MYTEST_PK" PRIMARY KEY ("ID")); Edit I've since tried with @Temporal(TemporalType.TIME) private java.util.Date deliveryPeriod; Getting the error: Caused by: java.sql.SQLException: Invalid column type: getTime not implemented for class oracle.jdbc.driver.T4CIntervaldsAccessor Edit 2 http://docs.oracle.com/cd/B12037_01/java.101/b10983/datamap.htm I know mapping it to Java String would work, but I would like to get it is some sort of date object so I don't have to parse it myself. http://objectmix.com/jdbc-java/41781-oracle10g-oracle-sql-interval-type.html I would also like to avoid using oracle specific data types such as oracle.sql.INTERVALS
has comment: http://stackoverflow.com/comment/39573603
tagged with: oracle-database
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25383711
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25377025
answer count: 2
tagged with: jpa
tagged with: database
downvote count: 0
score: 6
possible better answer: http://stackoverflow.com/a/25377025
upvote count: 6
linked to: http://stackoverflow.com/q/1945615
type: AnsweredQuestion
has title: How to represent Oracle Interval in Java

natural-logarithm
type: Tag
tag name: natural-logarithm
tags question: http://stackoverflow.com/q/25342026

http://stackoverflow.com/comment/39358401
comment on: http://stackoverflow.com/q/25259312
score: 0
type: Comment
type: QuestionComment
has text: I think context is not important here. But trust me, class B is needed :)

shell
tags question: http://stackoverflow.com/q/25253944
tags question: http://stackoverflow.com/q/25257077
tags question: http://stackoverflow.com/q/25370596
tags question: http://stackoverflow.com/q/25388758
type: Tag
tag name: shell
tags question: http://stackoverflow.com/q/25259785
tags question: http://stackoverflow.com/q/25348997
tags question: http://stackoverflow.com/q/25241895

http://stackoverflow.com/a/25371726
score: 3
answers question: http://stackoverflow.com/q/25371718
has body: Your constructor isn't setting field values, only local values. This public CompressString(char let, int appears){ char letter = let; int freq = appears; } Should be public CompressString(char let, int appears){ this.letter = let; this.freq = appears; } Also make sure freq and letter are marked as public, or define methods such as getFreq() and getLetter() if you haven't already.
has comment: http://stackoverflow.com/comment/39564409
upvote count: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39564443

http://stackoverflow.com/a/25263211
has body: you can try this public static void main(String[] args) { try { //something wrong happens here }catch(Throwable e) { e.printStackTrace(); main(args); } }
has comment: http://stackoverflow.com/comment/39363738
has comment: http://stackoverflow.com/comment/39363626
answers question: http://stackoverflow.com/q/25263072
type: Answer
accepted answer of: http://stackoverflow.com/q/25263072
score: 3
has comment: http://stackoverflow.com/comment/39363859
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39363194
downvote count: 0

http://stackoverflow.com/q/25372938
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/39566710
answer count: 1
has title: call constructor that calls private initialization of components
has comment: http://stackoverflow.com/comment/39566516
has body: I just discovered that netbeans had the built in swing tools and so im playing around with it but ran into some trouble. How would I call the initialization from a main method. Because without the main method the program wont execute, but with it I cant just call the constructor, or cannot just call the initComponents() because it is private. How would I get this working?? public static void main(String [] args){ } /** * Creates new form password */ public password() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); ...
accepted answer: http://stackoverflow.com/a/25373349
type: Question
has answer: http://stackoverflow.com/a/25373349
has comment: http://stackoverflow.com/comment/39567789

http://stackoverflow.com/a/25354408
answers question: http://stackoverflow.com/q/25354356
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39531267
has body: If you're targeting the android platform you could use CountDownTimer, which allows you to execute some code every certain amount of time for a certain duration. But be aware that android doesn't work with the main method like J2SE does. Anyway, if you're looking foward to program an android game, i'd highly recommend you to start here: Android Development
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25233853
score: -2
has comment: http://stackoverflow.com/comment/39310722
has comment: http://stackoverflow.com/comment/39308683
has comment: http://stackoverflow.com/comment/39358195
has comment: http://stackoverflow.com/comment/39316947
tagged with: java-8
accepted answer: http://stackoverflow.com/a/25234667
has comment: http://stackoverflow.com/comment/39309428
tagged with: class
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25235451
has answer: http://stackoverflow.com/a/25234667
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/39308673
tagged with: java-stream
has body: While browsing java 8's stream implementation on grepcode, I came upon the following declaration in java.util.stream.ReduceOps.java on line 772: private static final class ReduceTask&lt;P_IN, P_OUT, R, S extends AccumulatingSink&lt;P_OUT, R, S&gt;&gt; extends AbstractTask&lt;P_IN, P_OUT, S, ReduceTask&lt;P_IN, P_OUT, R, S&gt;&gt; { It seems as if the class ReduceTask is extending, or better, referencing itself. Is that really possible?
has answer: http://stackoverflow.com/a/25235451
has comment: http://stackoverflow.com/comment/39339490
tagged with: java
has comment: http://stackoverflow.com/comment/39356075
tagged with: generics
has title: Class referencing itself as a generic?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39309099
upvote count: 2

http://stackoverflow.com/comment/39501433
has text: Can you give a specific example of input that causes this error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25337145
score: 0

http://stackoverflow.com/q/25319366
type: Question
has answer: http://stackoverflow.com/a/25319497
possible better answer: http://stackoverflow.com/a/25322340
has title: What is the mvn command (CLI) to add a Maven Central hosted JAR into your local .m2 repository
tagged with: maven
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25322340
has body: I have an .m2 repository, like so (a fragment): [ ... ] /home/user/.m2/repository/com/twitter/carbonite /home/user/.m2/repository/com/twitter/carbonite/1.4.0 /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.jar.lastUpdated /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.jar.sha1 /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.pom.lastUpdated /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.jar /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.pom /home/user/.m2/repository/com/twitter/carbonite/1.4.0/_remote.repositories /home/user/.m2/repository/com/twitter/carbonite/1.4.0/carbonite-1.4.0.pom.sha1 /home/user/.m2/repository/com/twitter/chill-java /home/user/.m2/repository/com/twitter/chill-java/0.3.5 /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.pom.sha1 /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.jar.sha1 /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.jar /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.pom /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.pom.lastUpdated /home/user/.m2/repository/com/twitter/chill-java/0.3.5/_remote.repositories /home/user/.m2/repository/com/twitter/chill-java/0.3.5/chill-java-0.3.5.jar.lastUpdated [ ... ] And, using the UNIX/LINUX mvn CLI, I similarly want to add an entry for a new JAR that is hosted at Maven Repository or Maven Central (or wherever these things are hosted online) to my local .m2 repository. For example, let's say I want to add this one locally (which is hosted at mavenrepository.com): -DgroupId=com.codahale -DartifactId=metrics-graphite -Dversion=3.0.2 What is the mvn command (CLI) to do this? Note: I found instructions for adding 3rd party JARS files, etc., but not for this simple case. Thanks in advance.
accepted answer: http://stackoverflow.com/a/25319497
tagged with: java
tagged with: jar
tagged with: repository

http://stackoverflow.com/comment/39385396
comment on: http://stackoverflow.com/a/25274159
type: AnswerComment
score: 0
type: Comment
has text: @Luke What is `foo` in my example?

dmg
type: Tag
tag name: dmg
tags question: http://stackoverflow.com/q/25317879

http://stackoverflow.com/comment/39368726
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25252250
has text: @user3930774 A bit confused, what is the current issue right now for you now that you have the System.exit(int) in place? You want to have the program end when they press no? You would have to if so, add a System.exit(int) in that `if (result == JOptionPane.NO_OPTION)` if.
type: Comment

http://stackoverflow.com/a/25321130
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25320942
score: 1
upvote count: 1
has body: There are many different ways to handle this. My favorite way to handle this is similar to option one that you posted. Where each Entity has a unique type ID. Instead of one long switch statement to say create entities, you could instead use a more reflection based approach. It's a slightly slower way but it does provide for a very nice and clean interface. Just remember that there are a lot of ways to handle this, and this is just my preferred way. Each game handles this differently and you really just have to go with something you like. Example: public enum EntityIDs { Zombie( EntityZombie.class ), Werewolf( EntityWerewolf.class ); // And so on for all of your entities public Class&lt; ? extends Entity &gt; entityClass; private EntityIDs( Class&lt; ? extends Entity &gt; cl ) { this.entityClass = cl; } public static Entity createEntity( int id ) { Class&lt; ? extends Entity &gt; cl = EntityIDs.values()[ id ].entityClass; return cl.newInstance(); } } You would then receive a type ID from the server and common data, such as location. That ID could be the ordinal of the Entity Type, or some other way you decide to map it to their type. You can then use the entityClass field to reflectively create your entities. Of course this requires that you still list out every entity in an enum, but creating a new one is as simple as a single line. This does require that all Entities subclass a common super class, such as Entity in this case. It also requires that each Entity subclass have a common constructor, usually just a default constructor with initialization done after construction. Having a common super class does simplify part of your problem. You would put all common data, such as location, inside the super class. When you want to move an entity you would not need to care what type of entity it is, you would only need to know which entity and where it was moving. World world = ...; Entity entity = world.getEntity( entityId ); if( entity != null ) { entity.move( newX, new…

http://stackoverflow.com/q/25262638
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
tagged with: integration-testing
has title: Integration tests with Oracle Coherence
tagged with: oracle-coherence
type: Question
has answer: http://stackoverflow.com/a/25274810
has body: We have a set of integration tests, that use Oracle Coherence. All of them use the same config and the problem is that when you are running them in parallel, their coherence nodes join into one cluster and it is possible that one test affects others. Is there a simple way to prevent this joining? Thanks!
has answer: http://stackoverflow.com/a/25316612

http://stackoverflow.com/comment/39332563
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25246646
type: Comment
has text: why would anyone write something like that?

http://stackoverflow.com/comment/39533167
type: Comment
comment on: http://stackoverflow.com/a/25355467
type: AnswerComment
has text: @LuiggiMendoza I disagree. The problem as originally phrased also breaks encapsulation, because now the input validation is happening away from the input. I suppose `getAnswer()` could return null when the input is invalid. As is you'd need 3 values. true, false and not a value. Or you could throw an Exception I guess.
score: 0

http://stackoverflow.com/comment/39317285
score: 0
comment on: http://stackoverflow.com/a/25238400
type: Comment
has text: Sorry, but you are missing the point: My posted code of OpenJDK clearly states that AtomicMoveNotSupportedException is not thrown in any case, that's the problem. I could perfectly live with such an exception, but I can't if it is silently converted to a fall back strategy. I can't know what implementations are doing, I only have the official API docs and the posted implementation is violating that. At least that's my understanding...
type: AnswerComment

http://stackoverflow.com/comment/39439467
score: 0
type: Comment
has text: And in this case, the param1 and param2 will not be created if the logger level is debug?
comment on: http://stackoverflow.com/a/25303740
type: AnswerComment

actionscript
tag name: actionscript
tags question: http://stackoverflow.com/q/25265923
type: Tag

http://stackoverflow.com/q/25283541
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25283829
tagged with: java
has title: Is a generic type defined in inner class / interface bound to the outer class generic type definition?
tagged with: generics
accepted answer: http://stackoverflow.com/a/25283657
has comment: http://stackoverflow.com/comment/39400687
has body: In this code: public class MyClass&lt;T extends Enum&lt;T&gt;&gt; { public static interface MyInt&lt;T&gt; { } // ... } Is the type T in MyInt&lt;T&gt; the same as T in MyClass&lt;T extends Enum&lt;T&gt;&gt;? Or does that define a new generic type, so that moving that interface to a separate file won't change anything? After thinking a bit more about it, I guess the two types are independent, since I can always instantiate an object based on the interface (with new MyInt&lt;Integer&gt;() { ... }) without any reference to the outer class; but I'm anyway asking it to gather comments and thoughts.
possible better answer: http://stackoverflow.com/a/25283829
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25283657
answer count: 2
downvote count: 0
score: 4
favorite count: 0

http://stackoverflow.com/a/47497436
score: 0
answers question: http://stackoverflow.com/q/25235555
type: Answer
has body: I first downloaded mysql-connector-java form here. Extract the file. Then in Sublime I went to Javatar Settings > Dependencies > Add External .jar > path/to/mysql-connector-java-5.1.44-bin.jar and BINGOOO!!!!

http://stackoverflow.com/comment/39449125
has text: I'm not entirely sure this will work. In other sections of the code I have a context provider that either creates a new context via an XML file or uses the context provided by the unit test. In the code that calls this context provider it calls `getBean("url", memberVarString);`. What I'm getting at here is that using mockContext with just `.getBean("url");` is not an option for me unless I move to some sort of parameter injection.
comment on: http://stackoverflow.com/a/25309179
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39357457
type: Comment
type: AnswerComment
has text: @Gimby : U r correct. i need the size of files and subdirectories for a directory. Actually i have a web app where i m showing the directory structure of a repository in a tree view. so now the requirement is lyk if a user select a very large repo or any directory in it, then i hv to show a alert. therefore to determine the size of a repo or any directory in it at each level.
score: 0
comment on: http://stackoverflow.com/a/25246458

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25254292
tags question: http://stackoverflow.com/q/25354157
tags question: http://stackoverflow.com/q/25323811
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25326624
tags question: http://stackoverflow.com/q/25268279

http://stackoverflow.com/comment/122850831
score: 0
comment on: http://stackoverflow.com/a/25242450
type: Comment
type: AnswerComment
has text: Above article is really good. Thanks @Karan

http://stackoverflow.com/comment/39419962
comment on: http://stackoverflow.com/q/25293754
score: 0
type: QuestionComment
type: Comment
has text: Modify the code to listen to how many items are in the Table and then only draw that many gray line areas? Would that be possible?

http://stackoverflow.com/comment/40642810
type: Comment
has text: JavaCV library seems to be tooooooooooo big.
score: 0
comment on: http://stackoverflow.com/q/25301904
type: QuestionComment

http://stackoverflow.com/comment/39439614
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25304149
has text: What's the exception?
type: Comment

http://stackoverflow.com/a/25234417
type: Answer
has comment: http://stackoverflow.com/comment/39309939
has comment: http://stackoverflow.com/comment/39309871
answers question: http://stackoverflow.com/q/25234379
score: 0
has comment: http://stackoverflow.com/comment/39309813
has comment: http://stackoverflow.com/comment/39310154
has comment: http://stackoverflow.com/comment/39309777
has comment: http://stackoverflow.com/comment/39309884
has comment: http://stackoverflow.com/comment/39309824
has body: Do it like this: List&lt;Object[]&gt; dlist = new ArrayList&lt;Object[]&gt;(); for(Object[] i: data) { dlist.add(i); }

http://stackoverflow.com/comment/39509057
has text: @BlazeTama Space the grid further apart, or check if any 2 colours match rather than checking all three. or even check if any 1 colour match although that will only allow a small number of colours. (i.e. if red 0 has already been taken then allow no other red 0s.
type: Comment
comment on: http://stackoverflow.com/a/25306739
score: 0
type: AnswerComment

http://stackoverflow.com/a/25358002
has comment: http://stackoverflow.com/comment/39539085
has comment: http://stackoverflow.com/comment/39568006
has body: You do not need to do this, you can simply use EL &lt;c:forEach items="repo" var="element"&gt; Product: ${element.productID} &lt;/c:forEach&gt;
has comment: http://stackoverflow.com/comment/39541619
score: 3
has comment: http://stackoverflow.com/comment/39539150
type: Answer
has comment: http://stackoverflow.com/comment/39538562
answers question: http://stackoverflow.com/q/25357980
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/25279129
has comment: http://stackoverflow.com/comment/39392322
score: 0
tagged with: http-post
upvote count: 1
tagged with: cookies
type: UnansweredQuestion
tagged with: java
answer count: 1
tagged with: session-cookies
has comment: http://stackoverflow.com/comment/39392666
downvote count: 1
has body: I've been trying to get this work for a while now. Im working on an app where the user signs in with a username and password which uses a httppost request to post to the server. i get the correct response, and during the post i store the session cookie that the server gives me. (I store it in a cookie store) But when i try to click a link on the menu ( which does a second http post) after i logged in, the servers gives me a message saying that i am not logged in. But i send the cookie that i recieved in the first post to the server in the second post, yet the server does not recognize that i am logged in. To test this more easily i used the chrome plug in "Postman" which lets you post to websites easily. The only time it worked was when i log in to the website using chrome then use Postman to do the second post, which successfully gives me a response. however, when i use Postman to log in, then also use postman to attempt the second post , again, "Not logged in". Im guessing that the cookie is not being stored properly in the app. How could i go about fixing this? I read some stuff about storing the cookies in something called "Shared Preferences", is that possibly a fix? If so, what is it and how could i store the cookies there? public static String executeHttpPost(String url, ArrayList&lt;NameValuePair&gt; postParameters) throws Exception { BufferedReader in = null; try { LoginLayout.httpClient = new DefaultHttpClient(); HttpPost request = new HttpPost(url); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters); request.setEntity(formEntity); CookieStore cookiestore = LoginLayout.httpClient.getCookieStore(); HttpResponse response = LoginLayout.httpClient.execute(request); List&lt;Cookie&gt; cookies = LoginLayout.httpClient.getCookieStore().getCookies(); cookiestore.addCookie(cookie); cookie = cookies.get(0); cookieValue = "ASPSESSIONIDCQTCRACT=" + cookiestore.getCookies(); System.out.println("The cookie" + cookieValue); List&lt;Cookie&gt; cook…
favorite count: 0
type: Question
has title: Storing session cookie to maintain log in session
has answer: http://stackoverflow.com/a/25280392
tagged with: android

http://stackoverflow.com/q/25308245
type: Question
accepted answer: http://stackoverflow.com/a/25406823
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/25406823
tagged with: maven
has title: Starting apache server before integration testing not working
tagged with: testng
answer count: 4
has answer: http://stackoverflow.com/a/28410179
has answer: http://stackoverflow.com/a/25342206
has answer: http://stackoverflow.com/a/25359438
has body: I have a web application named as GroupWebApplication. Using pom.xml file I'm just creating the war of my application and deploying to tomcat server. This is basically a maven project. I have added plugins for tomcat7 apache server. Now what I want that I want to start the tomcat server then run the integration tests and after the completion of the integration tests I want to stop the server. Basically I'm using the testng.xml file of TestNg framework.testng.xml files contains all the classes for integration tests. Manually it's working fine, i.e. starting the server manually and running the test. Here is the pom file: org.testng testng 6.3.1 test sGroupWebApplication Integration Test src/main/resources org.apache.maven.plugins maven-dependency-plugin 2.4 resource-dependencies initialize unpack-dependencies com.company.integration.test engine **\/*.xpi,**\/*.exe,**\/*.so, **\/*.ftl,**\/*.css,**\/*.woff, **\/*.properties,**\/*.png,**\/chromedriver,**\/*.MF ${project.build.directory}/classes org.apache.tomcat.maven tomcat7-maven-plugin 2.0 http://localhost:8080/manager/text localhost /GroupWebApplication admin s3cret tomcat7-run run-war-only pre-integration-test true tomcat7-shutdown shutdown post-integration-test org.apache.maven.plugins maven-release-plugin 2.4.2 org.apache.maven.plugins maven-compiler-plugin 3.1 ${target.jdk} ${target.jdk} org.apache.maven.plugins maven-jar-plugin 2.4 Integration App ${project.version} ${maven.build.timestamp} org.apache.maven.plugins maven-site-plugin 3.0 UTF-8 org.apache.maven.plugins maven-javadoc-plugin 2.9.1 javadoc javadoc testng.xml: <parameter name="logging" value="SEVERE"/> The error that I'm getting: [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ GroupWebApplication --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\t_ddbc\Documents\clone_4_ju ne\demo\GroupWebApplicati…
type: AnsweredQuestion
tagged with: java
downvote count: 0
tagged with: maven-3
tagged with: maven-2
favorite count: 0
possible better answer: http://stackoverflow.com/a/25342206
linked to: http://stackoverflow.com/q/19886816

http://stackoverflow.com/q/25327096
type: Question
downvote count: 4
has comment: http://stackoverflow.com/comment/39481961
has comment: http://stackoverflow.com/comment/39481988
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39481969
has title: How to initialize a array object which is passed as parameter in java?
tagged with: arrayobject
score: -4
has comment: http://stackoverflow.com/comment/39481974
has answer: http://stackoverflow.com/a/25327151
tagged with: java
answer count: 1
has body: I don't know what is happening to my code but in below program I have a object array passed in UpdateHighScoreRecords() function which can contain some value or not. If array object size is zero I have to initialize the highScoreRecords[0] but it is showing ArrayIndexOutOfBoundsException. Can you solve this problem ? /** * The GameRecord class represents a record for the a game play, including the name of the player, the level of the game play and the score obtained. */ public class GameRecord { /** The name of the player. **/ private String name; /** The level of the game play. **/ private int level; /** The score of the game play. **/ private int score; /** * Constructs a game record with a certain name, level and score. * @param name the name of the player. * @param level the level of the game play. * @param score the score of the game play. */ public GameRecord(String name, int level, int score) { this.name = name; this.level = level; this.score = score; } /** * Returns the name of the player in the record. * @return the name of the player in the record. */ public String getName() { return name; } /** * Sets the name of the player in the record. * @param name the name of the player to be updated to. */ public void setName(String name) { this.name = name; } /** * Returns the level of the game play in the record. * @return the level of the game play in the record. */ public int getLevel() { return level; } /** * Sets the level of the game play in the record. * @param level the level of the game play to be updated to. */ public void setLevel(int level) { this.level = level; } /** * Returns the score of the game play in the record. * @return the score of the game play in the record. */ public int getScore() { return score; } /** * Sets the score of the game play in the record. * @param score the score of the game play to be updated to. */ public void setScore(int score) { this.score = score; } } public GameRecord[] updateHighScoreRecords(GameRecord[] highScoreRecord…
favorite count: 0

http://stackoverflow.com/q/25271215
has comment: http://stackoverflow.com/comment/39378750
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/25271474
has comment: http://stackoverflow.com/comment/39378576
upvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: sqlite
answer count: 1
has title: Android & SQLite : Sum column, send to Setter and get the value from another activity
has body: i have method getJumHutang, this method use for SUM all hutang column and save it to class Hutang, class Hutang use for setter and getter. this is the code for method getJumHutang : public class HutangDAO extends HutangDBDAO { public HutangDAO(Context context) { super(context); } public Cursor getJumHutang(Hutang hutang){ Cursor cursor = database.rawQuery("select sum("+DataBaseHelperHutang.JUMLAH+") FROM "+DataBaseHelperHutang.HUTANG_TABLE+"", null); try { if(cursor.moveToFirst()){ hutang.setJumHutang(cursor.getDouble(0)); } } finally { cursor.close(); close(); } return getJumHutang(hutang); } this code in MainActivity that call method setJumHutang : package mainmenu; import pemasukan.PemasukanMainActivity; import piutang.PiutangActivity; import hutang.Hutang; import hutang.HutangDAO; import hutang.HutangActivity; import com.androidopentutorials.sqlite.R; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class MainActivity extends Activity { TextView txtHutang; TextView txtPiutang; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_mainmenu); txtHutang = (TextView) findViewById(R.id.textHutang); HutangDAO dao = new HutangDAO(this); Hutang hutang = new Hutang(); dao.getJumHutang(hutang); txtHutang.setText(hutang.getJumHutang()+""); } public void callPiutang (View view){ Intent intent = new Intent(this, PiutangActivity.class); startActivity(intent); } public void callHutang (View view){ Intent intent = new Intent(this, HutangActivity.class); startActivity(intent); } public void callPemasukan (View view){ Intent intent = new Intent(this, PemasukanMainActivity.class); startActivity(intent); } @Override public void onBackPressed() { onShowQuitDialog(); } public void onShowQuitDialog() { …
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39451128
has text: Okay I checked and updated my symlinks on the MacBook Pro by following this guide: http://www.monkehworks.com/set-java-7-as-default-jvm-on-mac-osx-mountain-lion. But I does still not work. Next I will try to build my app on the MacBook.
score: 0
comment on: http://stackoverflow.com/q/25310004
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39547749
score: 1
type: Comment
has text: A `JList` is populated programmatically, not by the user. So you have full control over how many items are in there. The code you have already looks vaguely like what you need to check you don't exceed your own maximum.
type: QuestionComment
comment on: http://stackoverflow.com/q/25363408

http://stackoverflow.com/a/25273515
type: Answer
has body: Introduce an abstract base class for class1 ... classN and let the populating classes extend an abstract base class populating class which contains the code setting the common fields.
answers question: http://stackoverflow.com/q/25273481
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25273481
score: 0

http://stackoverflow.com/q/25362932
has comment: http://stackoverflow.com/comment/39546813
has comment: http://stackoverflow.com/comment/39546795
tagged with: java
tagged with: gps
type: AnsweredQuestion
downvote count: 4
upvote count: 0
answer count: 1
score: -4
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25363044
has title: Why do I get NullPointerException ? (Basic GPS logic)
has body: import java.math.BigDecimal; import java.util.*; public class DirectionGraphe { public ArrayList&lt;GraphVector&gt; shortest; public ArrayList&lt;GraphVector&gt; current_path; private ArrayList &lt;GraphVector&gt; fastest; private Integer weight_sum; private Integer current_gain; public DirectionGraphe(){ } private ArrayList &lt;GraphVector&gt; graph = new ArrayList&lt;GraphVector&gt;(); public ArrayList &lt;GraphVector&gt; getRoutes(GraphVector toncho){ ArrayList&lt;GraphVector&gt; list = new ArrayList &lt;GraphVector&gt; (); for(GraphVector eachVector : graph){ if(toncho.isRoute(eachVector)){ list.add(eachVector); } } return list; } public void addVector(GraphVector vector) throws Exception{ if(isConnected(vector) || graph.isEmpty()){ graph.add(vector); } else throw(new Exception (" Vector is not connected ! ")); } public boolean isConnected(GraphVector vector){ /////////////////////////////////////////////////////////////////////////////// for(GraphVector v : graph){ if(vector.isConnected(v)){ return true; } } return false; } public ArrayList&lt;GraphVector&gt; findShortestRoute(DecCoord start, DecCoord end){ for(GraphVector v : graph){ if(v.beginning.equals(start)){ current_path.add(v); if(v.end.equals(end)){ //If we are to be in that scope it means this we have found a vector from A to B and within that scope here we are checking if( shortest == null || shortest.isEmpty() || current_path.size() &lt; shortest.size() ){ // to see if this VECTOR is shorter compared to the last vector shortest = current_path; ArrayList &lt;GraphVector&gt; current_path2 = new ArrayList &lt;GraphVector&gt; ();/////////////////// current_path2.addAll(shortest); ///////////// // hack current_path.clear(); shortest = current_path2; ////////// } } else { for(GraphVector p : this.getRoutes(v)){ // System.out.println("shortest else " + shortest); System.out.println("current path else " + current_path); findShortestRoute(p.beginning,end); } } current_path.remove(current_path.lastIndexOf(cur…
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/25363044
has comment: http://stackoverflow.com/comment/39546818

http://stackoverflow.com/comment/39416182
comment on: http://stackoverflow.com/a/25291790
has text: It's not the most clear answer. The difference is where this code is placed. The suggestion is to move the code out of the `finish()` function and into whatever functions call it.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/38610658
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25281124
has body: WRITE_BUFFER_HIGH_WATER_MARK and WRITE_BUFFER_LOW_WATER_MARK options and relative methods in ChannelConfig are deprecated. .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1, 2)) that's how you do it.
type: Answer
score: 4

http://stackoverflow.com/comment/39421703
type: AnswerComment
comment on: http://stackoverflow.com/a/25294535
has text: cat the file to sed instead of echo
type: Comment
score: 0

http://stackoverflow.com/q/25283846
has comment: http://stackoverflow.com/comment/39401109
has body: Imagine I have a jQuery script to listen for drag and drop action and then upload them. If I open my webpage in a WebView , how can I drop a File object into that area? (basically fake a drop given I have a File object or path to that File for example I use the camera to take a picture, then I save that image. Now I would like to upload that image purely using browser capabilities (without httpClient requests on android side). Or If I could add my file to a file upload input (which I couldn't find a way to achieve).
answer count: 0
downvote count: 0
has title: Android webview, pretend file drop
tagged with: javascript
upvote count: 1
tagged with: jquery
tagged with: http
favorite count: 0
has comment: http://stackoverflow.com/comment/39401203
type: Question
tagged with: android
tagged with: java
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/39446022
comment on: http://stackoverflow.com/q/25307316
score: 0
type: Comment
type: QuestionComment
has text: Yes Schema is allowing dma_id values I inserted manually also.

http://stackoverflow.com/q/25316359
has title: Bing AdCenter API java keyword report Campaignid
accepted answer: http://stackoverflow.com/a/25316505
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39462342
type: Question
tagged with: bing
tagged with: api
has answer: http://stackoverflow.com/a/25316505
has body: I am working with the KeywordPerformance java report example. Is there a parameter for campaignid that will allow the request to pull all of the campaigns back for an account?
has comment: http://stackoverflow.com/comment/39491015
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/25557265
type: AcceptedAnswer
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/39947440
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25343866
answers question: http://stackoverflow.com/q/25343866
has body: If you're using log4j 1.x, we strongly recommend that you use org.apache.log4j.rolling.RollingFileAppender 1 instead of org.apache.log4j.DailyRollingFileAppender (may lose messages, Bug 43374). So the configuration of you appender can be: &lt;appender name="file" class="org.apache.log4j.rolling.RollingFileAppender"&gt; &lt;param name="encoding" value="UTF-8" /&gt; &lt;rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"&gt; &lt;param name="activeFileName" value="/logs/dailyschedule.log" /&gt; &lt;param name="fileNamePattern" value="/logs/dailyschedule%d{_dd.MM.yyyy_HH.mm.ss}.log" /&gt; &lt;/rollingPolicy&gt; &lt;layout class="org.apache.log4j.PatternLayout"&gt; &lt;param name="conversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} class:[%c] method:[%t] [%-5p] : %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; Using this configuration, you will get finenames like the next: 2 dailyschedule.log dailyschedule_28.08.2014_14.57.45.log dailyschedule_28.08.2014_14.57.46.log dailyschedule_28.08.2014_14.57.47.log dailyschedule_28.08.2014_14.57.48.log dailyschedule_28.08.2014_14.57.49.log Notes In that case, you need to add the respective jar (apache-log4j-extras-1.2.17.jar). If you don't want the first filename (dailyschedule.log), drop the param activeFileName in the rolling policy.

http://stackoverflow.com/a/25380678
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25365589
has body: Concerning the statement every time I've tried to remove additional - no new errors/warnings came up. This should not be the case. It should print a warning, because you are using the raw type Some, and the result of this is missing type safety, as demonstrated in the answer by newacct. The Dog/Cat example is a bit contrived, and somewhat flawed. You suggested declaring a class public class Dog extends Animal&lt;Cat&gt; { } // Note "Cat" !!! But here, the type parameter basically means: "This parameter (Cat) is the type that objects of this class (Dog) can be compared with". You are thus explicitly stating that a Dog should be comparable to Cat. Even with sophisticated languages and smart compilers, after all, it's in the responsibility of the programmers to write code that makes sense. Indeed, there are not many cases where these self-referential generic types are necessary. One of these examples is sketched in this FAQ entry: It declares a structure of nodes (that is, a tree) where the type parameter can be used to decouple the definition of the tree structure from the actual type of the nodes: public class RecurringTest { public static void main(String[] args) { SpecialNode sa = new SpecialNode(null); SpecialNode sb = new SpecialNode(sa); SpecialNode s = sa.getChildren().get(0); } } abstract class Node&lt;N extends Node&lt;N&gt;&gt; { private final List&lt;N&gt; children = new ArrayList&lt;N&gt;(); private final N parent; protected Node(N parent) { this.parent = parent; if (parent != null) { this.parent.getChildren().add(getThis()); } } abstract N getThis(); public N getParent() { return parent; } public List&lt;N&gt; getChildren() { return children; } } class SpecialNode extends Node&lt;SpecialNode&gt; { public SpecialNode(SpecialNode parent) { super(parent); } SpecialNode getThis() { return this; } } But from my personal experience, I can say that when you think you need to create such a type, you should thoroughly think about the benefits and drawbacks. The la…
upvote count: 2

http://stackoverflow.com/comment/39467462
has text: I see. The answer to the snippet was "...when a (local) variable and a class member are both in the same scope and have the same name, the variable takes precedence, in the same way that they take precedence over package names" (Java Practice Questions).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25319116

http://stackoverflow.com/q/25277039
tagged with: http://stackoverflow.com/tag/xml
type: Question
has answer: http://stackoverflow.com/a/25277682
has title: Java XML update issue - appendchild() not sucessfully append element
type: AnsweredQuestion
score: 0
has body: I have an issue when I append a new node to xml dom. The following code is the dom saving code in xmlFactory.java. import java.io.File; import java.io.StringWriter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import com.ism.msgmgt.domain.Post; import com.ism.msgmgt.domain.User; public class XmlFactory { private static Document userdom; private static Document postdom; private static File userfile = new File(User.class.getResource("User.xml").getPath()); static { try{ DocumentBuilderFactory dbuf = DocumentBuilderFactory.newInstance(); DocumentBuilder dbu = dbuf.newDocumentBuilder(); userdom = dbu.parse(userfile); DocumentBuilderFactory dbpf = DocumentBuilderFactory.newInstance(); DocumentBuilder dbp = dbpf.newDocumentBuilder(); postdom = dbp.parse(postfile); } catch (Exception e){ e.printStackTrace(); } } public static Document getUserDom(){ return userdom; } public static void saveUserDom(){ try { TransformerFactory tf = TransformerFactory.newInstance(); Transformer trans = tf.newTransformer(); System.out.println(userdom.getFirstChild()+"|"+userdom.getFirstChild().getFirstChild()); DOMSource ds = new DOMSource(userdom); StreamResult sr = new StreamResult(userfile); trans.transform(ds, sr); } catch (Exception e){ throw new RuntimeException(e.getMessage(),e); } } } Note that the printed output is [users: null]|[#text: ]. Next, it is the code in the UserDao.java. public class UserDao { public static Element currentUser = null; public static Document userdom = XmlFactory.getUserDom(); public static void reg(User u){ clrLogin(); u.setUserid(UidUtil.getUid()); u.setPassword(PwdUtil.encode(u.getPassword())); Element e = userdom.createElement("user"); e.setAttribute("id", u.getUserid()); e.setAttribute("username", u.getUserna…
accepted answer: http://stackoverflow.com/a/25277682
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39605471
type: QuestionComment
has text: Have you tried PGs COPY cmd to see how quickly it can run once you have the data? http://www.postgresql.org/docs/9.2/static/sql-copy.html Also can you see how long it takes to grab the data WITHOUT sending to db to get an idea of how long the data read takes? I had a similar problem but not in Java and ended up writing 1 insert cmd with many sets of values (batching that way) rather than many inserts with one set of values...Nick.
score: 0
comment on: http://stackoverflow.com/q/25318539
type: Comment

http://stackoverflow.com/comment/39310812
type: QuestionComment
has text: Start by taking a look at [How to Use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) and [Using Other Editors](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editor) for details about how to make a `JTable` editable...
score: 2
comment on: http://stackoverflow.com/q/25234925
type: Comment

http://stackoverflow.com/q/25330768
type: AnsweredQuestion
has title: 12 factor app config and Java
tagged with: 12factor
answer count: 3
accepted answer: http://stackoverflow.com/a/27140442
has comment: http://stackoverflow.com/comment/39490559
tagged with: java
downvote count: 0
tagged with: config
upvote count: 10
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/59042343
has body: I was reading the 12 factor app manifesto http://12factor.net/. The manifesto recommends storing the configuration data for the application in Enviornment variables. Does this mean that properties like the DB username / password, resource URL should be stored as a part of Java Env variables rather than as property files ? Is this a secure way of storing the information ? To me this seems to be a pretty clunky way of storing the information. Are there any best practices / experiences around this that can be shared ? One option that I can think of is to have a separate configuration service running in the landscape, and use Env property to connect to the config service and then query the config service for further detailed configuration data.
has answer: http://stackoverflow.com/a/39991474
score: 10
has answer: http://stackoverflow.com/a/27140442
has comment: http://stackoverflow.com/comment/39489494
possible better answer: http://stackoverflow.com/a/39991474

http://stackoverflow.com/q/25250125
linked to: http://stackoverflow.com/q/9082971
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25253372
accepted answer: http://stackoverflow.com/a/25253372
has comment: http://stackoverflow.com/comment/39345699
linked to: http://stackoverflow.com/q/13253624
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39366878
has comment: http://stackoverflow.com/comment/39355885
has comment: http://stackoverflow.com/comment/39373224
has comment: http://stackoverflow.com/comment/51426290
has comment: http://stackoverflow.com/comment/39354852
has comment: http://stackoverflow.com/comment/39377277
tagged with: annotations
has title: enum value used in annotation where a string is expected
has comment: http://stackoverflow.com/comment/39366974
score: 4
upvote count: 4
has body: Suppose that I have a simple annotation: @MyAnnotation(value=&lt;SomeString&gt;) and an enum: enum Days { MONDAY... } I cant use this annotation like this: @MyAnnotation(value=Days.MONDAY.name()) private class SomeClass { //some code } This code will fail saying that "it must be a compiled time constant". I do understand why this happens and I am aware of the JSL part about compiled time constants. My question is why and what is the reasoning behind not making an enum a compiled time constant according to the specification. It's not like you can change that enum name... EDIT for Kumar private static final class Test { public static final String complete = "start" + "finish"; }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39365088
tagged with: enums
has comment: http://stackoverflow.com/comment/39366800
has comment: http://stackoverflow.com/comment/39366137
has comment: http://stackoverflow.com/comment/39364630
tagged with: java

one-to-many
tags question: http://stackoverflow.com/q/25252995
tags question: http://stackoverflow.com/q/25232117
type: Tag
tags question: http://stackoverflow.com/q/25252183
tag name: one-to-many
tags question: http://stackoverflow.com/q/25236742
tags question: http://stackoverflow.com/q/25264994

http://stackoverflow.com/q/25389506
linked to: http://stackoverflow.com/q/1552301
type: AnsweredQuestion
has title: Why does my variable contain "2122" and not "2322"?
has comment: http://stackoverflow.com/comment/39598420
has comment: http://stackoverflow.com/comment/39598352
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/39598037
downvote count: 3
answer count: 1
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/39598073
favorite count: 0
accepted answer: http://stackoverflow.com/a/25389549
type: Question
has body: This was a question on an exam. Luckily I picked the right answer, but I still can't see why it's right. Consider this program: class D { protected C c; public D(C c) { this.c = new C(c); } public C getC() { return c; } public void setC(C c) { this.c = c; } } class C { protected String s; public C(String s) { this.s = s; } public C(C c) { this(c.s); } public String getS() { return s; } public void setS(String s) { this.s = s; } public static void main(String[] args) { C c1 = new C("1"); C c2 = new C("2"); D[] d = { new D(c1), new D(c1), new D(c2), new D(c2) }; d[0] = d[3]; c1.setS("3"); String r = ""; for (D i: d) { r += i.getC().getS(); } System.out.println(r); } } It'll print 2122. I would expect 2322 however (I'm clearly wrong when you run the code). My reasoning behind that: In the third line of the main method, four instances of D get initialized. The constructor of D makes a new instance of C. An instance of C has a String variable which points somewhere to a spot in the memory. Now the instance variable c, let's call it c3, of the object in d[1] has a instance variable (type String), let's call it s3, pointing to the same memory as the String s1, variable of c1. So when we change s1, I'd expect the value of s3 also to change, since it's pointing to the same spot in the memory. On a side note, if you change the constructor of D, see below, you'll get 2322 instead. Which I'd expect, since now the variable c3 in d[1] is pointing directly towards the memory location of c1. public D(C c) { this.c = c; } My thoughts so far on the explanation (could be wrong): When initializing the instance variable s1/s3, new String objects get made (so far I assumed they were pointing towards "1" in the String pool, since the constructor of C makes it look that way) When changing s1, it's pointer will be redirected towards "3" in the String pool. Rather than "1" becoming "3" in the pool. Could anyone explain this behaviour? What are the errors in my (faulty) reasoning?
tagged with: string-pool
has answer: http://stackoverflow.com/a/25389549
tagged with: mutators
tagged with: java

http://stackoverflow.com/comment/39313890
score: 1
has text: Welcome to SO, I think this [Object References](http://xstream.codehaus.org/graphs.html) link might help you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25236523

http://stackoverflow.com/comment/39511018
comment on: http://stackoverflow.com/a/25342643
type: AnswerComment
score: 4
has text: @DmitryFucintv: Have you posted a single SO question about a practical problem, rather than language-lawyering over specs?
type: Comment

http://stackoverflow.com/a/25369193
has comment: http://stackoverflow.com/comment/39576074
type: Answer
has comment: http://stackoverflow.com/comment/39576099
has comment: http://stackoverflow.com/comment/39618467
has comment: http://stackoverflow.com/comment/39590690
answers question: http://stackoverflow.com/q/25365204
has comment: http://stackoverflow.com/comment/39582407
has comment: http://stackoverflow.com/comment/39578518
has comment: http://stackoverflow.com/comment/39578603
score: 0
has comment: http://stackoverflow.com/comment/39586338
has body: The problem is that your code creates just one MsgBean ms object, and inserts that same over and over into the array. That's why you get three times the same data, you're in fact displaying the same object three times. You need to move the instantiation of that object to inside the loop, like this: while (rs2.next()) { tab.setTest("ok"); String from2 = rs2.getString("fromm"); String contenu2 = rs2.getString("contenu"); String dateenvoi2 = rs2.getString("DateEnvoi"); String numexp2 = rs2.getString("NumExp"); // a fresh ms per iteration MsgBean ms = new MsgBean(); ms.setFrommm(from2); ms.setContenu(contenu2); ms.setDateEnvoi(dateenvoi2); ms.setNumExp(numexp2); tab.m[i] = ms; i = i + 1; } Next, it looks like your class msgTabl (class names should start with a capital, better to rename it to MsgTabl) contains an array, it may be preferrable to replace that array with an ArrayList, especially when the length of the list is variable. Regarding John Gardner's statement about SQL injections - stringing together a query string like you do is indeed extremely dangerous - see http://bobby-tables.com/ for a good, understandable explanation of why one day you will be hacked or vandalized if you don't address this problem. It's really quite simple to solve using PreparedStatement: PreparedStatement statement = conn.prepareStatement("select id_u from utilisateur where pseudo= ? and motdepasse= ?"); statement.setString(1,pseudo); statement.setString(2,motDePasse); ResultSet rs1 = statement.executeQuery();

http://stackoverflow.com/comment/39563708
comment on: http://stackoverflow.com/q/25324636
type: Comment
score: 1
type: QuestionComment
has text: Ok, mocking out a class is easy enough but there's no point me just pasting from the manual as I assume you've read them. What have you tried so far or what do you not understand that is causing you problems?

http://stackoverflow.com/comment/39589544
type: QuestionComment
has text: So you expect your list of items to contain a list of items? Or do you expect your list of items to contain items? As far as I can see, `contains` is a varargs method not `Collection` based → `assertThat(expectedItems, contains(items.toArray()));`…
score: 2
comment on: http://stackoverflow.com/q/25385058
type: Comment

http://stackoverflow.com/a/25360249
score: 0
answers question: http://stackoverflow.com/q/25359901
type: Answer
has body: Do not use the locale as context. You can rather have a locale variant like: de_DE_&lt;variant&gt;, e.g., de_DE_A, de_DE_B but note that a variant is not possible without a country.

http://stackoverflow.com/q/25307027
type: Question
has comment: http://stackoverflow.com/comment/39444558
has comment: http://stackoverflow.com/comment/39444822
has comment: http://stackoverflow.com/comment/39444527
has answer: http://stackoverflow.com/a/25307328
has answer: http://stackoverflow.com/a/25307491
has body: I have written a small program that shall print the difference between two Date objects: public static void main(final String[] args) throws Exception { final DateFormat df = new SimpleDateFormat("HH:mm:ss.SSSSSS"); final Date start = Calendar.getInstance().getTime(); Thread.sleep(1000); final Date end = Calendar.getInstance().getTime(); final long startMilliseconds = start.getTime(); final long endMilliseconds = end.getTime(); final long runtimeMilliseconds = endMilliseconds - startMilliseconds; final Date runtime = new Date(runtimeMilliseconds); System.out.print("Start : " + df.format(start)); System.out.println("\t Milliseconds: " + startMilliseconds); System.out.print("End : " + df.format(end)); System.out.println("\t Milliseconds: " + endMilliseconds); System.out.print("Runtime: " + df.format(runtime)); System.out.println("\t Milliseconds: " + runtimeMilliseconds); System.out.println(); System.out.println("Milliseconds from new Date object: " + runtime.getTime()); } It gives the following output: Start : 13:24:54.000871 Milliseconds: 1408015494871 End : 13:24:55.000871 Milliseconds: 1408015495871 Runtime: 01:00:01.000000 Milliseconds: 1000 Milliseconds from new Date object: 1000 The difference between the milliseconds is correct, but the newly created Date object has an extra hour added. The expected output for the runtime object would be: 00:00:01.000000. I think this is because of my timezone (GMT+1). How can I compute the difference between two Date objects and get a new Date object, that does not include the extra hour, back? I do not want to use Joda-Time or another library.
possible better answer: http://stackoverflow.com/a/25307267
tagged with: java
has comment: http://stackoverflow.com/comment/39445372
accepted answer: http://stackoverflow.com/a/25307288
tagged with: date
linked to: http://stackoverflow.com/q/230126
has answer: http://stackoverflow.com/a/25307288
answer count: 4
has comment: http://stackoverflow.com/comment/39444497
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39444938
linked to: http://stackoverflow.com/q/1440557
tagged with: timezone
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39444699
upvote count: 1
has answer: http://stackoverflow.com/a/25307267
has title: Computing the difference of two dates
favorite count: 0

http://stackoverflow.com/comment/39373113
type: Comment
has text: Use `Class<?>` instead. Also, it's a warning, just use the `@SupressWarnings("unchecked")` and move on.
type: QuestionComment
comment on: http://stackoverflow.com/q/25268510
score: 2

http://stackoverflow.com/comment/39545696
has text: @aioobe I think you are right, I'll delete this answer after some research on this topic.
type: Comment
comment on: http://stackoverflow.com/a/25362128
score: 0
type: AnswerComment

http://stackoverflow.com/a/25386112
has comment: http://stackoverflow.com/comment/39591255
accepted answer of: http://stackoverflow.com/q/25386065
answers question: http://stackoverflow.com/q/25386065
type: Answer
upvote count: 4
score: 4
has body: TICKET[.0-9] means the string TICKET followed by either a dot or a digit between 0 and 9. What you actually need is TICKET[0-9]+: the string TICKET followed by one or more digits between 0 and 9. [0-9] can be simplified to \d (i.e. TICKET\d+), but don't forget to escape the backslash in Java since in a string literal (i.e. TICKET\\d+). You may want to remove the leading space(s) as well: TICKET\d+\s+ (again, TICKET\\d+\\s+ for Java).
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39605138
type: Comment
type: QuestionComment
has text: You never set your caret on the textpane. You need a line looking like this: `textpane.setCaret(overtypeCaret);`
comment on: http://stackoverflow.com/q/25305054
score: 0

http://stackoverflow.com/comment/39500944
comment on: http://stackoverflow.com/a/25336629
type: Comment
has text: Ermm ... that would *prevent* overriding. My / our guess is that they want to *allow* overriding of that method, but in a way that doesn't break the internals of `HashMap`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25236434
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25236339
downvote count: 0
has body: Simple answer is, yes. You can update the progress bar at any time, so long as you do it from within the context of the Event Dispatching Thread. What you will require is some way to tell the JProgressBar what it's new value should be, but that will depend on what it is you are trying to achieve. import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JProgressBar; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class AutoProgress { public static void main(String[] args) { new AutoProgress(); } private JProgressBar pb; private int progress; public AutoProgress() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } pb = new JProgressBar(); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); frame.add(pb); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); Timer timer = new Timer(50, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { progress += 1; if (progress &gt;= 100) { progress = 100; ((Timer)e.getSource()).stop(); } pb.setValue(progress); } }); timer.start(); } }); } } You might also like to have a look at JProgressBar#setIndeterminate. You should also have a look at How to use Swing Timers
answers question: http://stackoverflow.com/q/25236339
upvote count: 3
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39313702

http://stackoverflow.com/comment/39489478
type: QuestionComment
comment on: http://stackoverflow.com/q/25330769
score: 0
type: Comment
has text: the question has now changed. not a duplicate anymore!

http://stackoverflow.com/comment/39463900
has text: @biziclop good explaination! Thanks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25316190
score: 0

http://stackoverflow.com/comment/39304168
type: QuestionComment
comment on: http://stackoverflow.com/q/25231639
has text: @shlomi33 : He made a mistake, his actual input is `"http://www.gmail.com"` so substring(10,11) returns ".". You can see it in his outputs.
score: 0
type: Comment

http://stackoverflow.com/q/25327139
has comment: http://stackoverflow.com/comment/39483199
tagged with: android
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25331802
has body: I downloaded the Android SDK with eclipse, but it won't open up. I also downloaded the jdk latest version, set paths, etc.but when I click android SDK application , it doesn't start. I tried to open it through eclipse, but it didn't open. the SDK manager doesn't have an android icon. So, I think there's a problem with that application. Can anyone here give me the right solution ? Check out this screen shot :
tagged with: eclipse
favorite count: 0
type: Question
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/39489050
has title: Android SDK with eclipse but not opening up

http://stackoverflow.com/comment/39430304
comment on: http://stackoverflow.com/a/25254582
type: Comment
score: 0
type: AnswerComment
has text: I have not forgotten about this answer, I am still working through some of the details. I think I see where you are going with this. I think you have provided some very good “breadcrumbs” to follow. When I do get through this I will probably comeback and edit your answer with some more details before I accept it. I am finding this DI/Dagger stuff to be a bit over my head.

http://stackoverflow.com/q/25307240
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25906692
score: 0
tagged with: java-6
tagged with: java
tagged with: eclipse
type: Question
has body: I am currently switching from C# to Java and I am trying to find a good alternative for the C# resource files to store strings. The internationalization of jlibs sounds like exactly what I am looking for. But it's just not working for me. If I understand it correctly then it actually should create two files when I compile the project: Bundle.properties _Bundle.class But nothing gets created. Here's some code, which is basically the example on the webpage. Calling a string from the bundle: package i18n; import static i18n.UIBundle.UI_BUNDLE; public class Main { public static void main(String[] args) { System.out.println(UI_BUNDLE.executeButton()); } } The bundle: package i18n; import jlibs.core.util.i18n.I18N; import jlibs.core.util.i18n.Message; import jlibs.core.util.i18n.ResourceBundle; @ResourceBundle public interface UIBundle{ public static final UIBundle UI_BUNDLE = I18N.getImplementation(UIBundle.class); @Message("Execute") public String executeButton(); } And the error actually telling me, that there's no _Bundle class: Exception in thread "main" java.lang.ExceptionInInitializerError at i18n.Main.main(Main.java:10) Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: i18n._Bundle at jlibs.core.util.i18n.I18N.getImplementation(I18N.java:34) What I did: Created a new Java project in Eclipse Added jlibs-core.jar to the Referenced Libraries Added the whole jlibs-folder to Java - Build Path - Classpath Variables Downloaded xercesImpl.jar and added it to the Referenced Libraries Did I just miss some basic configuration I am not aware of or do I need some other preconditions? Anyone seeing my mistake?
has title: JLibs internationalization doesn't create _bundle.class and properties file

http://stackoverflow.com/comment/39513035
has text: and now i did receive an error ...i changed the file into a smaller one and i got an error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25343033
score: 0

http://stackoverflow.com/comment/39557795
has text: Process each item separately, in a loop.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25368396

http://stackoverflow.com/q/25270502
has title: stylish wise, is it better to have an else after a conditional that throws an exception?
has body: public void printLevel(int n){ if(n&lt;1){ throw new IllegalArgumentException(); } printLevel(overallRoot, n); } This is my code. In the industry, would it be better to have an else surrounding the printLevel, acknowledging if the if statement evaluates to false, this is what is going to happen or does it really not matter.?
possible better answer: http://stackoverflow.com/a/25270589
tagged with: exception
has answer: http://stackoverflow.com/a/25270594
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25270594
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25270589
has comment: http://stackoverflow.com/comment/39376913
score: 1
tagged with: styles
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/25332664
downvote count: 0
score: 6
upvote count: 6
has body: Maybe you should look into Enums. public enum MyEnum { A(0), B(1); private int parameter; public MyEnum(int parameter) { this.parameter = parameter; } } Basically, this forces that you can only have the object with the parameter = 0,or parameter = 1. However, this also only allows ONE instance of each type (0, 1, etc...), so this may not work depending on your use case.
answers question: http://stackoverflow.com/q/25332633
type: Answer

http://stackoverflow.com/q/25344956
has title: Creating a boolean for Tic Tac Toe Java GUI to tell if the player wins
tagged with: logic
has comment: http://stackoverflow.com/comment/39514869
score: 0
tagged with: java
has body: I am new to programming and have been trying to make a GUI tic tac toe game. For will be showing a dumb down program of mine in which the four buttons are clicked, it will print either 'X' or 'Y'.I am able to change btw 'X' and 'Y' for my GUI game whenever a button is clicked. However, I've been working at creating a char array to detect whether the player has won or not. class Board extends JPanel{ // char[][] cells = new char[2][2]; //boolean won(char token)....? //any clue to construct a boolean to tell if cells[0][0] === cels[0][1]? private char token = ' '; char turn = 'O'; char getToken(){ return token; } void setToken(char token){ this.token = token; } JButton b[] = new JButton[4]; public Board(){ setLayout(new GridLayout(2,2,0,0)); for(int i = 0 ; i &lt; 4; i ++){ b[i] = new JButton(); add(b[i]); } listener(); } void listener(){ for(int i = 0; i &lt; 4; i ++){ b[i].addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { turn = (turn == 'X') ? 'O': 'X'; System.out.println("Button Clicked" + turn); //add if(won(turn))....? } }); }
type: Question
tagged with: boolean
has comment: http://stackoverflow.com/comment/39514843
has comment: http://stackoverflow.com/comment/39514774
has answer: http://stackoverflow.com/a/25345149
has comment: http://stackoverflow.com/comment/39514776
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39514895
answer count: 1
has comment: http://stackoverflow.com/comment/39514906

http://stackoverflow.com/comment/39624555
comment on: http://stackoverflow.com/a/25380526
type: Comment
has text: Is that also valid in case it is a fragment activity?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39301548
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25230385
has text: This works perfectly. Thank you! Note to others: I had to import java.util.List; for this to work

http://stackoverflow.com/comment/39550273
type: QuestionComment
comment on: http://stackoverflow.com/q/25364766
type: Comment
score: 0
has text: You need to check the file/directory exists first.

configuration
tags question: http://stackoverflow.com/q/25383094
tags question: http://stackoverflow.com/q/25339427
tags question: http://stackoverflow.com/q/25256573
tags question: http://stackoverflow.com/q/25378919
tags question: http://stackoverflow.com/q/25291489
tag name: configuration
tags question: http://stackoverflow.com/q/25284278
tags question: http://stackoverflow.com/q/25333337
type: Tag
tags question: http://stackoverflow.com/q/25242089
tags question: http://stackoverflow.com/q/25374178

http://stackoverflow.com/a/25283425
answers question: http://stackoverflow.com/q/25283329
type: Answer
has comment: http://stackoverflow.com/comment/39401540
score: 0
has body: Yes. It is possible. If they are static fields you can refer to them as interface.variableName; If private you can create getter methods like: public variableType getVariableX(){ return variableX; } and call them on an instance of that class. For example: Interface interface = new Interface(); interface.getVariableX();//&lt;-- Assign this to a variable or do w/e operation etc.. If you want more than that you need to post some code Update after your comment: For the login and password you can: 1) Set those fields to static on your interface class: public static String login = //whatever public static String password = //whatever 2) Inside your Connecting class do the following: String login = interface.login; String password = interface.password; or just use them like this: System.out.println(interface.login); etc.. NOTE: You should also be aware of Java naming conventions. You should name your classes starting with a capital letter. Like Connecting etc. Hope this helps
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39401723
has comment: http://stackoverflow.com/comment/39401844
accepted answer of: http://stackoverflow.com/q/25283329
has comment: http://stackoverflow.com/comment/39401601

http://stackoverflow.com/q/25291480
type: AnsweredQuestion
tagged with: cucumber
tagged with: cucumber-jvm
tagged with: cucumber-junit
answer count: 3
tagged with: java
tagged with: junit
downvote count: 0
has body: I am facing an error whenever I run the cucumber test by Junit. Here is the following Exception. Any help will be awesome NOTE: THERE IS NO ERROR IN THE PROJECT java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398) at java.lang.Class.getConstructor0(Class.java:2708) at java.lang.Class.getConstructor(Class.java:1659) at cucumber.runtime.Reflections.hasConstructor(Reflections.java:53) at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:29) at cucumber.runtime.Runtime.loadBackends(Runtime.java:96) at cucumber.runtime.Runtime.<init>(Runtime.java:63) at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:74) at cucumber.api.junit.Cucumber.<init>(Cucumber.java:61) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at …
has answer: http://stackoverflow.com/a/60335602
accepted answer: http://stackoverflow.com/a/25323585
favorite count: 0
type: Question
has title: Cucumber Exception: java.lang.ClassNotFoundException: cucumber.io.ResourceLoader
possible better answer: http://stackoverflow.com/a/28676169
has answer: http://stackoverflow.com/a/28676169
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/25323585

http://stackoverflow.com/comment/39536021
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25348423
has text: The call to tz.getOffset(..) returns the time difference with respect to UTC. You would have observed the value Etc/UTC=0. You can modify the above code to return hours instead of minutes (Note the int type).

http://stackoverflow.com/a/25337893
downvote count: 0
has comment: http://stackoverflow.com/comment/39502889
has comment: http://stackoverflow.com/comment/39503036
type: Answer
has comment: http://stackoverflow.com/comment/39502821
has comment: http://stackoverflow.com/comment/39502906
has body: Your problem is this code private void add(Transaction trans) because you are passing an object and the setting the values of the object which replaces the previous value so do something like this private void add(){ Transaction trans= new Transaction(); //then set whatever you want to the obect and add the object to the list }
score: 2
answers question: http://stackoverflow.com/q/25337829
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25337829

http://stackoverflow.com/q/25372282
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39587185
has answer: http://stackoverflow.com/a/25384510
downvote count: 0
has body: I am trying to implement an MVC type pattern in my Eclipse plugin, but I'm stuck. I can't figure out how to have my controls tell the form that they belong to that they have changed. There's no isDirty() method and no firePropertyChanged() method like I am using in the form/editor relationship.
score: 1
upvote count: 1
tagged with: eclipse-plugin
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39574627
has title: How can I tell my form that the value of a control changed?
tagged with: swt
answer count: 1
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/25384510

http://stackoverflow.com/comment/39550396
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25364433
has text: It will take some time for me to understand, exactly how to implement this in my code, cause i'm fairly new to Java... but I'm confident that it will work in time :D

http://stackoverflow.com/comment/39373831
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25267497
has text: @DavidConrad thanks, but the query seems to accept using formatter. Also I am using JPQL, and I think SQL is different, right? I don't know too much as I only started recently.

http://stackoverflow.com/a/25336235
has comment: http://stackoverflow.com/comment/39499883
answers question: http://stackoverflow.com/q/25336123
type: Answer
score: 0
has body: I'm not sure exactly what you're asking but try this. If you can select the text in Logcat you can just select the text then type control c. that's the copy shortcut for windows. use command c for mac. then open a text editor and paste it in.

http://stackoverflow.com/q/25305481
answer count: 1
has title: jarsigning using a keystore whose password includes a space
linked to: http://stackoverflow.com/q/2889238
favorite count: 0
has body: I'm signing an APK using a keystore whose password includes spaces, using jarsigner. I'm specifying -storepass and then putting the password in quotes, e.g. -storepass "my password 123". The sign always goes wrong though, because the key hash is not what I expect it to be. This is crucial for automating the build of my Android app without any user input.
has comment: http://stackoverflow.com/comment/39441765
type: Question
has answer: http://stackoverflow.com/a/25305482
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39446449
downvote count: 0
score: 1
upvote count: 1
tagged with: jarsigner

list
type: Tag
tags question: http://stackoverflow.com/q/25307945
tags question: http://stackoverflow.com/q/25252264
tags question: http://stackoverflow.com/q/25279033
tags question: http://stackoverflow.com/q/25332951
tags question: http://stackoverflow.com/q/25334353
tags question: http://stackoverflow.com/q/25297857
tags question: http://stackoverflow.com/q/25347470
tag name: list
tags question: http://stackoverflow.com/q/25359104
tags question: http://stackoverflow.com/q/25253350
tags question: http://stackoverflow.com/q/25248619
tags question: http://stackoverflow.com/q/25250320
tags question: http://stackoverflow.com/q/25326584

http://stackoverflow.com/comment/39340209
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25250025
score: 0
has text: Yes.. then I removed after posting this.

http://stackoverflow.com/comment/39354852
type: QuestionComment
comment on: http://stackoverflow.com/q/25250125
score: 0
has text: What is your edit intending to show? `complete` is not a compile-time constant and as such cannot be used with annotation values.
type: Comment

http://stackoverflow.com/a/26546541
upvote count: 41
has comment: http://stackoverflow.com/comment/102941214
type: Answer
has body: It seems that @Column(name="..") is completely ignored unless there is spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy specified, so to me this is a bug. I spent a few hours trying to figure out why @Column(name="..") was ignored.
has comment: http://stackoverflow.com/comment/43305757
downvote count: 1
score: 40
answers question: http://stackoverflow.com/q/25283198

http://stackoverflow.com/comment/39311078
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25234523
type: Comment
has text: Thanks. But if we look just into performance sake, which one would be better?

http://stackoverflow.com/comment/39428702
type: Comment
comment on: http://stackoverflow.com/q/25298319
score: 2
type: QuestionComment
has text: Make sure you're calling `super.paintComponent`. Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses

http://stackoverflow.com/a/25329700
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25329457
has body: If i understand your question correctly, I think you might want to look at this /** * Listener for monitoring events about sliding panes. */ public interface PanelSlideListener { /** * Called when a sliding pane's position changes. * @param panel The child view that was moved * @param slideOffset The new offset of this sliding pane within its range, from 0-1 */ public void onPanelSlide(View panel, float slideOffset); /** * Called when a sliding panel becomes slid completely collapsed. * @param panel The child view that was slid to an collapsed position */ public void onPanelCollapsed(View panel); /** * Called when a sliding panel becomes slid completely expanded. * @param panel The child view that was slid to a expanded position */ public void onPanelExpanded(View panel); /** * Called when a sliding panel becomes anchored. * @param panel The child view that was slid to a anchored position */ public void onPanelAnchored(View panel); /** * Called when a sliding panel becomes completely hidden. * @param panel The child view that was slid to a hidden position */ public void onPanelHidden(View panel); }` .... /** * Sets the panel slide listener * @param listener */ public void setPanelSlideListener(PanelSlideListener listener) { mPanelSlideListener = listener; } so basically this is how you do it. slide.setPanelSlideListener(new PanelSlideListener(){ // Override here }); theres a demo over here hope it helps :)
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25329457
has comment: http://stackoverflow.com/comment/50615273

http://stackoverflow.com/comment/39591744
comment on: http://stackoverflow.com/q/25386413
type: Comment
score: 0
has text: so what's the solution? please help
type: QuestionComment

http://stackoverflow.com/comment/39497667
type: Comment
comment on: http://stackoverflow.com/a/25325605
score: 2
type: AnswerComment
has text: This doesn't answer the question at all.

http://stackoverflow.com/a/25387812
type: Answer
answers question: http://stackoverflow.com/q/25387716
has body: You need to specify your messageconverter and bind it: <mvc:annotation-driven> <mvc:message-converters register-defaults="false"> <constructor-arg index="0" value="application" /> <constructor-arg index="1" value="json" /> <constructor-arg index="2" value="UTF-8" /> </mvc:message-converters> </mvc:annotation-driven>
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39512559
type: Comment
type: QuestionComment
score: 0
has text: If your Java is installed from packages, it will be in a few different folders. The main part is probably in `/usr/lib/jvm/YOUR_JDK` and config files will be under `/etc/YOUR_JDK`.
comment on: http://stackoverflow.com/q/25341888

http://stackoverflow.com/comment/39558004
type: AnswerComment
score: 0
has text: this code is simply for getting the result value. The next part of the code is where everything comes together. I am trying to return menuItems. Before this feature was edited i did return result. The code after this example is where im looking for a return
type: Comment
comment on: http://stackoverflow.com/a/25364397

http://stackoverflow.com/q/25337235
tagged with: layout-manager
tagged with: swing
has comment: http://stackoverflow.com/comment/39501629
favorite count: 0
type: AnsweredQuestion
tagged with: border-layout
has comment: http://stackoverflow.com/comment/39501834
linked to: http://stackoverflow.com/q/8840299
tagged with: java
has answer: http://stackoverflow.com/a/25337448
accepted answer: http://stackoverflow.com/a/25337448
tagged with: flowlayout
has answer: http://stackoverflow.com/a/25339472
possible better answer: http://stackoverflow.com/a/25339472
has title: swing flowlayout preferredSize does not change automatically
type: Question
has body: I want to have a FlowLayout for MyPanel to add some arbitrary buttons. I added MyPanel into JFrame north ( JFrame has a BorderLayout). My problem is: When the buttons inside MyPanel occupy more than one row, they are not displayed. In other words, preferredSize of MyPanel does not change automatically to show the whole content of it. It only shows one row of buttons. public class NewMain { public static void main(String[] args) { JFrame mainFrame = new JFrame(); mainFrame.getContentPane().setLayout(new BorderLayout()); mainFrame.setSize(new Dimension(500,500)); JPanel p1 = new MyPanel(); p1.setLayout(new FlowLayout()); mainFrame.add(p1,BorderLayout.NORTH); mainFrame.add(new JButton("center"),BorderLayout.CENTER); p1.add(new JButton("helllloo1")); p1.add(new JButton("helllloo2")); p1.add(new JButton("helllloo3")); p1.add(new JButton("helllloo4")); p1.add(new JButton("helllloo5")); p1.add(new JButton("helllloo6")); p1.add(new JButton("helllloo7")); mainFrame.setVisible(true); } public static class MyPanel extends JPanel{ } } And when I change MyPanel such that it overrides getPreferredSize and set constant size, it works properly. public static class MyPanel extends JPanel{ @Override public Dimension getPreferredSize(){ return new Dimension(-1,100); } } But I want it to work automatically. Any help will be appreciated.
answer count: 2
upvote count: 5
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/62302649

http://stackoverflow.com/q/25230964
tagged with: jsp
downvote count: 1
has body: How can we fix the session fixation issue in web application where as i am logging in to the application using openam. please give some suggestion . Any help would be appriciated. Thanks in advance.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25231064
tagged with: servlets
type: AnsweredQuestion
has title: How to fix Session fixation issue in Web Application
upvote count: 2
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25231064
answer count: 1

http://stackoverflow.com/a/25274453
has comment: http://stackoverflow.com/comment/39424066
accepted answer of: http://stackoverflow.com/q/25274046
type: Answer
has body: Something like this might help: for (int i = 0; i &lt; fileNames.length; i++) { fileNames[i] = fileNames[i].replace(".jpg", ""); //Removes .jpg from the file names } ZeroNum[] numbers = new ZeroNum[]; for (int i = 0; i &lt; numbers.length; i++) { numbers[i].zeros = fileNames[i].length() - Integer.toString(Integer.parseInt(fileNames[i])).length(); // total length of string minus non-zero numbers[i].num = Integer.parseInt(fileNames[i]); } class ZeroNum { int num, zeros; public ZeroNum(int num, int zeros) { this.num = num; this.zeros = zeros; } } I get that this is a pretty ugly solution, but it should work...
has comment: http://stackoverflow.com/comment/39384584
has comment: http://stackoverflow.com/comment/39395415
answers question: http://stackoverflow.com/q/25274046
has comment: http://stackoverflow.com/comment/39411327
score: 0
has comment: http://stackoverflow.com/comment/39418716
has comment: http://stackoverflow.com/comment/39386760
type: AcceptedAnswer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/39434218
has text: easy enough to remove static. What is not elegant?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25301406

http://stackoverflow.com/comment/39510635
comment on: http://stackoverflow.com/a/25342139
has text: @PeterLawrey 6-7 edits is right all bots I have seen on wikipedia have this speed. My function is simple get the text and replace something and then submit.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/39466228
type: AnswerComment
has text: In that case, what makes you think I'll explain nit any better?
type: Comment
comment on: http://stackoverflow.com/a/25299092
score: 0

http://stackoverflow.com/comment/39621046
type: AnswerComment
comment on: http://stackoverflow.com/a/25386892
score: 0
type: Comment
has text: Are you saying you had to add the "t" prefix? I was under the impression that there's no actual requirement for it to begin with a "t". The "t" prefix was originally to signify it was an official component delivered by Talend but the community seemed to pick it up as well. Or is there something else you did here? Could you list the naming specifics/requirements. Preferably with a link to where it's stated.

http://stackoverflow.com/comment/39668946
has text: Have you ever used [strace](http://linux.die.net/man/1/strace) before? You could do `strace -e trace=file` and watch file operations on a working and non-working installation.
type: Comment
comment on: http://stackoverflow.com/a/25385031
score: 0
type: AnswerComment

http://stackoverflow.com/q/25361086
has comment: http://stackoverflow.com/comment/39544304
has title: javax.crypto.IllegalBlockSizeException: last block incomplete in decryption AES
type: UnansweredQuestion
tagged with: sockets
tagged with: encryption
has body: I had a server written in c# and a client written in Java. For the encrypt decrypt part, I am using this method public byte[] EncryptAES(String strText) throws Exception { objCipher.init(Cipher.ENCRYPT_MODE, objSecretKey); Log.d("datazz", String.valueOf(strText.getBytes("UTF8"))); return objCipher.doFinal(strText.getBytes("UTF8")); } public byte[] DecryptAES(byte[] tData) throws Exception { objCipher.init(Cipher.DECRYPT_MODE, objSecretKey); return objCipher.doFinal(tData); } It works properly without any issues,but when I try to send data at much faster speed , I start getting these few errors javax.crypto.IllegalBlockSizeException: last block incomplete in decryption java.net.SocketException: sendto failed: EPIPE (Broken pipe) org.json.JSONException: Unterminated object at character 257 It's kinda hard for to trace the issues because when I try to break point , it works properly , it only happens when I tried to send data at fast speed (EG: sending 5 request to server in one second) and it seems like crashing randomly Anyone has any idea what causes this? Much appreciate for the help , thanks in advance Here's the receiving part public void run() { tBuffer = null; objSocket = new Socket(); SocketAddress socketAddress = new InetSocketAddress(strServerIP, iServerPort); bTerminate = false; while(!bTerminate){ try { if(!objSocket.isConnected()) { // reconnect feature iNumConnection++; objSocket.connect(socketAddress); // successful connect, reset the connection has be make back to zero iNumConnection = 0; if(objSocketClientListener != null) objSocketClientListener.Connected(); } else { int numCount = objSocket.getInputStream().available(); if(numCount&gt;0) { byte[] receivedData = new byte[numCount]; //bytesReceived += objIn.read(tBuffer, bytesReceived, tBuffer.length - bytesReceived); objSocket.getInputStream().read(receivedData); //for first time initial if (tBuffer == null) { tBuffer = new byte[numCount]; System.arraycopy(receivedData, 0, tBuffer, 0, receivedData.le…
has comment: http://stackoverflow.com/comment/39543620
has comment: http://stackoverflow.com/comment/39548337
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39544056
tagged with: java
has comment: http://stackoverflow.com/comment/39570357
has comment: http://stackoverflow.com/comment/39544714
type: Question

http://stackoverflow.com/a/25324070
upvote count: 2
has comment: http://stackoverflow.com/comment/87023565
has comment: http://stackoverflow.com/comment/39515242
has comment: http://stackoverflow.com/comment/51829074
downvote count: 0
has comment: http://stackoverflow.com/comment/51830055
score: 2
has comment: http://stackoverflow.com/comment/87027275
type: Answer
answers question: http://stackoverflow.com/q/25319880
has comment: http://stackoverflow.com/comment/39516959
has body: A UUID type is better stored as BINARY(16), and according to Hibernate Types you can use both a binary or a char representation. @Column(columnDefinition = "BINARY(16)") private UUID uuid; For the String representation you would need a CHAR(32) column @Column(columnDefinition = "CHAR(32)") private String uuidHex;

jcomponent
type: Tag
tags question: http://stackoverflow.com/q/25364018
tag name: jcomponent
tags question: http://stackoverflow.com/q/25265723
tags question: http://stackoverflow.com/q/25383059

http://stackoverflow.com/q/25247854
linked to: http://stackoverflow.com/q/14601016
has body: I'm tempted to think that the HashSet.contains(Object) method performs in constant time. It simply gets the hash code of an object and then looks it up in a hash table. First, could someone please confirm whether this is true? Second, if it is true, is there any risk of collisions, where two objects might have the same hash code and thus the HashSet thinks it has both when it only has one?
possible better answer: http://stackoverflow.com/a/51199917
has comment: http://stackoverflow.com/comment/39334918
accepted answer: http://stackoverflow.com/a/25247874
has comment: http://stackoverflow.com/comment/39334938
has answer: http://stackoverflow.com/a/25247874
type: AnsweredQuestion
answer count: 2
tagged with: java
linked to: http://stackoverflow.com/q/4553624
has answer: http://stackoverflow.com/a/51199917
downvote count: 0
tagged with: collections
has title: What is the time complexity performance of HashSet.contains() in Java?
favorite count: 0
score: 75
upvote count: 75
type: Question

http://stackoverflow.com/comment/39570318
type: QuestionComment
has text: Or a logger. This line of code: `JSONObject json = JsonParser.makeHttpRequest( LOGIN_URL, "POST", params);` looks like "LOGIN_URL" might be malformed (no host name, as mentioned above).
comment on: http://stackoverflow.com/q/25374941
score: 1
type: Comment

http://stackoverflow.com/comment/39510230
type: AnswerComment
comment on: http://stackoverflow.com/a/25342139
has text: Your second point ignores the rather big memory overhead of a process compared to threads though, but this gives a reasonable overview still.
type: Comment
score: 0

http://stackoverflow.com/comment/39381234
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25272436
has text: @Betlista: That does not look like a valid function? Since opening double quote has a closing single quote.

arrays
tags question: http://stackoverflow.com/q/25333718
tags question: http://stackoverflow.com/q/25325127
tag name: arrays
tags question: http://stackoverflow.com/q/25274010
tags question: http://stackoverflow.com/q/25248855
tags question: http://stackoverflow.com/q/25237269
tags question: http://stackoverflow.com/q/25272433
tags question: http://stackoverflow.com/q/25245654
tags question: http://stackoverflow.com/q/25270871
tags question: http://stackoverflow.com/q/25375094
type: Tag
tags question: http://stackoverflow.com/q/25364822
tags question: http://stackoverflow.com/q/25284620
tags question: http://stackoverflow.com/q/25336914
tags question: http://stackoverflow.com/q/25281409
tags question: http://stackoverflow.com/q/25352995
tags question: http://stackoverflow.com/q/25254353
tags question: http://stackoverflow.com/q/25285572
tags question: http://stackoverflow.com/q/25354617
tags question: http://stackoverflow.com/q/25290474
tags question: http://stackoverflow.com/q/25241768
tags question: http://stackoverflow.com/q/25316687
tags question: http://stackoverflow.com/q/25356543
tags question: http://stackoverflow.com/q/25370502
tags question: http://stackoverflow.com/q/25296067
tags question: http://stackoverflow.com/q/25332101
tags question: http://stackoverflow.com/q/25276638
tags question: http://stackoverflow.com/q/25382002
tags question: http://stackoverflow.com/q/25265567
tags question: http://stackoverflow.com/q/25274881
tags question: http://stackoverflow.com/q/25370256
tags question: http://stackoverflow.com/q/25257455
tags question: http://stackoverflow.com/q/25288568
tags question: http://stackoverflow.com/q/25372368
tags question: http://stackoverflow.com/q/25370048
tags question: http://stackoverflow.com/q/25363489
tags question: http://stackoverflow.com/q/25253979
tags question: http://stackoverflow.com/q/25341144
tags question: http://stackoverflow.com/q/25327175
tags question: http://stackoverflow.com/q/25284967
tags question: http://stackoverflow.com/q/25369248
tags question: http://stackoverflow.com/q/25364923
tags question: http://stackoverflow.com/q/25236845
tags question: http://stackoverflow.com/q/25287445
tags question: http://stackoverflow.com/q/25379550
tags question: http://stackoverflow.com/q/25378281
tags question: http://stackoverflow.com/q/25378144
tags question: http://stackoverflow.com/q/25348388
tags question: http://stackoverflow.com/q/25278772
tags question: http://stackoverflow.com/q/25367913
tags question: http://stackoverflow.com/q/25273903
tags question: http://stackoverflow.com/q/25231218
tags question: http://stackoverflow.com/q/25252176
tags question: http://stackoverflow.com/q/25278033
tags question: http://stackoverflow.com/q/25385217
tags question: http://stackoverflow.com/q/25380433
tags question: http://stackoverflow.com/q/25304217
tags question: http://stackoverflow.com/q/25321853
tags question: http://stackoverflow.com/q/25259602
tags question: http://stackoverflow.com/q/25273221
tags question: http://stackoverflow.com/q/25330591
tags question: http://stackoverflow.com/q/25319730
tags question: http://stackoverflow.com/q/25300417
tags question: http://stackoverflow.com/q/25251367
tags question: http://stackoverflow.com/q/25293961
tags question: http://stackoverflow.com/q/25360127
tags question: http://stackoverflow.com/q/25236924
tags question: http://stackoverflow.com/q/25236977
tags question: http://stackoverflow.com/q/25310276
tags question: http://stackoverflow.com/q/25252537
tags question: http://stackoverflow.com/q/25234379
tags question: http://stackoverflow.com/q/25387073
tags question: http://stackoverflow.com/q/25251107
tags question: http://stackoverflow.com/q/25328454
tags question: http://stackoverflow.com/q/25352728
tags question: http://stackoverflow.com/q/25285932
tags question: http://stackoverflow.com/q/25256725
tags question: http://stackoverflow.com/q/25258529
tags question: http://stackoverflow.com/q/25290778
tags question: http://stackoverflow.com/q/25332951

http://stackoverflow.com/comment/39414650
comment on: http://stackoverflow.com/q/25290872
type: Comment
has text: @lpq66-That's not conversion of JButton to int but a return of variable which is of pre-defined type---int here!
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39490735
comment on: http://stackoverflow.com/q/25317674
score: 0
type: Comment
type: QuestionComment
has text: Thanks, Daniel. That clears up the question I regret asking. Will be less hasty next time.

http://stackoverflow.com/comment/39446974
comment on: http://stackoverflow.com/a/25308065
score: 0
type: AnswerComment
has text: I just corrected the names. that was a typo mistake. When I compile this program I get the following problems.customer_id cannot be resolved to a variable customer_name cannot be resolved to a variable entity_id cannot be resolved to a variable
type: Comment

runtime-error
tags question: http://stackoverflow.com/q/25389290
type: Tag
tag name: runtime-error

http://stackoverflow.com/a/25383404
downvote count: 1
has comment: http://stackoverflow.com/comment/44342396
has comment: http://stackoverflow.com/comment/39585861
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39585645
has body: Just check if the value is 90° or 270°: double value = Math.toRadians(Double.parseDouble(txtDisplay.getText().toString())); if (value == Math.abs(90) || value == Math.abs(270)) { txtDisplay.setText("undefined"); } else { total = Math.round(Math.tan(value)); txtDisplay.setText(txtDisplay.getText().toString() + total); }
has comment: http://stackoverflow.com/comment/39585741
upvote count: 0
answers question: http://stackoverflow.com/q/25383322

http://stackoverflow.com/comment/39378557
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25271333
has text: as a good rule of thumb it is best to join tables how mysql intended it to be joined... aka don't do the cartesian product... join tables with JOIN filter data with WHERE... that aside there isn't much difference speed wise when doing one or the other. you should look at adding indexes to your tables

http://stackoverflow.com/a/49737385
has comment: http://stackoverflow.com/comment/86489127
has body: You can use Android View Model and Live data to share achieve the desired behaviour. //View model public class SharedViewModel extends ViewModel { private final MutableLiveData&lt;Item&gt; selected = new MutableLiveData&lt;Item&gt;(); public void select(Item item) { selected.setValue(item); } public LiveData&lt;Item&gt; getSelected() { return selected; } } //Fragment public class MasterFragment extends Fragment { private SharedViewModel model; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); model = ViewModelProviders.of(getActivity()).get(SharedViewModel.class); } } Make sure you pass ViewModelProviders.of(getActivity()) instead of ViewModelProviders.of(this) when calling from fragment. For more information: https://developer.android.com/topic/libraries/architecture/viewmodel.html#sharing
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25388716
score: 0

http://stackoverflow.com/comment/39862403
type: Comment
type: QuestionComment
has text: Hi EJP, I found the issue with SearchResultFilterName class which was defineds as varargs datatype and giving issue. I changed to array and now it is working fine.
score: 0
comment on: http://stackoverflow.com/q/25323074

http://stackoverflow.com/comment/39359216
comment on: http://stackoverflow.com/q/25259864
score: 0
has text: @Dónal Yes, the ambiguity of the methods (their names) and of course with different parameters
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25322452
type: Question
has body: Assume there is a Java implementation of Object Pool and the objects are successfully connected TCP Sockets. I keep a "Clean-Up" thread at the Pool level (ConnectionFactory) that checks every N mins that whether the pool is being idle for some M mins (i.e: last access is before M mins, here M>N). And if so then close all the additional sockets until only the core number of sockets is left in the pool. Now I need to trace and eliminate the abruptly closed sockets as well. It seems essential because I may close all the working ones and simply end up with a pool with abruptly closed sockets (closed at the other end). Without a doubt, now I should look into the Socket level rather than the connection factory level. I've done a research on 'tracing abruptly closed sockets in Java', 'cleaning connection pools' and there is nothing in the Java socket API unless we sent some ACK or KeepAliveChecks (per each socket). Which means I need to be performing this on every socket in a routine basis. What is the best way (i.e: is there any other way) so I could end up keeping the good guys (well connected sockets) in my pool? How to clean-up the abruptly closed sockets in my pool?
tagged with: pool
answer count: 2
type: UnansweredQuestion
score: 0
tagged with: objectpool
has title: Eliminate abruptly closed sockets from the pool, Java
tagged with: sockets
has answer: http://stackoverflow.com/a/25323235
tagged with: java
has answer: http://stackoverflow.com/a/25322954
tagged with: object-pooling

http://stackoverflow.com/q/25349993
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25350076
has answer: http://stackoverflow.com/a/25350070
has comment: http://stackoverflow.com/comment/39523333
has answer: http://stackoverflow.com/a/25350042
has title: error in java programming Exception in thread "main" java.lang.NumberFormatException
type: Question
has body: This is the program to show sum of series 1-(a^2/3!)+(a^4/5!)-(a^6/7!)+..... I used recursion show factorial of number import java.io.*; class Series{ public static void main(String args[])throws IOException{ int n,a; double sum=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str; System.out.println("Enter the value of n &amp; a"); str=br.readLine(); n=Integer.parseInt(str); str=br.readLine(); a=Integer.parseInt(str); for(int i=0;i&lt;=n;i++){ sum=sum+(Math.pow(-1,i)*(Math.pow(a,2*i)/fact(2*i+1))); } System.out.println(sum); } static int fact(int n){ int fact=1,i; for(i=1;i&lt;=n;i++){ fact=fact*i; } return(fact); } } output = Exception in thread "main" java.lang.NumberFormatException: For input string: "3 6" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at Series.main(Series.java:12) Please help me out it is showing error in java programming Exception in thread "main" java.lang.NumberFormatException
has comment: http://stackoverflow.com/comment/39523394
tagged with: java
answer count: 4
score: 0
has answer: http://stackoverflow.com/a/25350110

http://stackoverflow.com/comment/39329064
comment on: http://stackoverflow.com/a/25244527
type: Comment
type: AnswerComment
has text: @Jaskey I'm not an expert on these classes, but I would suggest: 1. This escapes Chinese characters but is not equivalent to creating a UTF-8 string. 2. Same thing. 3. Not sure. 4. Looks like this advertises your text is UTF-8, but doesn't actually cause it to *be* UTF-8 encoded.
score: 0

http://stackoverflow.com/comment/39442660
type: Comment
comment on: http://stackoverflow.com/a/25305888
type: AnswerComment
score: 1
has text: Tis! But i follow this guide. And after "Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:" I see that: ` Host: disconnected Target: connected`

http://stackoverflow.com/comment/39395249
type: Comment
type: QuestionComment
score: 0
has text: Whatever, I need to encrypt it correctly then.
comment on: http://stackoverflow.com/q/25280110

http://stackoverflow.com/comment/39353240
comment on: http://stackoverflow.com/a/25257494
type: Comment
type: AnswerComment
score: 0
has text: Hhmmm, @Kaptin talks about a *zone of text*; it is not clear from the question that that *zone* is created by a block of operations to shift like you propose.

http://stackoverflow.com/a/25355739
answers question: http://stackoverflow.com/q/25329965
type: Answer
has body: JPA maintains a version number for every entity object. The initial version of a new entity object (when it is stored in the database for the first time) is 1. In every transaction in which an entity object is modified its version number is automatically increased by one. Version numbers are managed internally but can be exposed by defining a version field. During commit (and flush), JPA checks every database object that has to be updated or deleted, and compares the version number of that object in the database to the version number of the in-memory object being updated. The transaction fails and an OptimisticLockException is thrown if the version numbers do not match, indicating that the object has been modified by another user (using another EntityManager) since it was retrieved by the current updater. This behaviour happen only if the row is changed .. the foreign keys don't matter therefore the version number doesn't increase.
has comment: http://stackoverflow.com/comment/137366272
has comment: http://stackoverflow.com/comment/39546167
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39541423

http://stackoverflow.com/q/25349213
has title: Regex to match ASCII non-alphanumeric characters
answer count: 3
has comment: http://stackoverflow.com/comment/39522699
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/22937618
has body: I need a regex to match ASCII non-alphanumeric characters. The regex should not match non-ASCII characters. I am using the following: "[\\u0000-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007f]" Can I simplify this regex ?
favorite count: 0
has comment: http://stackoverflow.com/comment/39521921
type: Question
has answer: http://stackoverflow.com/a/25349294
has answer: http://stackoverflow.com/a/25349288
has comment: http://stackoverflow.com/comment/39521936
tagged with: regex
accepted answer: http://stackoverflow.com/a/25349286
possible better answer: http://stackoverflow.com/a/25349288
has answer: http://stackoverflow.com/a/25349286
score: 4
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/25364977
type: Answer
has body: In the HTML page, linked to an "OK" button: function ok() { var t1 = document.getElementById("textarea1").value; var t2 = document.getElementById("textarea2").value; var t3 = document.getElementById("textarea3").value; var t4 = document.getElementById("textarea4").value; var result = JSON.parse(bridge.doIt(t1,t2,t3,t4)); } } In the application's webview: class MyBridge { public MyBridge(Context context) { // ... } @JavascriptInterface public String doIt(String t1, String t2, String t3, String t4) { // do whatever you want here with the values } } and in the webview's constructor: this.addJavascriptInterface(new MyBridge(pContext), "bridge"); This should work (using it myself). If you don't want to use an OK button, you'll have to change the code a bit to fit your needs, maybe call a function on the "onKeyPress" of the text fields.
has comment: http://stackoverflow.com/comment/39580709
downvote count: 0
has comment: http://stackoverflow.com/comment/39581824
answers question: http://stackoverflow.com/q/25364756
score: 3
upvote count: 3

http://stackoverflow.com/q/25246858
favorite count: 0
type: Question
tagged with: criteria
type: UnansweredQuestion
has body: I have two entity classes Student.java and Course.java and they have many to many relationship between them I want to add one entry into their @JoinTable through hql like this : insert into student_course(student_id,course_id) values('" + courseId + "','" + studentId + "')". I want to use hql instead of sql. Any ideas?
score: 1
tagged with: java
tagged with: hibernate
has title: Get data from two tables and insert in one table through HQL
answer count: 1
downvote count: 0
tagged with: mysql
upvote count: 1
tagged with: hql
has answer: http://stackoverflow.com/a/25300500

http://stackoverflow.com/q/25339540
has body: I am trying to configure logback and slf4j to my eclipse. However, I am a bit confused about configuration file. I just want log output should be written to both cosole and file, but only debug information should be closed to be written to file. As a result, I have wrote some configuration file but it sucks, not even working. Anyway, how can I achieve this wish? %d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n <appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
accepted answer: http://stackoverflow.com/a/25339612
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/45236402
tagged with: logback
has answer: http://stackoverflow.com/a/45236402
tagged with: slf4j
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25339612
answer count: 2
score: 1
tagged with: java
downvote count: 0
has title: Logback configuration file -- write all except debug to file, as logging to console
upvote count: 1

http://stackoverflow.com/comment/39308241
score: 1
type: Comment
has text: Which issues are you having exactly? Does this code compile?
type: QuestionComment
comment on: http://stackoverflow.com/q/25233709

http://stackoverflow.com/comment/39443277
type: Comment
comment on: http://stackoverflow.com/a/25306277
has text: What if do not know the numbers? or there are dozens of them? I updated the Question.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25337621
has comment: http://stackoverflow.com/comment/39506285
has comment: http://stackoverflow.com/comment/39506647
has comment: http://stackoverflow.com/comment/39506599
has comment: http://stackoverflow.com/comment/39503222
has comment: http://stackoverflow.com/comment/39506297
has body: I have 2 text files: File1 - Format of this file is user_id tweet_id tweet_text File 1 60730027 6298443824 thank you echo park. you've changed A LOT, but as long as I'm getting paid to make you move, I'm still with it! 2009-12-03 02:54:10 60730027 6297282530 fat Albert Einstein goin in right now over here!!! 2009-12-03 01:35:22 File2 The format of this file is genome_id name ascii_name 4045417 Southwest Indent Southwest Indent 4045418 Southeast Point Southeast Point Below is the code snippet to read file 1: public void readfromFile() throws FileNotFoundException { Scanner inputStream; String source=null; FileInputStream file = new FileInputStream("file1.txt"); String regex = "/[a-zA-Z ]+/"; Scanner fileScan = new Scanner(file); while(fileScan.hasNextLine()){ word = fileScan.nextLine(); word = word.replaceAll(regex, "").toLowerCase(); PrintWriter outputStreamName = new PrintWriter(new FileOutputStream("temp.txt")); outputStreamName.printf("%s",word); } My intention here is firstly to replace data present in user_id,tweet_id,genome_id with null value. Then convert the uppercase values to lowercase. However, right now whenever this code processes file1, nothing changes to text file. I am also wondering what is happening. When I output this to the console, I get the output. Expected output: thank you echo park youve changed a lot but as long as im getting paid to make you move im still with it fat albert einstein goin in right now over here
type: Question
has comment: http://stackoverflow.com/comment/39506710
tagged with: java
answer count: 3
has title: Remove all the numeric and alphanumeric characters from text file using
tagged with: replaceall
tagged with: regex
possible better answer: http://stackoverflow.com/a/25337776
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25337776
has comment: http://stackoverflow.com/comment/39506735
has comment: http://stackoverflow.com/comment/39506295
accepted answer: http://stackoverflow.com/a/25338095
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25338095
has answer: http://stackoverflow.com/a/25337782
downvote count: 0
has comment: http://stackoverflow.com/comment/39725761
has comment: http://stackoverflow.com/comment/39502822
upvote count: 1
tagged with: string

http://stackoverflow.com/comment/39426219
has text: This would be extremely slow. The dataset has strings of length 10^5.
comment on: http://stackoverflow.com/a/25296725
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25382002
tagged with: arrays
has answer: http://stackoverflow.com/a/25382880
has comment: http://stackoverflow.com/comment/39583117
has comment: http://stackoverflow.com/comment/39583971
score: 0
has comment: http://stackoverflow.com/comment/39583308
has body: I want to create a random tiled map for my game, this is what I have so far: switch(MathUtils.random(2)){ case 0: tileX+=16; loadedTiles ++; //game.batch.draw(tile1, tileX, tileY); System.out.print("tile1"); currentTile = tile1; break; case 1: tileX+=16; loadedTiles ++; //game.batch.draw(tile2, tileX, tileY); System.out.print("tile2"); currentTile = tile2; break; case 2: tileX+=16; loadedTiles ++; //game.batch.draw(tile3, tileX, tileY); System.out.print("tile3"); currentTile = tile3; break; } game.batch.begin(); game.batch.draw(currentTile, tileX, tileY); game.batch.end(); } Instead of rendering them each individually i would like to add them to an array and render them all together, so if i have an array such as this: ArrayList&lt;Texture&gt; tiles; Then add something to all of he case options like: tiles.add(tile1); Problem: How do i render the array and get the relevent co-ordinates for them to be rendered, does this get added to the array?
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/25382334
has comment: http://stackoverflow.com/comment/39583079
has comment: http://stackoverflow.com/comment/39583434
has comment: http://stackoverflow.com/comment/39583202
type: Question
has comment: http://stackoverflow.com/comment/39583018
answer count: 2
has title: Rendering 2D array Libgdx Java
linked to: http://stackoverflow.com/q/25305191
type: UnansweredQuestion

http://stackoverflow.com/a/47497254
score: -1
has body: The reason behind this is that Gmail detects a less secure authentication method, so they give authentication error. They do this for your security. You can use a more secure authentication, like OAuth 2.0. There is also a way to allow less secure authentication. It can be enabled under security settings for your Gmail account.
has comment: http://stackoverflow.com/comment/81952026
has comment: http://stackoverflow.com/comment/82007137
downvote count: 1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25362622

http://stackoverflow.com/comment/39462836
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25316793
score: 0
has text: Thanks for the extra detailed info! This sure helps!

http://stackoverflow.com/comment/39536632
has text: @CameronBriggs No worries ;)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25356844

http://stackoverflow.com/q/25257801
type: Question
has comment: http://stackoverflow.com/comment/39399759
tagged with: jakarta-ee
has body: I'm trying to create the stub using the WSDL. but the Web services are using the SSL, so i used C:\Program Files\Java\jdk1.7.0_17\jre\lib\security&gt;keytool -import -file my_home .crt to import the necessary certificates to the key store. but when i try to execute the C:\Program Files\Java\jdk1.7.0_17\bin&gt;wsimport -keep -s c:\SEI\ https://16.175.217.24:8443/cfcc/control?view=services/AdministratorService?WSDL parsing WSDL... I'm getting below errors. ` parsing WSDL... [ERROR] java.security.cert.CertificateException: No subject alternative names pr esent Failed to read the WSDL document: https://16.175.217.24:8443/cfcc/control?view=s ervices/AdministratorService?WSDL, because 1) could not find the document; /2) t he document could not be read; 3) the root element of the document is not &lt;wsdl: definitions&gt;. [ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): At least one WSDL with at least one service definition needs to be provided. Failed to parse the WSDL. . ` Please help me with to find the root cause of the error? Thanks in advance. sushma.
has title: Unable to create the stub using the wsimport?
has comment: http://stackoverflow.com/comment/39362516
linked to: http://stackoverflow.com/q/14456789
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: wsdl
tagged with: web-services

http://stackoverflow.com/q/25362772
has comment: http://stackoverflow.com/comment/39548915
possible better answer: http://stackoverflow.com/a/25362996
tagged with: jsoup
has answer: http://stackoverflow.com/a/25362996
has body: Using Jsoup: Element movie_div = doc.select("div.movie").first(); I got a such HTML-code: Year: 2014 Country: USA How can I use jsoup to extract the country and the year? For the example html I want the extracted values to be "2014" and "USA". Thanks.
upvote count: 1
linked to: http://stackoverflow.com/q/6520192
has title: How to parse 'div' without name?
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25363209
tagged with: java
has answer: http://stackoverflow.com/a/25363209
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39546783

http://stackoverflow.com/q/25369136
possible better answer: http://stackoverflow.com/a/25369392
has title: Populating Spinner with Enum that has string resource
has answer: http://stackoverflow.com/a/25369392
favorite count: 0
type: Question
answer count: 2
score: 5
accepted answer: http://stackoverflow.com/a/25369362
tagged with: android
upvote count: 5
has answer: http://stackoverflow.com/a/25369362
tagged with: android-spinner
has body: I have an enum that has a property that maps to a string resource id, like so: public enum MyEnum{ FIRST(1,R.string.first_enum_desc), SECOND(2,R.string.second_enum_desc); private int mId; private int mDescriptionResourceId; private MyEnum(id,descriptionResourceId) { mId = id; mDescriptionResourceId = descriptionResourceId; } public toString(context){ return context.getString(mDescriptionResourceId); } } I want to populate a spinner with the enum, the problem is simply using an adapter of my type: Spinner spinner; spinner.setAdapter(new ArrayAdapter&lt;MyEnum&gt;(this, android.R.layout.simple_spinner_item, MyEnum.values())); I don't get the string resource description as the adapter implicitly calls toString(), which returns the enum name. I'm not sure how to proceed here. No matter what I need the Context to get the string values. Could someone suggest the best way to achieve what I am looking for? I just need a point in the right direction. Any advice would be appreciated. Thanks much!
type: AnsweredQuestion
tagged with: enums
tagged with: android-arrayadapter
tagged with: java
downvote count: 0

http://stackoverflow.com/a/25279392
type: Answer
answers question: http://stackoverflow.com/q/25279275
has body: I'm currently using the same lib and never had to deal with such big files (10MB). As far as I know the only limits here are with > 65K rows and > 1 million columns for XLSX. Also be careful when you use Writer, because this operation is relatively slow. The OutOfMemoryError can be caused not only from the usage of the POI lib. Update: I'm currently working with newer XLSX format (I don't know if that matters) and use it like this: ` FileOutputStream fileOutputStream = new FileOutputStream(file)) { workbook.write(fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); } ` I also use: File file = new File(relativePath); Please note that there is .flush() before .close()
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25279275

layout-manager
tags question: http://stackoverflow.com/q/25258318
tags question: http://stackoverflow.com/q/25337074
tags question: http://stackoverflow.com/q/25247220
tags question: http://stackoverflow.com/q/25337235
tags question: http://stackoverflow.com/q/25269848
tags question: http://stackoverflow.com/q/25283168
tags question: http://stackoverflow.com/q/25331767
tags question: http://stackoverflow.com/q/25331226
tags question: http://stackoverflow.com/q/25304941
tags question: http://stackoverflow.com/q/25346896
type: Tag
tags question: http://stackoverflow.com/q/25302859
tags question: http://stackoverflow.com/q/25344178
tags question: http://stackoverflow.com/q/25346547
tags question: http://stackoverflow.com/q/25306555
tag name: layout-manager
tags question: http://stackoverflow.com/q/25319859
tags question: http://stackoverflow.com/q/25364758

http://stackoverflow.com/q/25364095
score: 0
has comment: http://stackoverflow.com/comment/39549618
has body: Is there a way to modify the field of POJO with new property(like using MixIns or @JSONProperty) and get the modified POJO back ? (A way to add/modify field of a POJO dynamically ?) Like I have a class class PojoA&lt;T&gt;{ private T data;//field to be modified as NewData } So, I tried with MixIns like public interface PojoMixIn&lt;T&gt; { @JsonProperty("NewData") T getData(); } Now to get the modified field, I use ObjectMapper mapper.addMixInAnnotations(PojoA.class,PojoMixIn.class); mapper.writerWithDefaultPrettyPrinter().writeValueAsString(pojoA); The actual result is a String, but can I be able to get the modified POJO?
answer count: 0
tagged with: pojo
has comment: http://stackoverflow.com/comment/39549166
has comment: http://stackoverflow.com/comment/39550313
has title: Is there a way to modify a POJO field and return the POJO
type: Question
has comment: http://stackoverflow.com/comment/39549451
tagged with: java
has comment: http://stackoverflow.com/comment/39549574
has comment: http://stackoverflow.com/comment/39549207
type: UnansweredQuestion
tagged with: fasterxml
has comment: http://stackoverflow.com/comment/39549448
has comment: http://stackoverflow.com/comment/39549990
has comment: http://stackoverflow.com/comment/39549748

http://stackoverflow.com/a/25392006
score: 2
has comment: http://stackoverflow.com/comment/39637614
accepted answer of: http://stackoverflow.com/q/25389031
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39636950
has comment: http://stackoverflow.com/comment/39638265
answers question: http://stackoverflow.com/q/25389031
has comment: http://stackoverflow.com/comment/39656872
type: Answer
has body: It looks like you are missing the @JoinColumn annotation through which you tell who is the owner of the relationship. For this reason i think you should change the class order like this: @Entity @Table(name="TB_ORDER") public class Order { @Id @GeneratedValue private Integer id; private String orderNumber; @ManyToOne @JoinColumn(name = "customer_id") private Customer customer; } And should work fine.
has comment: http://stackoverflow.com/comment/39640456

http://stackoverflow.com/q/25386295
accepted answer: http://stackoverflow.com/a/25387621
has answer: http://stackoverflow.com/a/25387621
score: 2
type: AnsweredQuestion
has title: Wrapping Selenium wait.until function in Java, function as parameter
linked to: http://stackoverflow.com/q/4685563
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25387725
tagged with: selenium
has body: I'm pretty new in Java and have a question: is there any clean way to wrap code below in one function, which would get any expression (pointed by arrow) as a parameter? Foo A, B; ... try { wait.until(new Function&lt;WebDriver, Boolean&gt;() { public Boolean apply(WebDriver driver) { return A.equals(B); // &lt;=================== some expression } } catch (Exception ex) { return false; } return true;
favorite count: 0
possible better answer: http://stackoverflow.com/a/25387553
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25387553

http://stackoverflow.com/a/25389749
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39598159
upvote count: 4
has comment: http://stackoverflow.com/comment/39600317
has comment: http://stackoverflow.com/comment/39600238
accepted answer of: http://stackoverflow.com/q/25389705
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25389705
has comment: http://stackoverflow.com/comment/39710216
has body: Check out the API: http://docs.oracle.com/javase/6/docs/api/java/awt/Rectangle.html There is an intersects method: public boolean intersects(Rectangle r); For example: if (player.intersects(object)) { // player and object are overlapping, do something here... }

http://stackoverflow.com/a/25356305
accepted answer of: http://stackoverflow.com/q/25307089
type: AcceptedAnswer
type: Answer
has body: I tried this tag by replacing the START &amp; END with required tokens and it worked. &lt;replaceregexp byline="false" flags="gs" match ="//START(.*?)//END" replace =" " /&gt;
score: 0
answers question: http://stackoverflow.com/q/25307089

http://stackoverflow.com/a/25267862
score: 1
upvote count: 1
has body: You not showing enough of your configuration. I'm concerned about the fact that the URL doesn't have anything after the "http://shoponline.com/" It may be because your index.html (or index.jsp) page is doing a "forward" to your servlet and the request parameter is not included. In short, there is no reason the code won't work, so you need to look at how your web-application is configured.
type: Answer
answers question: http://stackoverflow.com/q/25266920
downvote count: 0

http://stackoverflow.com/q/25234213
has answer: http://stackoverflow.com/a/25234395
type: Question
tagged with: google-cloud-endpoints
has comment: http://stackoverflow.com/comment/39309637
tagged with: google-cloud-datastore
tagged with: google-app-engine
answer count: 1
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25234395
has body: I'm developing an enrollment application. The client side is an Android application enabling the client to enter their information which are stored using the data storage service of the Google cloud and the images are entered are stored using the blob storage service. The server side is J2EE application extracting the data and blobs entered previously and doing some tests such as face recognition, alphanumeric matching etc. These tests are done asynchronously. The problem is that these 2 processes are independent. How can I deploy these two projects (client and server) to the same Google project, because the applications should use the same data?
tagged with: android
tagged with: java
has title: How can i deploy two separate projects (client and server side) to the same Google App Engine project?

http://stackoverflow.com/q/25362771
score: 3
has title: similar load and get hibernate method on spring data
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39549531
has comment: http://stackoverflow.com/comment/39552335
favorite count: 0
has comment: http://stackoverflow.com/comment/70013592
type: Question
has answer: http://stackoverflow.com/a/53593950
has body: I´m reading about Hibernate and using Spring data. In one chapter I´ve read about the different of use get() and load(), supposedly in Hibernate load return a proxy placeHolder and only access to database in case that you access to the entity attribute. In my application many times I just need to return and entity to add as dependency to another entity and for that specific case add a proxy would be more than enough, but using Spring data repository I cannot find the get() or load() method, so I guess they dont implement the same feature as in Hibernate. Any idea if Spring data has that Hibernate´s features to have a proxy placeHolder?. Regards.
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
tagged with: spring
upvote count: 3

http://stackoverflow.com/q/25329269
type: Question
tagged with: java
type: UnansweredQuestion
has title: EditPart with visible figure not in EditPartRegistry - why?
score: 0
has body: In one of the EditParts in my GEF editor - specifically in my override of refreshVisuals() - I'm trying to loop through all EditParts. I'm doing this with for (Object part : getViewer().getEditPartRegistry().values()) { ... } For most cases this works fine. However, I've found a few EditParts with visible figures in the editor which aren't present in the EditPartRegistry. How can this be? An EditPart with a visible figure (I can interact with via it's EditPart!) should surely be present in the EditPartRegistry?
has answer: http://stackoverflow.com/a/25346536
answer count: 1
tagged with: eclipse-gef

http://stackoverflow.com/comment/39591552
score: 1
type: Comment
type: QuestionComment
has text: You can try this: http://stackoverflow.com/questions/10332868/open-the-native-browser-from-an-android-app if you want to open the browser. Alternatively, you can use WebView to display the webpage from inside of your app.
comment on: http://stackoverflow.com/q/25386325

http://stackoverflow.com/q/25334751
answer count: 2
has comment: http://stackoverflow.com/comment/39497374
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25334785
type: Question
has title: JsonParseException, incorrect character not in JSON
accepted answer: http://stackoverflow.com/a/25334785
tagged with: jackson
has body: I am trying to process a JSON of the following format in Java. String flowJSON = "{\"FlowDTO\":[{\"policyName\":\"Firewall\",\"action\":\"DROP\",\"sourceIp\":\"ANY\",\"destinationIp\":\"ANY\",\"datapathId\":\"8506829779379520\",\"sourcePort\":\"ANY\",\"destinationPort\":\"78\",\"protocol\":\"TCP\",\"priority\":\"0\",\"rateLimiter\":\10000\"}]}"; JsonNode root = mapper.readTree(flowJSON); For the above code, I am getting the below error. However, I don't understand why the incorrect character is '@' when I do not have that character in my JSON. Am I not reading this error correctly? [2014-08-15 14:44:37.095] ERROR POLLtimer System.err com.fasterxml.jackson.core.JsonParseException: Unexpected character ('@' (code 64)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') [2014-08-15 14:44:37.095] ERROR POLLtimer System.err at [Source: java.io.StringReader@4e511927; line: 1, column: 214] [2014-08-15 14:44:37.096] ERROR POLLtimer System.err at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1378) [2014-08-15 14:44:37.096] ERROR POLLtimer System.err at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:599) [2014-08-15 14:44:37.096] ERROR POLLtimer System.err at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:520) [2014-08-15 14:44:37.097] ERROR POLLtimer System.err at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleUnexpectedValue(ReaderBasedJsonParser.java:1387) [2014-08-15 14:44:37.097] ERROR POLLtimer System.err at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:678) [2014-08-15 14:44:37.097] ERROR POLLtimer System.err at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:194) [2014-08-15 14:44:37.098] ERROR POLLtimer System.err at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeArray(JsonNodeDeserializ…
has answer: http://stackoverflow.com/a/25334779
possible better answer: http://stackoverflow.com/a/25334779
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39491126
type: Comment
comment on: http://stackoverflow.com/q/25330591
score: 0
type: QuestionComment
has text: If it's Java, you've got a visibility problem there

http://stackoverflow.com/comment/39653094
type: Comment
type: AnswerComment
has text: I have tried this also and getting **datasource object null** error
score: 0
comment on: http://stackoverflow.com/a/25391810

http://stackoverflow.com/comment/39343000
comment on: http://stackoverflow.com/q/25251529
type: Comment
score: 0
type: QuestionComment
has text: In addition to what @codenheim says, the above code looks suspiciously like there's a try/catch block somewhere nearby, and that can affect the branching of the code greatly.

http://stackoverflow.com/a/25282115
type: Answer
has body: Well if you do not use an ORM ... you have no object relation mapping ! After all the ORMs were created for that reason :-) More seriously, ORM saves you from writing a lot of boilerplate code. Using direct JDBC instead of JPA is a code optimisation. Like any other code optimisation, it should be used when appropriate. It is relevant for : libraries using few tables that do not want to rely on an ORM (ex: user, roles, and ACL in spring security) identified bottlenecks in larger application My advice should be to first use JPA or native hibernate hidden in a DAO layer. Then carefully analyze your performance problems and rewrite the most expensive parts in JDBC. Of course, you can directly code you DAO implementations in JDBC, but it will be much longer to write. I almost forgot the essential part : in an ORM you map classes and relations, in JDBC you write independant SQL queries.
accepted answer of: http://stackoverflow.com/q/25280815
score: 7
type: AcceptedAnswer
downvote count: 0
upvote count: 7
answers question: http://stackoverflow.com/q/25280815

http://stackoverflow.com/comment/39357699
comment on: http://stackoverflow.com/q/25259864
has text: @Dónal Yes but if you've got methods that start with `addTo` it can interfere with this process. I think that was what Meirav was getting at.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/25339256
accepted answer of: http://stackoverflow.com/q/25338988
type: Answer
answers question: http://stackoverflow.com/q/25338988
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
has body: You need to flush the stream, and also, it maybe expects a CR at the end of the password to simulate the ENTER key the user types at the end of the password. This works for me in Linux: Runtime r = Runtime.getRuntime(); Process p = r.exec("myTestingExe"); p.getOutputStream().write("myPassword\n".getBytes()); // notice the `\n` p.getOutputStream().flush(); Some caveats: This works in Linux with '\n' at the end, maybe in Windows you would need \r instead (honestly I'm not sure of how Windows handles the "ENTER" key in the input) I'm using "myPassword\n".getBytes() but a more complete value would be new String("myPassword".getBytes(), Charset.forName("MyCharsetName")); (where "MyCharsetName" is a supported encoding) if you are using an encoding like "UTF-8".

http://stackoverflow.com/comment/39412763
type: AnswerComment
has text: Thanks, for your response but you are not really answering my particular question.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25289856

http://stackoverflow.com/comment/115306421
has text: i have my table names defined as global variable example Seelct * from ${table_1} where x =1. This variable has been populated in paramterMap but not available ib subSelect
type: AnswerComment
comment on: http://stackoverflow.com/a/25324271
score: 0
type: Comment

http://stackoverflow.com/a/25335013
type: Answer
score: 0
has body: You are returning an object of DatabaseDictionary in your getWord method. If you want a string, which string do you want? In this line: DatabaseDictionary word = newDatabaseDictionary(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2), cursor.getString(3)); you are accessing the Cursor data. Maybe you want something like this: String word = cursor.getString(1); cursor.close(); return word; You don't specify which part of the data you want, so maybe you need another variable in your method call, but something like that should work for you.
answers question: http://stackoverflow.com/q/25334857

http://stackoverflow.com/a/25312401
score: 0
accepted answer of: http://stackoverflow.com/q/25312172
type: AcceptedAnswer
has body: I have never used AIDE myself, but I assume you are still able to edit the xml and java code? Write your function in java (suppose it is called doSomething), then call it when the button is clicked on. You can accomplish this two different ways. 1) Hook it up via xml &lt;Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_text" android:onClick="doSomething"/&gt; 2) Hook it up via java Button button = (Button) rootView.findViewById(R.id.my_button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doSomething(); } });
answers question: http://stackoverflow.com/q/25312172
type: Answer

http://stackoverflow.com/q/25267369
has answer: http://stackoverflow.com/a/25288284
type: UnansweredQuestion
tagged with: oracle-database
tagged with: java
tagged with: servlets
score: 0
answer count: 2
has body: I have moved my project into my webapps directory under the tomcat 6.0 directory and am running this under the updated url using port 8080. Has anyone ever seen this error? **java.lang.UnsatisfiedLinkError: Native Library D:\oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll already loaded in another classloader** java.lang.ClassLoader.loadLibrary0(Unknown Source) java.lang.ClassLoader.loadLibrary(Unknown Source) java.lang.Runtime.loadLibrary0(Unknown Source) java.lang.System.loadLibrary(Unknown Source) oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3147) java.security.AccessController.doPrivileged(Native Method) oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3143) oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221) oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:441) oracle.jdbc.driver.T2CConnection.&lt;init&gt;(T2CConnection.java:132) oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78) oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) java.sql.DriverManager.getConnection(Unknown Source) java.sql.DriverManager.getConnection(Unknown Source) I am curious to find out what the first line of this stack trace is. What does this mean? Please let me know if more information is required from my program. Thank you in advance. Sonny
tagged with: jsp
tagged with: tomcat
has answer: http://stackoverflow.com/a/25268132
type: Question
has comment: http://stackoverflow.com/comment/39372761
has title: error with JSP/ Servlets progam when executing on port 8080:

http://stackoverflow.com/a/25251650
answers question: http://stackoverflow.com/q/25251460
has body: System.out.println(gip.toPlainString());
type: Answer
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39342271

http://stackoverflow.com/a/25381377
has body: String class represents character strings. Strings are constant; their values cannot be changed after they are created. List is an interface, which provides implementation to have elements in indexed based list. Elements can be accessed using integer index. String and List are both objects but are of different types. So there is no possibility to cast String to List. References: String List
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25380811

http://stackoverflow.com/comment/39478493
has text: ok i commented off the dataBase code but the delete button becomes just an accessory with no form of function at all.. What should i do about that? i want to just delete from jtable.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25325273

file-type
tag name: file-type
tags question: http://stackoverflow.com/q/25298691
type: Tag

http://stackoverflow.com/q/25299232
has comment: http://stackoverflow.com/comment/39430424
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39430426
downvote count: 1
answer count: 1
has title: Java inheritance and super method
has body: I have an object of StatCalc which uses getMethods to display in a driver class under main methods. However instead of modyfing StatCalc which has sourcecode. getAvg, getSum, getCount etc... I have another class which purely getmin() and getmax() public class StatCalcWithMinMax extends StatCalc { private double max = Double.NEGATIVE_INFINITY; // Largest item seen. private double min = Double.POSITIVE_INFINITY; // Smallest item seen. public void enter(double num) { // Add the number to the dataset. super.enter(num); // Call the enter method from the StatCalc class. if (num &gt; max) // Then do the extra processing for min and max. max = num; if (num &lt; min) min = num; } public double getMin() { // Return the smallest item that has been entered. // Value will be infinity if no items have been entered. return min; } public double getMax() { // Return the largest item that has been entered. // Value will be -infinity if no items have been entered. return max; } } so the main is this however i can't access getMix and getmax from class above. public class driver { public static void main(String[] args) { StatCalc calc; // Object to be used to process the data. calc = new StatCalc(); boolean isZero = false; while (isZero != true) { Scanner inputer = new Scanner(System.in); int numEntered = inputer.nextInt(); if (numEntered == 0) { //isZero = true; break; } calc.enter(numEntered); } System.out.println("The numbers entered were: "+ calc.getCount()); System.out.println("The mean of the numbers entered:" + calc.getMean()); System.out.println("The Standard deviation of the numbers entered: "+ calc.getStandardDeviation()); // System.out.println("The minimum number encountered was: "+ calc.getMin()); // System.out.println("The maximum number encountered was: "+ calc.getMax()); } }
has answer: http://stackoverflow.com/a/25299245
accepted answer: http://stackoverflow.com/a/25299245
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39430433
tagged with: java
score: -1

http://stackoverflow.com/q/25323987
possible better answer: http://stackoverflow.com/a/25328695
has answer: http://stackoverflow.com/a/25328695
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: google-cloud-datastore
linked to: http://stackoverflow.com/q/9402474
has body: Is it possible to do an entity count in objectify in async mode (without blocking) ? I can see a .count method which returns an int but that is a blocking call. Regards, Sathya
tagged with: java
answer count: 2
downvote count: 0
favorite count: 0
tagged with: objectify
accepted answer: http://stackoverflow.com/a/25331170
type: Question
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25331170
has title: Objectify count async

http://stackoverflow.com/q/25232818
has title: How do I make sure username is not repeated in my database?
has body: I`m trying to make sure that the username value stored in my database is not repeating, and if it is repeated, a toast will inform the user that the username is already taken, how can I do so? My DBAdapter: package com.nyp.reddot5; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; public class LoginDataBaseAdapter { static final String DATABASE_NAME = "login.db"; static final int DATABASE_VERSION = 1; // PartyItems table name private static final String TABLE_NAME = "login"; // PartyItems Table Columns names private static final String ID = "id"; private static final String USERNAME = "username"; private static final String PASSWORD = "password"; private static final String EMAIL = "email"; // Variable to hold the database instance public SQLiteDatabase db; // Context of the application using the database. private final Context context; // Database open/upgrade helper private DataBaseHelper dbHelper; public LoginDataBaseAdapter(Context _context) { context = _context; dbHelper = new DataBaseHelper(context, DATABASE_NAME, null, DATABASE_VERSION); } public LoginDataBaseAdapter open() throws SQLException { db = dbHelper.getWritableDatabase(); return this; } public void close() { db.close(); } public SQLiteDatabase getDatabaseInstance() { return db; } public void insertEntry(String userName,String password, String email) { ContentValues newValues = new ContentValues(); // Assign values for each row. newValues.put("USERNAME", userName); newValues.put("PASSWORD",password); newValues.put("EMAIL", email); // Insert the row into your table db.insert("LOGIN", null, newValues); ///Toast.makeText(context, "Reminder Is Successfully Saved", Toast.LENGTH_LONG).show(); } public int deleteEntry(String UserName) { //String id=String.valueOf(ID); String where="USERNAME=?"; int numberOFEntriesDeleted= db.delete("LOGIN", where, new String[]{UserName}) ;…
upvote count: 0
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/25232894
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25233462
tagged with: android
tagged with: java
tagged with: sqlite
downvote count: 3
answer count: 2

http://stackoverflow.com/comment/39575721
comment on: http://stackoverflow.com/q/25377939
type: Comment
has text: Use preparedStatements. don't use string concatenation with SQL queries.
score: 2
type: QuestionComment

http://stackoverflow.com/a/25319257
answers question: http://stackoverflow.com/q/25319104
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39468218
upvote count: 1
has comment: http://stackoverflow.com/comment/39467939
has comment: http://stackoverflow.com/comment/39468038
has body: I would try doing entryTA.setText(""); for clearing the TextArea and then use entryTA.setText = (entryTA.getText()).substring(0, entryTA.getText().length()-1) For removing the last char in the TextArea. That is just code off the top of my head but it should work just fine.
type: Answer
has comment: http://stackoverflow.com/comment/39467579

http://stackoverflow.com/a/25401423
has body: There is absolutely no link between the binding and your database. Do not follow @blackbishop's advice telling you to change all the fields of your model to String. That's a very bad idea, if there are different types, there is a reason... Moreover, Ebean (supposing you're using it) or JPA generate database column types according to your Java properties type. Why would you store a 0 or a 1 in a varchar column ? Follow these rules : Use a singular name for your models (User instead of Users) Always use camel case for your properties, no underscores (firstName instead of first_name, lastName instead of last_name...) Check errors before getting the value after binding That should give you this : public static Result createUser() { Form&lt;User&gt; form = Form.form(User.class).bindFromRequest(); if (form.hasErrors()) { // Do what you have to do (i.e. : redirect to the form with a flash message) } User u = form.get(); u.save(); return redirect(routes.Backend.allUsers()); } By the way, in your testing lines, the user_id is correctly generated because you have no validation rules and this data comes from the database, not the form.
has comment: http://stackoverflow.com/comment/39623668
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39622372
has comment: http://stackoverflow.com/comment/39629893
has comment: http://stackoverflow.com/comment/39621418
score: 1
answers question: http://stackoverflow.com/q/25365707
has comment: http://stackoverflow.com/comment/39633242

http://stackoverflow.com/q/25311472
has answer: http://stackoverflow.com/a/25367452
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
upvote count: 1
tagged with: jax-rs
has title: Jersey: JSON and StringMessageProvider clash, application/json methods generate invalid JSON
favorite count: 0
possible better answer: http://stackoverflow.com/a/25312264
type: Question
accepted answer: http://stackoverflow.com/a/25367452
has body: I have a jax-rs web services on jetty+jersey and tried different JSON message providers (e.g. Jackson and Gson). With all of them POJO &lt;-> JSON works just fine but methods like this: @GET @Path("test") @Produces(MediaType.APPLICATION_JSON) public String test() { return "This string should be \"quoted\" by message writer"; } produce string This string should be "quoted" by message writer which is of course not a valid JSON and causes browser's ajax calls to fail. I expect it to be "This string should be \"quoted\" by message writer" The reason for such magic is StringMessageProvider (one of the internal jersey providers for basic types) which have / Produce/Consume annotation. And I don't want to hack into jersey internal providers. I want to force jersey to use JSON provider in first place? Any ideas?
has answer: http://stackoverflow.com/a/25312264
tagged with: rest
tagged with: jersey
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/a/25268241
accepted answer of: http://stackoverflow.com/q/25268174
upvote count: 4
answers question: http://stackoverflow.com/q/25268174
type: AcceptedAnswer
type: Answer
score: 4
downvote count: 0
has body: To properly return something it must be declared outside try{} scope , and initialized in it (If that requires you to include try{} ) . For example :- public class MyClass { public static byte[] someMethod() { byte[] someByte =null; try { ... someByte = .... ; } catch (Exception e) { e.printStackTrace(); } return someByte; } }

http://stackoverflow.com/comment/39411984
has text: But the problem is I couldn't even install it. it doesn't show.
comment on: http://stackoverflow.com/a/25289528
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39570552
has text: diff between methods and statements?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25374648

http://stackoverflow.com/comment/39425570
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25296038
has text: Read what I typed again.
type: Comment

http://stackoverflow.com/comment/39312975
type: QuestionComment
has text: You can't have `Move` create a `Collision` and `Collision` create a `Move`. You will get a loop ending in out of memory.
score: 4
comment on: http://stackoverflow.com/q/25236044
type: Comment

http://stackoverflow.com/comment/39384224
type: QuestionComment
comment on: http://stackoverflow.com/q/25273818
score: 0
has text: @James_D Edited question with more relevant code. In response to: 1.) What thread _should_ I do it in? 2.) You are correct, and I don't think so. Would this be the root variable declared in the main class? 3.) Positive.
type: Comment

http://stackoverflow.com/comment/39589552
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25381464
has text: yeah this link was useful:http://stackoverflow.com/questions/22351685/error-in-wordcount-example-in-hadoop2-2-0
type: Comment

http://stackoverflow.com/comment/39398868
type: Comment
comment on: http://stackoverflow.com/a/25282267
score: 0
type: AnswerComment
has text: You can use a Spring @PostConstruct listener which has the SessionFactory injected. When the init is running you can open a Session and load your entities.

http://stackoverflow.com/comment/39308893
comment on: http://stackoverflow.com/q/25233881
has text: As an aside, you will want to learn and use [Java naming conventions](http://en.wikipedia.org/wiki/Naming_convention_(programming)#Java). Variable names should all begin with a lower letter while class names with an upper case letter. Following these suggestions as well as following good code formatting practices will allow others (such as us!) to better understand your code, and more importantly, will allow your future self to better understand just what you were thinking 6 months ago when you wrote the code.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25258263
tagged with: spring
has answer: http://stackoverflow.com/a/25259526
tagged with: spring-mvc
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: Spring MVC 3.2 +Jackson
type: UnansweredQuestion
has body: My requirement is simple i.e i want to write a common methods which suppose to have auto intelligence based on user request it will generate response, like if i submit as a html it should produce html . if i submit as a Json it should produce Json. Below is 2 sample code ,If i write 2 separate method it works fine but i want to write it to one common method. 1)below is sample code which works for html @Controller public class Program1Controller { @RequestMapping("/helloworld") public @ResponseBody ModelAndView helloWord(){ String message = "Welcome to TEST"; return new ModelAndView("Test1", "message",message); } } 2)below is sample code which work for json @RequestMapping(value = DUMMY_EMP, method = RequestMethod.GET) public @ResponseBody String getDummyEmployee() { String message = "Welcome to TEST"; return message; } Instead writing 2 separate method i want to write one method which should have auto intelligence to send a response based on user request. Above Query for GET ,Same also how can i do for POST.
answer count: 1

http://stackoverflow.com/q/25274789
answer count: 1
has answer: http://stackoverflow.com/a/25275256
tagged with: key
has body: Let's say I have: private HashMap&lt;String, IDevice&gt; virtualMachineDevices; public VirtualMachine(String virtualMachineId, String virtualMachineName, long virtualMachineMemory, int virtualMachineCPUs) { setVirtualMachineId(virtualMachineId); setVirtualMachineName(virtualMachineName); this.virtualMachineMemory = virtualMachineMemory; setVirtualMachineNumberOfCPU(virtualMachineCPUs); this.virtualMachineDevices = new HashMap&lt;String, IDevice&gt;(); } public void addDevice(IDevice newDevice) throws DuplicateDeviceIdException { if (virtualMachineDevices.containsKey(newDevice.getDeviceId())) { throw new DuplicateDeviceIdException(); } else { virtualMachineDevices.put(newDevice.getDeviceId(), newDevice); } } After I insert one [key,object] pair, I can't insert more because DuplicateDeviceIdException is thrown. Does anybody know why?
has title: After inserting one element in HashMap<String,Object>() i can't insert anything more - always duplicate key
type: Question
score: 0
tagged with: hashmap
tagged with: java
tagged with: duplicates
tagged with: insert
type: UnansweredQuestion

http://stackoverflow.com/comment/39524032
score: 0
type: AnswerComment
has text: String hql = "SELECT colA, SUM(colB) FROM (SELECT date_trunc(:aggregateBy,UA.date) colA,SUM(UA.points) colB FROM UserActivity UA"; hql += " WHERE UA.date > :fromDate AND UA.date < :toDate"; hql += " GROUP BY UA.date"; hql += " ORDER BY date_trunc(:aggregateBy,UA.date))sub GROUP BY colA"; Query query = session.createQuery(hql);
comment on: http://stackoverflow.com/a/25343702
type: Comment

http://stackoverflow.com/comment/39347584
comment on: http://stackoverflow.com/q/25251779
type: Comment
type: QuestionComment
score: 2
has text: The session needs to be created first because that's where the Principal is put. You could make a case that request.login() should do that for you, but evidently it doesn't.

http://stackoverflow.com/q/25383059
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/39588178
tagged with: swing
has answer: http://stackoverflow.com/a/25383243
has comment: http://stackoverflow.com/comment/39585098
has answer: http://stackoverflow.com/a/25383157
type: AnsweredQuestion
answer count: 3
has title: Update JComponent to reflect an object change
tagged with: java
accepted answer: http://stackoverflow.com/a/25383157
has answer: http://stackoverflow.com/a/25383168
possible better answer: http://stackoverflow.com/a/25383168
type: Question
has comment: http://stackoverflow.com/comment/39588990
score: 0
has body: I have a series of JLabels within an interface which are used to display the properties of an object. Is it possible to update the JComponents automatically if said object is replaced by another of the same class? Would such a method be considered bad practice? For example consider the following: String stringToBeDisplayed = new String("String 1"); JLabel label = new JLabel(stringToBeDisplayed); stringToBeDisplayed = new String("String 2"); //*Refresh label to show string change* I know that the text of the JLabel could be set using JLabel.setText() or the label could be replaced, but I am lazy and these methods are a little inconvenient with many JComponents!

http://stackoverflow.com/comment/39342243
comment on: http://stackoverflow.com/a/25251092
type: AnswerComment
score: 0
type: Comment
has text: `YourProjectFolder/bin/` . Note that there may be more subfolders under the `bin` folder, one for each `package` in your project

http://stackoverflow.com/comment/39574868
type: Comment
comment on: http://stackoverflow.com/q/25346968
type: QuestionComment
score: 0
has text: I give up. Did you try US-ASCII?

mongodb
tags question: http://stackoverflow.com/q/25231597
tags question: http://stackoverflow.com/q/25380755
tags question: http://stackoverflow.com/q/25263496
tags question: http://stackoverflow.com/q/25256844
tags question: http://stackoverflow.com/q/25286674
tags question: http://stackoverflow.com/q/25237986
tags question: http://stackoverflow.com/q/25254934
tags question: http://stackoverflow.com/q/25321839
tags question: http://stackoverflow.com/q/25247822
tags question: http://stackoverflow.com/q/25346951
tag name: mongodb
tags question: http://stackoverflow.com/q/25235314
tags question: http://stackoverflow.com/q/25237062
tags question: http://stackoverflow.com/q/25301315
type: Tag
tags question: http://stackoverflow.com/q/25336476
tags question: http://stackoverflow.com/q/25341001
tags question: http://stackoverflow.com/q/25281924
tags question: http://stackoverflow.com/q/25241615
tags question: http://stackoverflow.com/q/25374798
tags question: http://stackoverflow.com/q/25263639

http://stackoverflow.com/comment/39324145
type: QuestionComment
has text: We're going to need the code for your failing test and probably the code for what it is testing.
comment on: http://stackoverflow.com/q/25242239
score: 0
type: Comment

http://stackoverflow.com/comment/39373218
has text: If the program was running by itself (not through eclipse) and you entered "S", it would provide an output that I'd like to utilize in my project. So I guess I meant something to interact with the program once launched.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25267344
type: QuestionComment

http://stackoverflow.com/q/25372015
type: UnansweredQuestion
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25372686
has body: I have the following framelayout: What I'd like to do is be able to toggle it rightways / left in relation to its parent div, fade it and execute a method, left or right differently. I've never done animation in android and don't know if there is something premade (being native, +) that also executes a method at the end of animation + fade. Any idea on this one?
has title: Slide framelayout to left/right, fade and execute method
tagged with: android
tagged with: animation
linked to: http://stackoverflow.com/q/4139288
score: 0

http://stackoverflow.com/comment/39398163
type: AnswerComment
score: 1
type: Comment
has text: Then you don't need the `AnnotationMethodHandlerAdapter` which is also kind of deprecated and replaced by `RequestMethodHandlerAdapter` which is registered automatically by `@EnableWebMvc` which is enabled by default if spring boot detects Sprnig MVC. Jackson is autconfigured if that is detected to, so basically all you have done isn't needed. (Also you probably want to use jackson2 for which Spring Boot already has the dependencies configured).
comment on: http://stackoverflow.com/a/25262889

http://stackoverflow.com/comment/39518603
score: 0
comment on: http://stackoverflow.com/a/25343779
type: Comment
has text: Is there any other approach.
type: AnswerComment

split
tags question: http://stackoverflow.com/q/25293099
tags question: http://stackoverflow.com/q/25304217
tag name: split
tags question: http://stackoverflow.com/q/25381726
tags question: http://stackoverflow.com/q/25351421
tags question: http://stackoverflow.com/q/25245892
tags question: http://stackoverflow.com/q/25282945
type: Tag
tags question: http://stackoverflow.com/q/25286755

http://stackoverflow.com/comment/39365167
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25256953
has text: What exactly are you trying to do? Some client-side validations are already present.
score: 0

http://stackoverflow.com/comment/39420230
type: QuestionComment
score: 0
has text: There's no error. just wrong output.
comment on: http://stackoverflow.com/q/25293961
type: Comment

http://stackoverflow.com/q/25250791
has comment: http://stackoverflow.com/comment/39340997
has comment: http://stackoverflow.com/comment/39340961
has body: I have a Java application in which I maintain set of IPs of my other servers in a hash map in memory. The hash map contains mapping between servers instance ids to servers ip address. I also maintain these servers information in a database for persistence. I am trying to solve a simple problem where I just need to cache the servers information in memory for faster access. So I have used hashmap for that. And I need to make sure that the server information in memory are NOT stale and all the servers in the cache are responsive. So I have created two separate background daemon threads where one thread which gets each entry from the hashmap and pings all of them. If any of the server is not responsive, then it removes that entry from the hashmap. Another thread basically synchronizes the database entries with this hashmap cache. Hence it queries all the entries database, and removes the entries in hashmap which are not there in DB and for new of the entries in DB, it pings each of them and adds to the hashmap. Here first thread runs frequently lets say for evey 15 seconds and second DB thread runs for every 5 minutes. Since both the threads are updating the cache here, I have used ConcurrentHashMap since it will be synchronized. Even then When I read multiple articles, documentations and some of the stackoverflow posts, I see multiple threads updating the hashmap is going to be risky, like when one thread is iterating over the hashmap, other thread may get triggered and start updating the hashmap. So How Can I solve this using different approach here so that I don't disturb the JVM in terms of application performance, time and space complexities and make sure that I have only responsive server entries in my hashmap all most all the time.
has title: Usage of HashMap in a multi-threaded environment for regular update
tagged with: synchronization
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39353092
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/25251414
accepted answer: http://stackoverflow.com/a/25251150
has answer: http://stackoverflow.com/a/25251150
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39367860
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25251414
downvote count: 0
tagged with: concurrenthashmap

http://stackoverflow.com/a/25244026
accepted answer of: http://stackoverflow.com/q/25239283
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25239283
has body: The function which I copied was not applicable to my program. The line FrameLayout from = (FrameLayout) e.getLocalState(); works perfectly fine, so e.getLocalstate already gave the container I wanted. Therefore the parent obtained by view.getParent() was the GridLayout.
score: 0

http://stackoverflow.com/comment/39393871
has text: Yes, so it produces an `Iterator<Map.Entry<String, RequestHolder>>` as above said.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25279935
type: AnswerComment

http://stackoverflow.com/a/25296612
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25296517
accepted answer of: http://stackoverflow.com/q/25296517
type: Answer
downvote count: 0
has body: You can use the String.Format from the String class to specify the number of decimal places you want. sample: String s = String.format("%.4f", KmToMiles(25)) //.4f means round it to 4 decimal places text.setText(s); now that will result to 40.2336 If you want it to be 2 decimal places just change the modifier to %.2f
upvote count: 1
score: 1

http://stackoverflow.com/a/33672472
upvote count: 1
has body: On my Mac a process called "fsnotifier" is using port 1099. A google on this indicates that it's an IntelliJ file system watcher. Solved by using a different port for JMX.
answers question: http://stackoverflow.com/q/25373565
score: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25340780
type: AcceptedAnswer
score: 60
downvote count: 0
has body: The Hibernate Proxy is used to substitute an actual entity POJO (Plain Old Java Object). The Proxy class is generated at runtime and it extends the original entity class. Hibernate uses Proxy objects for entities is for to allow [lazy loading][1]. When accessing basic properties on the Proxy, it simply delegates the call to the original entity. Every List, Set, Map type in the entity class is substituted by a PersistentList, PersistentSet, PersistentMap. These classes are responsible for intercepting a call to an uninitialized collection. The Proxy doesn't issue any SQL statement. It simply triggers an InitializeCollectionEvent, which is handled by the associated listener, that knows which initialization query to issue (depends on the configured fetch plan).
has comment: http://stackoverflow.com/comment/83950340
accepted answer of: http://stackoverflow.com/q/25340606
has comment: http://stackoverflow.com/comment/64702048
type: Answer
answers question: http://stackoverflow.com/q/25340606
upvote count: 60
has comment: http://stackoverflow.com/comment/39508990

http://stackoverflow.com/a/25250921
score: 0
has body: Create a runtime environment for Tomcat 7, but when you asked for tomcat_home or catalina_home use the path you want. I should run fine. I've made myself on MyEclipse and Tomcat 8. This is very fun because Tomcat 8 is unknown to the MyEclipse is too old. Your Luna is too young and should have a server runtime environment for Tomcat 8. Sure you can use a pro version of eclipse to make it working.
type: Answer
answers question: http://stackoverflow.com/q/25250835

http://stackoverflow.com/q/25266920
has comment: http://stackoverflow.com/comment/39371949
favorite count: 0
has title: Not able to capture parameters passed through GET Request
type: Question
has answer: http://stackoverflow.com/a/25268911
has comment: http://stackoverflow.com/comment/39370424
type: UnansweredQuestion
tagged with: httprequest
answer count: 2
downvote count: 0
has body: I am trying to build the Referral functionlity flow for my application. I capture the referral ID from the URL using request parameter. Here is the code snippet : if (null != request.getParameter("refId") &amp;&amp; "" != request.getParameter("refId")) { request.getSession().setAttribute("referenceId", request.getParameter("refId")); } else { request.getSession().removeAttribute("referenceId"); } Thr url for my application is http://shoponline.com/?refId=34523423 However, the referral ID never gets caught from the URL. I tried printing request.getParamter("refId") to the console,but it always displays null. Am I missing something?
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25267862
tagged with: web
has comment: http://stackoverflow.com/comment/39370666

http://stackoverflow.com/q/25267954
has answer: http://stackoverflow.com/a/25268420
linked to: http://stackoverflow.com/q/3301635
linked to: http://stackoverflow.com/q/5173372
upvote count: 4
tagged with: spring
score: 4
has comment: http://stackoverflow.com/comment/39390134
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25268420
has comment: http://stackoverflow.com/comment/39372432
tagged with: java
answer count: 1
downvote count: 0
has body: Is it possible to achieve such an assignment. The article here deals with private static field members but it does not help in this case as final members cannot be assigned. Justification for using private static final as a qualifier for the member: The data member is a ServiceClient so it makes sense to have it attached to type as it does not depend on the instance. Its thread safe too, so it will improve performance as I will not initialize the client for each instance. The service client itself is a bean, having singleton scope. Hence actually there is only one instance. Since there will always be one instance, there is no point in allowing reassignment. Since this client is only be used by methods of this class, it is private. I am not exactly sure if this is an anti-pattern, but if it is then do my justification qualify to use it? If yes, then how can it be done. If no, then please suggest an alternative (and I would still be interested to know how can this be achieved, just for knowledge purposes).
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7253694
has title: Assigning private static final field member using spring injection

http://stackoverflow.com/comment/39400949
comment on: http://stackoverflow.com/q/25283168
score: 0
type: Comment
has text: @zaratustra, I know this ability of NetBeans, but my problem is can I have perfect UI using swing or I should use JavaFx? can I have perfect UI with JtextPane?
type: QuestionComment

http://stackoverflow.com/q/25310904
downvote count: 0
has comment: http://stackoverflow.com/comment/39452754
upvote count: 1
has comment: http://stackoverflow.com/comment/77570214
tagged with: spring
has comment: http://stackoverflow.com/comment/39452986
tagged with: spring-mvc
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39453691
has title: Spring @ExceptionHandler not called when controller implements an interface
favorite count: 0
type: Question
has body: I have a @Controller that implements an interface but the @ExceptionHandler methods that are on a abstract BaseController are not executed. I've debugged and it seems the AnnotationMethodHandlerExceptionResolver has this line which tries to find the annotated methods ExceptionHandler exceptionHandler = AnnotationUtils.findAnnotation(method, ExceptionHandler.class); But it only ever gets passed the methods that are on the interface and I have no way of adding the methods to this interface. Spring does this final Class&lt;?&gt; handlerType = ClassUtils.getUserClass(handler); then uses handlerType when iterating over available methods. Documentation for ClassUtils.getUserClass(handler) - Return the user-defined class for the given instance: usually simply the class of the given instance, but the original class in case of a CGLIB-generated subclass. where handle is actually my controller implamentation class, but ends up with a proxy. Using Spring 3.2, controllers are registered using context:component-scan. So my question, if it's not immediately obvious, is how do I get Spring to call the exception handler method? interface ControllerInterface { String doStuff(); } @Controller public class Controller extends BaseController implements ControllerInterface { public String doStuff() { throw new ServiceException(); } } public class BaseController { @ExceptionHandler(ServiceException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody public Error handleException(ServiceException exp) { return new Error(exp.getCode(), exp.getMessage()); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39459537

http://stackoverflow.com/q/25347688
answer count: 0
score: 0
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/39521133
tagged with: namespaces
type: Question
has body: I have generated by Java objects using JAXB2.2. I am using Spring 3.0.1, Java 1.6, and JBoss AS 5. My problem is that when my application sends generates and sends a SOAP message, I have an element that is of type anyType, generated as an Object in Java. The sent request message will be formed like this: &lt;field xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; But the schema expects this: &lt;field xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; As you can see, the missing namespace definition is this: xmlns:xs="http://www.w3.org/2001/XMLSchema" The generated java output for this element is: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MetadataElement", namespace = "http://...", propOrder = { "field" }) public class MetadataElement { @XmlElement(required = true) protected Object field; Any ideas on how I can generate the missing namespace?
has comment: http://stackoverflow.com/comment/39519759
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39519686
has title: Spring does not add namespace for type String in SOAP message
has comment: http://stackoverflow.com/comment/39521333
tagged with: spring
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/39519861

http://stackoverflow.com/comment/39520240
score: 0
has text: You need to get user input on some event, like button click.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25347981

http://stackoverflow.com/a/25290909
upvote count: 2
type: AcceptedAnswer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/25290493
type: Answer
answers question: http://stackoverflow.com/q/25290493
has body: You should set up a custom TableModel, that way you can use any data structures you want instead of arrays: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data That will also allow you to specify which cells are editable. You can set the widths of the JTable columns just by calling the appropriate methods in the TableColumn class. More info here: http://docs.oracle.com/javase/8/docs/api/javax/swing/table/TableColumn.html The JTable header is only automatically shown when it's in a JScrollPane. You do add your JTable to a JScrollPane, but then you don't do anything with that JScrollPane. The JScrollPane itself has to be in a JFrame somewhere.

http://stackoverflow.com/comment/39425204
has text: I copy pasted the code you suggested and replaced with mine and what happened was and it did not crash but acted weird. is it cool if i edit my question and paste my entire code so it might let u help me better? i am really stuck on this and i do not want to learn further till i understand whats wrong here
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25293751
type: Comment

http://stackoverflow.com/q/25273963
has comment: http://stackoverflow.com/comment/39413826
has answer: http://stackoverflow.com/a/25293864
tagged with: nlp
tagged with: phoneme
tagged with: grapheme
score: 0
tagged with: java
answer count: 1
tagged with: machine-learning
type: Question
has body: I'm having trouble searching for the right terms here to solve the below problem; I'm sure it's a done thing, I just can't find the right terms to express the problem! I'm basically trying to create a classifier that will take word comparison outputs (e.g. some outputs from Levenstein distances) and decide whether the words are sufficiently different. An important input would probably be something like a soundex comparison. The trouble I'm having is creating the training set for the algorithm (an SVM in this case). I have a long list of names and I need to mutate them a bit (based on similar sounds within the word). E.g. John and Jon would be a mutation to make, and I could label this in the test set as being equivalent. John and Johann have sufficiently different sound and letter distance to be considered different. So I'm kinda asking for is a way to achieve a phoneme variation generator, but need to be able to retain the English lettering structure. Even simple translation might suffice, like "f" could (sometimes) be replaced by "ph". I'm doing this in Java so any tips in that direction would be great too! Thanks. EDIT This is the closest I've come across so far: http://www.isi.edu/natural-language/people/hovy/papers/07IJCAI-spelling-variants.pdf
has comment: http://stackoverflow.com/comment/39413249
type: UnansweredQuestion
has title: convert similar sound word parts
has comment: http://stackoverflow.com/comment/39419673

http://stackoverflow.com/a/53593950
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/100889466
has body: JpaRepository interface has two methods: First is getOne(id) which is an alternative of hibernate load, second is findById(id) which is an aternative of hibernate get method.
answers question: http://stackoverflow.com/q/25362771
type: Answer

http://stackoverflow.com/q/25381210
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/25384215
upvote count: 1
has body: I have a project that is using google admob. It had .jar file in /libs, but I want to change it and use google play services. I include it in "Properties>Android>library" from "google-play-services" project. And now i get error inflating class com.google.ads.adview. Can anyone help me why do i get that? Thank you.
accepted answer: http://stackoverflow.com/a/25392431
favorite count: 0
tagged with: admob
type: Question
has answer: http://stackoverflow.com/a/25392431
tagged with: android
answer count: 2
has answer: http://stackoverflow.com/a/25384215
tagged with: adview
type: AnsweredQuestion
has title: Google admob error inflating class com.google.ads.adview with reference from Google Play services library project
score: 1

http://stackoverflow.com/comment/39462788
type: QuestionComment
score: 0
has text: In my case, no. Basically, I'm pulling the user info out of LDAP, and storing it in a smaller, more manageable database (with an option to export to CSV.) So, I need to iterate over all the users and their attributes to do my inserts.
comment on: http://stackoverflow.com/q/25316010
type: Comment

http://stackoverflow.com/a/25361765
type: Answer
has comment: http://stackoverflow.com/comment/39565593
score: 2
has comment: http://stackoverflow.com/comment/39545855
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25360878
has body: The problem is, you are adding a LabelPanel to a LabelPanel labelPanel.add(new LabelPanel(dealer)); But you are passing the outer panel to the controller new Controller(labelPanel, dealer); The outer panel no longer actually contains any labels, but only contains the new LabelPanel... A better solution would be to provide the LabelPanel with a "reset" option of some kind instead...
answers question: http://stackoverflow.com/q/25360878

http://stackoverflow.com/a/25316080
has comment: http://stackoverflow.com/comment/39461677
type: Answer
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25316010
answers question: http://stackoverflow.com/q/25316010
has body: You shouldn't. You'll spend a lot more time writing this new class than just typing a few extra characters. If you really want to make a new class. Why not like this? public class User { private String attribute1; private String attribute2; //etc. public String getAttribute1() { return attribute1; } public void setAttribute1(String value) { attribute1 = value; } public String getAttribute2() { return attribute2; } public void setAttribute2(String value) { attribute2 = value; } //etc. } If you insist on using nested Lists. I suggest creating a wrapper class that would look something like this: public class Users { private List&lt;List&lt;String&gt;&gt; twoDList; public String get(int x, int y) { return twoDList.get(y).get(x); } public void set(int x, int y, String value) { twoDList.set(y, twoDList.get(y).set(x, value)); } //etc. }
type: AcceptedAnswer

http://stackoverflow.com/q/25324913
tagged with: applet
linked to: http://stackoverflow.com/q/19393826
favorite count: 0
has answer: http://stackoverflow.com/a/25328577
type: Question
has body: We're experiencing the LiveConnect security warning in our application even though the applet is signed, and the Caller-Allowable-Codebase attribute is set: The second problem is that the Application and Publisher fields are set to UNKNOWN in IE, FF and Chrome. The first security information displayed seems to pick up the information from the certificate. My manifest file: Manifest-Version: 1.0 Implementation-Vendor: xxx xxx Buildings AB Implementation-version: 1.5.0.49829 Application-Library-Allowable-Codebase: * Application-Name: Building Operation WebStation Permissions: all-permissions Created-By: 1.7.0 (Sun Microsystems Inc.) Caller-Allowable-Codebase: * Specification-Version: 1.0 Codebase: * I read the Oracle blog post about security changes with LiveConnect. I have also tried adding the Application-Library-Allowable-Codebase: * attribute without success. It doesn't even seem to make any difference in the security attributes guide . Checking that checkbox doesn't do anything, the next time we navigate to the applet, the warning will pop up again. jarsigner.exe outputs "jar verified". Examining the certificate we sign with shows the whole chain - our company > RapidSSL CA > GeoTrust Global CA. I've imported the certificate to several Windows certificate stores, even though just being signed by a trusted root CA should be enough. We're testing on the latest JRE and we get the same result with JRE 8 Java Plug-in 10.67.2.01 Using JRE version 1.7.0_67-b01 Java HotSpot(TM) Client VM Does anyone know how to get rid of the pop-up while still allowing LiveConnect calls? if not, how to populate the two UNKNOWN fields in the dialog ?
tagged with: liveconnect
type: UnansweredQuestion
has title: Java applet - LiveConnect security warning popup
score: 2
tagged with: security
upvote count: 2
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25283218
answers question: http://stackoverflow.com/q/25283168
score: 3
upvote count: 3
type: Answer
has body: It IS possible to mix JavaFX and Swing. But I have no experience in it. I just did a little FX-UI for a small project which was pretty nice. Especially the CSS-Feature is great. According to mixing, I just recently found a blog which discouraged mixing both technologies: http://dlemmermann.wordpress.com/2014/07/17/javafx-tip-9-do-not-mix-swing-javafx/ Maybe this gives you a little help.
downvote count: 0

http://stackoverflow.com/comment/39407836
score: 0
has text: @VivekVK I'm not sure where I am? or what it means to be anywhere? but i'll try and let you know
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25287150

http://stackoverflow.com/q/25313595
has body: This post comes as a result of a comment I left on a similar question: https://stackoverflow.com/a/19860271/2308858 I'm using PostgreSQL and jOOQ 3.4 and trying to represent the following SQL query in jOOQ: SELECT *, COUNT(*) OVER() FROM table1 t1 JOIN table2 t2 ON (t1.id = t2.id) JOIN table3 t3 ON (t1.otherId = t3.otherId) I like how Postgres lets me concisely represent "all columns plus the count column" with nothing more than SELECT *, COUNT(*) OVER(). But when I try to represent this same query in jOOQ, the most concise way I can do is: create.select( TABLE1.fields() ).select( TABLE2.fields() ).select( TABLE3.fields() ).select( count().over() ) .from( TABLE1 ) .join( TABLE2 ).on( TABLE1.ID.equal( TABLE2.ID )) .join( TABLE3 ).on( TABLE1.OTHER_ID.equal( TABLE3.OTHER_ID )) Ideally, I'd write this instead: create.select().select( count().over() ) .from( TABLE1 ) .join( TABLE2 ).on( TABLE1.ID.equal( TABLE2.ID )) .join( TABLE3 ).on( TABLE1.OTHER_ID.equal( TABLE3.OTHER_ID )) But this doesn't seem to work. Any thoughts on how I can do this?
accepted answer: http://stackoverflow.com/a/25324164
downvote count: 0
type: AnsweredQuestion
tagged with: postgresql
tagged with: jooq
has title: jOOQ - Concisely Representing Both Columns and Aggregate/Window Functions in a Query
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/19849839
has answer: http://stackoverflow.com/a/25324164
favorite count: 0
type: Question
upvote count: 4
score: 4

http://stackoverflow.com/comment/39549368
score: 4
comment on: http://stackoverflow.com/q/25364254
type: QuestionComment
has text: You only return a `List` if an `IOException` occurs...
type: Comment

http://stackoverflow.com/comment/39464598
comment on: http://stackoverflow.com/q/25317748
has text: What's wrong with `clone()`? That's what it's meant for.
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25373335
has body: If your input line consists of fields separated by groups of one or more whitespaces, it might be easiest to use split instead of a regex: String[] fields = inputString.split("\\s+"); Now fields[0] is the first field, fields[1] is the second, etc., so fields[3] should give you what you want.
score: 0
answers question: http://stackoverflow.com/q/25373220
type: Answer

http://stackoverflow.com/comment/39577105
comment on: http://stackoverflow.com/a/25378679
type: Comment
score: 0
type: AnswerComment
has text: You "could" `implement ActionListener`...you could also use anonymous inner class, inner class or an external class which implements `ActionListener` (ah, the good old days) or an `Action` ... all of which would be acceptable...

http://stackoverflow.com/q/25330700
has answer: http://stackoverflow.com/a/68436640
tagged with: rest
score: 21
tagged with: java
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25332038
tagged with: jersey
has answer: http://stackoverflow.com/a/25332038
has body: I'm using Jersey to create REST API. I have one POST method and as a response from that method, the user should be redirected to a custom URL like http://example.com that doesn't have to be related to API. I was looking at other similar questions on this topic here but didn't find anything that I could use.
downvote count: 0
upvote count: 21
possible better answer: http://stackoverflow.com/a/68436640
has title: Jersey - Redirect after POST to outside URL
favorite count: 0
type: Question

xml-signature
tags question: http://stackoverflow.com/q/25251938
type: Tag
tag name: xml-signature

http://stackoverflow.com/comment/40243472
score: 0
comment on: http://stackoverflow.com/q/25356302
type: Comment
type: QuestionComment
has text: In this six parameter which one is used for rotation?

http://stackoverflow.com/comment/39360934
type: QuestionComment
has text: You can use Process and ProcessBuilder class Read on http://www.rgagnon.com/javadetails/java-0014.html
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25262026

http://stackoverflow.com/comment/39474096
has text: Ouch. Some chipsets out there very intentionally make use of very literal compilers. They are not brain dead: they just do what it says on the tin and the output assembler is very easy to follow : can be reviewed over a coffee at 2am before burning onto a chip that nobody on Earth will ever see again! Yes, I'm talking about C compilers but I still think the principle holds. Perhaps I'm just old-fashioned.
type: Comment
comment on: http://stackoverflow.com/a/25322782
score: 0
type: AnswerComment

http://stackoverflow.com/a/25292658
downvote count: 0
score: 2
type: Answer
has body: You will most likely get a java.lang.VerifyError: Thrown when the "verifier" detects that a class file, though well formed, contains some sort of internal inconsistency or security problem.
answers question: http://stackoverflow.com/q/25292551
upvote count: 2

http://stackoverflow.com/comment/39334319
has text: you need to revalidate() and repaint() the contentPane if you want to add components to it after the frame is already visible.
comment on: http://stackoverflow.com/q/25247519
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25377224
tagged with: android
tagged with: java
answer count: 1
has body: I want to get th id of spinner dynamically created.I dont want to get the id of selected item. I want to get spinner owns id on item selection. My code is.. private OnItemSelectedListener itemSelectListener = new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) { // TODO Auto-generated method stub }
has comment: http://stackoverflow.com/comment/39574596
has comment: http://stackoverflow.com/comment/39574725
has title: How we get Spinner Id not Selected item?
type: Question
has comment: http://stackoverflow.com/comment/39574597
type: UnansweredQuestion
tagged with: android-spinner
has answer: http://stackoverflow.com/a/25377295
score: 0
has comment: http://stackoverflow.com/comment/39576039
has comment: http://stackoverflow.com/comment/39574777
has comment: http://stackoverflow.com/comment/39574738

http://stackoverflow.com/comment/39404683
type: Comment
score: 0
has text: Well first of all, if it's a game and not a simulation, then a formula will not help you since you most certainly want to, in each iteration of your game loop, draw the object you are animating to the screen.
comment on: http://stackoverflow.com/q/25285741
type: QuestionComment

http://stackoverflow.com/q/25313708
answer count: 5
has body: I have This method below which works for sorting out Student objects in an arraylist using String parameters, for example a Student Object would have a String name,int age and String course parameter //This Sorts with String parameters public void sortArrayListByName() { Collections.sort(sList,new Comparator&lt;Student&gt;() { public int compare(Student s1, Student s2) { return s1.getName().compareTo(s2.getName()); } }); } Now I want to implement this code with integer parameters //This should sort the Arraylist of Objects public void sortArrayListByAge() { Collections.sort(sList,new Comparator&lt;Student&gt;() { public int compare(Student s1, Student s2) { return s1.getAge().compareToIgnoreCase(s2.getAge()); //This Part gives me errors } }); } But i get an error message saying Cannot invoke compareToIgnoreCase(int) on the primitive type int How can i fix this code so that it will be able to sort the list with integer values?
accepted answer: http://stackoverflow.com/a/25313771
has answer: http://stackoverflow.com/a/25313771
possible better answer: http://stackoverflow.com/a/25313800
tagged with: sorting
has answer: http://stackoverflow.com/a/25313905
has answer: http://stackoverflow.com/a/25313800
type: Question
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/39457030
has answer: http://stackoverflow.com/a/25313781
tagged with: java
has title: Sorting An ArrayList of Objects by Object Parameters - Integers
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39457010
has answer: http://stackoverflow.com/a/25314013

http://stackoverflow.com/comment/39462274
comment on: http://stackoverflow.com/a/25316484
score: 0
has text: @Tom Very true, the case I provided was simple assignment, it was more of a convention question. Doesn't seem to receive an absolute answer
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39444986
comment on: http://stackoverflow.com/a/25257342
type: Comment
has text: yes after all the search i found that the quartz does not provide a api to get the count of the trigger, but from their documentation i found a similar method as above in clear example [link](http://http://quartz-scheduler.org/documentation/quartz-1.x/examples/Example4) that was very helpful and tanQ @Aramir
score: 0
type: AnswerComment

http://stackoverflow.com/q/25319289
tagged with: swing
answer count: 1
has title: How can i change the color of my lines in drawing GUI
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25319539
has answer: http://stackoverflow.com/a/25319539
type: AnsweredQuestion
score: 0
has body: Hey I'm having a lot of trouble trying to get my buttons on my toolbar to change the color of the lines I'm drawing. Here is my code: public class PaintingGUI { private static final int FRAME_WIDTH = 960; private static final int FRAME_HEIGHT = 640; private final static String NEWLINE = System.lineSeparator(); private JTextArea textArea = new JTextArea(); class MyButtonListener extends JPanel implements MouseListener, MouseMotionListener, ActionListener { private int mouseX1 = -1; // the mouse Coordinates when pressed private int mouseY1 = -1; private int mouseX2 = -1; // mouse coordinates when released private int mouseY2 = -1; Color c; JButton red, green, blue, yellow, orange, black, pink, purple, dot, line, square, circle, ellipse, text; public MyButtonListener() { setOpaque(false); } public MyButtonListener(JButton red, JButton green, JButton blue, JButton yellow, JButton orange, JButton black, JButton pink, JButton purple, JButton dot, JButton line, JButton square, JButton circle, JButton ellipse, JButton text){ // Need to communicate references to the buttons in this class this.red = red; this.green = green; this.blue = blue; this.yellow = yellow; this.orange = orange; this.black = black; this.pink = pink; this.purple = purple; this.dot = dot; this.line = line; this.square = square; this.circle = circle; this.ellipse = ellipse; this.text = text; } public void actionPerformed(ActionEvent e) { JButton source = (JButton) e.getSource(); if(source == red) { c = Color.RED; System.out.println(c); repaint(); } if(source == green) { c = Color.GREEN; System.out.println("Colour is green"); repaint(); } if(source == blue) { c = Color.BLUE; System.out.println("Colour is blue"); repaint(); } if(source == yellow) { c = Color.YELLOW; System.out.println("Colour is yellow"); repaint();repaint(); } if(source == orange) { c = (new Color(255, 137, 0)); System.out.println("Colour is orange"); } if(source == black) { c = Color.BLACK; System.out.println("Colour is black"); } if(sourc…

http://stackoverflow.com/a/25232700
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25232117
answers question: http://stackoverflow.com/q/25232117
has body: You are using a Set and from Set documentation we get: A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction. In order to check if the new DataException could be added to the collection, it needs to load it from DB first. Due this reason it will trigger loading of data if you perform an add operation in a Set. For your case If you are just interested in storing the new DataException maybe you could simply store the DataException object, if it is already stored you will receive a PK violation, but you will avoid the select to load such collection.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39306664
upvote count: 1
has comment: http://stackoverflow.com/comment/39314145

http://stackoverflow.com/q/25307819
has comment: http://stackoverflow.com/comment/39449056
has title: Parse Exception MaskFormatter
tagged with: java
has comment: http://stackoverflow.com/comment/39448502
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25309207
score: 1
upvote count: 1
tagged with: swing
favorite count: 0
has comment: http://stackoverflow.com/comment/39446057
type: Question
has body: I'm trying to use MaskFormatter with JFormattedTextField. Inside my class I have this line of code JFormattedTextField jtfCNP=new JFormattedTextField(new MaskFormatter(formatCNP)); When I compile, I get the ParseException. The only way around it I found to create the instance of the MaskFormatter inside the constructor of my GUI panel inside a try block like this try { format_cnp=new MaskFormatter("# ###### ######"); jtf_cnp=new JFormattedTextField(format_cnp); } catch (ParseException pex) {} jtf_cnp.setColumns(20); I'd like the functionality of the MaskFormatter, but isn't there any way to instantiate it outside a method? Also, is there a better alternative to MaskFormatter? Edit: the sample code that doesn't work: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; import javax.swing.text.*; public class test extends JFrame{ String formatCNP="# ###### ######"; //components JFormattedTextField jtfCNP=new JFormattedTextField(new MaskFormatter(formatCNP)); public test(){ super("MaskFormatter Test"); setSize(300,300); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jtfCNP.setColumns(20); add(jtfCNP); setVisible(true); } public static void main(String[] args){ test tf=new test(); } }
tagged with: parseexception
has comment: http://stackoverflow.com/comment/39449067
tagged with: javax.swing.text
has answer: http://stackoverflow.com/a/25309207
type: AnsweredQuestion
tagged with: jformattedtextfield

http://stackoverflow.com/comment/39366866
type: Comment
has text: Well, what I didn't realize was even though the screen is displaying a live preview, it wouldn't technically run OnPreviewFrame() since the main thread was sharing between this loop and the actual passing of preview frame data. So there wasn't a "new frame" to even call setoneshotpreviewcallback() since it was in the loop.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25255514

http://stackoverflow.com/a/25312020
has comment: http://stackoverflow.com/comment/39469326
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/39456309
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39487066
accepted answer of: http://stackoverflow.com/q/25311535
type: Answer
has comment: http://stackoverflow.com/comment/39475889
has comment: http://stackoverflow.com/comment/39456293
has comment: http://stackoverflow.com/comment/39456768
has body: You didn’t specify how you want to combine the supplied values. If you want to have the values alternating, a solution would be: Stream.generate(supplier1).flatMap(x-&gt;Stream.of(x, supplier2.get())) If you want to have some kind of pair, you can use Stream.generate(()-&gt;new Pair&lt;&gt;(supplier1.get(), supplier2.get())) though it is up to you to write the Pair class as the jdk does not offer such a class. (You could abuse AbstractMap.SimpleEntry but that’s rather nasty). If you have a finite Stream you can use Stream.concat to create a stream which will process all items of the first stream before the items of the second, however, streams created using a Supplier are infinite by default so you have to use limit on the first stream before you can concat it to another stream, so it’s not a general solution. If you want to query each Supplier exactly once, you can use Stream.of(supplier1, supplier2).map(Supplier::get) though, of course, if you don’t need lazy evaluation of the Suppliers, a Stream.of(supplier1.get(), supplier2.get()) would do as well.
answers question: http://stackoverflow.com/q/25311535

http://stackoverflow.com/comment/39392571
has text: My question is not about partitioning a list, but about removing elements from a collection and collecting them at the same time. I edited my question to avoid confusion.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25270073

http://stackoverflow.com/comment/39431614
comment on: http://stackoverflow.com/a/25298413
type: Comment
score: 0
type: AnswerComment
has text: Yes, I could queue a quartz job from the web application and have the job begin execution on a different process. But all this is relying on polling of the database with Quartz but doesn't solve sending a response to the web application. While polling has its place, I just don't see this being one of those when a JMS queue seems far more efficient for this type of asynchronous unit of work operation.

http://stackoverflow.com/a/25392431
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25381210
answers question: http://stackoverflow.com/q/25381210
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has body: You need to change the api. You can follow the official migration guide Basically, you need to make the changes below: Change: &lt;com.google.ads.AdView xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adUnitId="MY_AD_UNIT_ID" ads:adSize="BANNER" ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" ads:loadAdOnCreate="true"/&gt; To: &lt;com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adUnitId="MY_AD_UNIT_ID" ads:adSize="BANNER"/&gt; // Java code required. // testDevices and loadAdOnCreate attributes are // no longer available. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("TEST_DEVICE_ID") .build(); adView.loadAd(adRequest); Change: &lt;activity android:name="com.google.ads.AdActivity"/&gt; To: &lt;activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/&gt;` Add: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/&gt; Don't forget the permissions: &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt;

http://stackoverflow.com/q/25273265
upvote count: 1
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: when i am trying to deploy my application, using Spring data Neo4j, i get following exception. Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor#0': Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: NULL I am trying to complete recommender system using Spring data Neo4j. I cannot find any problem in code below. Thanks for all your advices. pom.xml <spring.version>3.1.4.RELEASE</spring.version> <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> spring-maven-release Spring Maven Release Repository http://maven.springframework.org/release spring-maven-snapshot Spring Maven Snapshot Repository true http://maven.springframework.org/snapshot spring-maven-milestone Spring Maven Milestone Repository http://maven.springframework.org/milestone neo4j-release-repository Neo4j Maven 2 release repository http://m2.neo4j.org/releases true false neo4j-snapshot-repository Neo4j Maven 2 snapshot repository http://m2.neo4j.org/snapshots true false jboss-public-repo http://repository.jboss.org/maven2/ JBoss public available repo org.springframework.security spring-security-web ${spring.version} org.springframework.security spring-security-config ${spring.version} org.neo4j neo4j-kernel 1.8.1 org.neo4j neo4j-cypher 1.8.1 org.springframework.data spring-data-neo4j 2.1.0.RELEASE org.springframework.data spring-data-neo4j-aspects 2.1.0.RELEASE org.aspectj aspectjrt 1.6.12 org.springframework spring-core ${spring.version} org.springframework spring-jdbc ${spring.version} org.springframework spring-orm ${spring.version} org.springframework spring-beans ${spring.version} org.springframework spring-context ${spring.version}…
tagged with: spring-data-neo4j
type: UnansweredQuestion
tagged with: maven
tagged with: spring-mvc
has title: Spring data Neo4j: Error creating bean with name RepositoryInterfaceAwareBeanPostProcessor#0: nested exception is java.lang.NoSuchFieldError: NULL
answer count: 0
tagged with: java
downvote count: 0

opencsv
tag name: opencsv
tags question: http://stackoverflow.com/q/25301620
tags question: http://stackoverflow.com/q/25314664
type: Tag
tags question: http://stackoverflow.com/q/25257100
tags question: http://stackoverflow.com/q/25349164
tags question: http://stackoverflow.com/q/25285296

http://stackoverflow.com/comment/39460900
score: 0
type: QuestionComment
type: Comment
has text: Are you using two different Tomcats or just a single Tomcat? If one, why would you want to have a second HTTP connector? That is nonsense. Feels like [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem).
comment on: http://stackoverflow.com/q/25313589

http://stackoverflow.com/q/25294677
has comment: http://stackoverflow.com/comment/39549558
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25412339
has title: With Android KitKat chrome://inspect/devices network monitoring, how to view all request data
tagged with: android
possible better answer: http://stackoverflow.com/a/25411238
has body: I am using the "chrome://inspect/devices" and monitoring the http traffic for an Android application. This only works with the Android 4.4/KitKat. Within this tool, the set-cookie and cookie data does not show. Is there another tool or how can I configure this tool to show the cookie data for each request. The "cookie" store set of cookies do appear but not for each individual request between the server and client/Android device. I believe this hybrid Cordova based web view is masking the cookies. I don't know how. More information: http://code.google.com/p/chromium/issues/detail?id=403490 Note: this is monitoring traffic between the Android device and a host PC, monitoring the traffic on the host PC. Note: It looks like it is a "webview" or application/api/library issue. We are using Cordova to build this application. It is a hybrid/web-view application, I don't know why or how it could explicitly hide the cookie information? I was curious if anyone has any more detail on how a webview could hide cookies.
has answer: http://stackoverflow.com/a/25411238
score: 4
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39515711
downvote count: 0
accepted answer: http://stackoverflow.com/a/25412339
tagged with: cookies
tagged with: java
tagged with: google-chrome
tagged with: http

http://stackoverflow.com/comment/135542591
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/34736360
has text: is there a way to do it by column?
type: Comment

http://stackoverflow.com/a/25331345
score: 0
answers question: http://stackoverflow.com/q/25330916
type: Answer
has body: In Java comments are used to generate a javadoc from the source code you have written. Format your comments according javadoc spec. That's enough for commenting in Java, other comments are optional and how someone mentioned comments are versus commented out code. If you keep such code in files you'd better leave a reasonable comment (i.e. referencing some issue, etc.). Note that using Java naming conventions and properly named Java elements greatly reduce needs for commenting inside the code. These comments are only intended for uses who will proof read or debug your code are optional as I mentioned above. Other optional comments are project related and tagged for example todo. You should concentrate more attention on javadoc comments, as general rule are placed on all public methods and classes including interfaces. if your class implements some interface method then you should not duplicate comment there, just reference a corresponding interface method comment.

http://stackoverflow.com/comment/39404565
type: AnswerComment
comment on: http://stackoverflow.com/a/25284912
score: 0
type: Comment
has text: Getting 75 now when I switched to >>> and masking it with 0xff

http://stackoverflow.com/comment/39491250
comment on: http://stackoverflow.com/q/25331750
type: QuestionComment
has text: Paste what you've tried
type: Comment
score: 0

http://stackoverflow.com/comment/39379830
has text: @JBNizet Please see my second edit at the end of my original posting above. What else do I need to change to resolve this problem?
comment on: http://stackoverflow.com/q/25252541
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39376292
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25270000
has text: Further information: If I take the view returned by the todayPositionFound method and findViewById and get the TextView within that view I can successfully select that TextView, including UI changes due to the selection. But this is not what I want... so I'm not totally sure what I'm doing wrong to select the containing view and not it's child TextView...
type: Comment

http://stackoverflow.com/q/25290888
tagged with: api
upvote count: 3
tagged with: validation
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
has comment: http://stackoverflow.com/comment/39414794
type: Question
accepted answer: http://stackoverflow.com/a/25291426
has comment: http://stackoverflow.com/comment/39414826
has comment: http://stackoverflow.com/comment/39415102
has comment: http://stackoverflow.com/comment/39415014
has answer: http://stackoverflow.com/a/25296140
possible better answer: http://stackoverflow.com/a/25296140
has title: JAVA api validation/Exception handling
has answer: http://stackoverflow.com/a/25291426
type: AnsweredQuestion
score: 3
has body: How to handle error conditions when writing a Java API/Utility This is my Implementation for my API interface public void bin2zip(InputStream[] is,OuputStream os, String[] names) { //if number of streams and number of names do not match do something } What I am trying to do is handling a case when the length of the is != length of name. How do i handle this. I dont want my API to do some work until ArrayOutOfBound exception to be thrown. I want to catch this early. One solution is something like this: if it does not match I throw if(is.length==names.length) throws new Exception("ParemeterValidationException: The inputstream array and name array length should match"); if(containsInvalidFileName(names)) throws new Exception("ParemeterValidationException: The names array length should contain valid filenames"); Also, can this be done compile time using DataDependency (I can make ValidationClass for the API and make sure the developer get hold of this object to pass on to this conversion API) or the runtime exception is the best way? I believe doing a ValidationClass will make API use complicated I did go through some materials (if anyone interested), but need some directions. http://lcsd05.cs.tamu.edu/slides/keynote.pdf Java: checked vs unchecked exception explanation http://docs.oracle.com/javase/tutorial/collections/interoperability/api-design.html
answer count: 2

http://stackoverflow.com/a/25339411
accepted answer of: http://stackoverflow.com/q/25335879
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39554347
has body: The only portable way to get a synthesizer is MidiSystem.getSynthesizer(), which gives you nothing but the default synthesizer, which outputs to some default audio device. You would have to change the default audio output device of the JVM or of the OS. The synthesizer has a fixed latency, which you can obtain with Synthesizer.getLatency(). The audio device will add its own latency.
has comment: http://stackoverflow.com/comment/39550982
answers question: http://stackoverflow.com/q/25335879
score: 0
has comment: http://stackoverflow.com/comment/39554400
type: Answer
has comment: http://stackoverflow.com/comment/39547271
has comment: http://stackoverflow.com/comment/39554442
has comment: http://stackoverflow.com/comment/39554308
has comment: http://stackoverflow.com/comment/39546785

http://stackoverflow.com/comment/39545929
type: Comment
has text: @DanF Have you tested with input data?
type: AnswerComment
comment on: http://stackoverflow.com/a/25343631
score: 0

http://stackoverflow.com/comment/39390897
has text: Thanks @Rachael. I noted that I had issues with inappropriate jar file. I had set bcprov-jdk15on-151.jar, bcprov-ext-jdk15on-151.jar, bcpg-jdk15on-151.jar into classpath but did removed the one from ext location. I did retain the changes to java.security. I was not able to try out with each of the jar files into ext one-by-one to see which was important, but to me bcprov-jdk15on-151.jar seemed to be the most important.
score: 0
comment on: http://stackoverflow.com/q/25255950
type: Comment
type: QuestionComment

mmo
tags question: http://stackoverflow.com/q/25321526
tag name: mmo
type: Tag

http://stackoverflow.com/comment/39409548
has text: Lots of programming constructs are about readability rather than explicit benefits. It is worth noting though :)
type: Comment
comment on: http://stackoverflow.com/a/25286613
type: AnswerComment
score: 0

http://stackoverflow.com/comment/57896229
comment on: http://stackoverflow.com/a/35082489
score: 1
type: Comment
type: AnswerComment
has text: Thank you, but this has already been solved, like a half year ago

http://stackoverflow.com/a/28591331
has body: You can perform this operation with the following existing test classes: .andExpect(jsonPath("$..myExpectedNullKey[0]").value(IsNull.nullValue())); Be sure to import org.hamcrest.core.IsNull
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25318424
score: 29
upvote count: 29

http://stackoverflow.com/a/25261735
answers question: http://stackoverflow.com/q/25261659
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25261659
has body: String line = "N001";"2014-08-12-07.11.37.352000";" ";"some@email.com ";4847 ;"street";"NAME SURNAME ";26 ;"CALIFORNIA ";21 StringTokenizer st1 = new StringTokenizer(line, ";"); while(st2.hasMoreTokens()) { System.out.println(st2.nextToken().replaceAll("\"","")); } Or you can use split method and directly get a array of values using the delimiter ; String []values = line.split(";"); then iterate through the array and get and cast the values they way you want
score: 1
type: Answer

http://stackoverflow.com/comment/39573783
type: AnswerComment
has text: ADDRESS_ID is the column name of your ADDRESS table which is mapped to id in address class above
comment on: http://stackoverflow.com/a/25376358
score: 0
type: Comment

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/25283581

http://stackoverflow.com/q/25291845
has comment: http://stackoverflow.com/comment/39417404
tagged with: akka
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
has body: In my application I have one server node and several worker nodes with one actor one each. Each actor sends the initial message to the server, and server adds it to Router. But when client becomes dead (programm is killed for example), the number of routees in the router stays the same. How can clean the router from the dead actors?
type: Question
has comment: http://stackoverflow.com/comment/39423406
accepted answer: http://stackoverflow.com/a/25308646
has answer: http://stackoverflow.com/a/25308646
has title: How to remove dead actors from Akka router?
type: AnsweredQuestion

http://stackoverflow.com/comment/39416302
type: QuestionComment
comment on: http://stackoverflow.com/q/25291952
has text: For a start, eliminate your code from the equation. Just start listening with `netcat`, and then try telnetting to the port or something. If you can't get that to work, this isn't a programming question, and should probably be redirected to http://superuser.com.
score: 1
type: Comment

jdbc
tags question: http://stackoverflow.com/q/25330493
tags question: http://stackoverflow.com/q/25298427
tags question: http://stackoverflow.com/q/25241953
tags question: http://stackoverflow.com/q/25259802
tags question: http://stackoverflow.com/q/25249224
tags question: http://stackoverflow.com/q/25238260
tags question: http://stackoverflow.com/q/25251577
tags question: http://stackoverflow.com/q/25263028
tags question: http://stackoverflow.com/q/25352393
tags question: http://stackoverflow.com/q/25332206
tags question: http://stackoverflow.com/q/25286088
tags question: http://stackoverflow.com/q/25348604
tags question: http://stackoverflow.com/q/25333102
tags question: http://stackoverflow.com/q/25360725
tags question: http://stackoverflow.com/q/25374325
tags question: http://stackoverflow.com/q/25324920
tags question: http://stackoverflow.com/q/25238228
tags question: http://stackoverflow.com/q/25387227
tags question: http://stackoverflow.com/q/25298526
tags question: http://stackoverflow.com/q/25277680
tags question: http://stackoverflow.com/q/25327822
tags question: http://stackoverflow.com/q/25378448
tags question: http://stackoverflow.com/q/25326661
tags question: http://stackoverflow.com/q/25234421
tags question: http://stackoverflow.com/q/25288764
tags question: http://stackoverflow.com/q/25247569
tags question: http://stackoverflow.com/q/25263013
tags question: http://stackoverflow.com/q/25372459
tags question: http://stackoverflow.com/q/25304085
tags question: http://stackoverflow.com/q/25351891
tags question: http://stackoverflow.com/q/25324331
tags question: http://stackoverflow.com/q/25359858
tags question: http://stackoverflow.com/q/25264460
tags question: http://stackoverflow.com/q/25260029
tags question: http://stackoverflow.com/q/25339134
type: Tag
tags question: http://stackoverflow.com/q/25373126
tags question: http://stackoverflow.com/q/25335813
tags question: http://stackoverflow.com/q/25365952
tags question: http://stackoverflow.com/q/25282056
tags question: http://stackoverflow.com/q/25365532
tags question: http://stackoverflow.com/q/25301593
tags question: http://stackoverflow.com/q/25303880
tags question: http://stackoverflow.com/q/25356260
tags question: http://stackoverflow.com/q/25307990
tags question: http://stackoverflow.com/q/25305568
tag name: jdbc
tags question: http://stackoverflow.com/q/25239413
tags question: http://stackoverflow.com/q/25280815
tags question: http://stackoverflow.com/q/25242002
tags question: http://stackoverflow.com/q/25368677
tags question: http://stackoverflow.com/q/25259195
tags question: http://stackoverflow.com/q/25257842
tags question: http://stackoverflow.com/q/25321724
tags question: http://stackoverflow.com/q/25317408
tags question: http://stackoverflow.com/q/25275090
tags question: http://stackoverflow.com/q/25312861
tags question: http://stackoverflow.com/q/25264168
tags question: http://stackoverflow.com/q/25370974
tags question: http://stackoverflow.com/q/25269865
tags question: http://stackoverflow.com/q/25373009
tags question: http://stackoverflow.com/q/25358141

recordreader
tags question: http://stackoverflow.com/q/25340373
tag name: recordreader
type: Tag

http://stackoverflow.com/q/25316058
answer count: 2
has title: Preventing the JVM from writing to System.out or reading from System.in
has comment: http://stackoverflow.com/comment/39462161
tagged with: java
tagged with: io
downvote count: 0
accepted answer: http://stackoverflow.com/a/25316202
possible better answer: http://stackoverflow.com/a/25316121
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/25316202
type: Question
has body: Is there a way under the JVM to (temporarily) prevent complete access to System.out, System.in and System.err ? After creating a blank policy which grants no permission at all, I want to execute some work in the function below. I would like calls to System.out.println and the like to fail, but they don't. Is there something I can do or am I being a little too much of a control freak ? EDIT #1: Following MrPixelDream's suggestion to use System.setOut, I am keeping the permissions to a minimum to make sure code within run() cannot also call System.setOut or fool around with java.io.FileDescriptor.out. EDIT #2: Also, since rogue code could have simply executed standardOutput.println, I prefered not to keep a reference to System.out around at all and set it back using java.io.FileDescriptor.out. // Create blank permissions that barely allow executing code java.security.Permissions perm = new java.security.Permissions(); // CodeSource domain for which these permissions apply (all files) java.security.CodeSource code = new java.security.CodeSource(new java.net.URL("file:/*"), null); // ProtectionDomain java.security.ProtectionDomain domain = new java.security.ProtectionDomain(code, perm); // AccessControlContext java.security.ProtectionDomain[] domains = new java.security.ProtectionDomain[1]; domains[0] = domain; java.security.AccessControlContext context = new java.security.AccessControlContext(domains); // DON'T keep reference to standard output, it could be used directly // PrintStream standardOut = System.out; // Redirect output to dummy stream System.setIn(new ByteArrayInputStream(new byte[0])); System.setOut(new PrintStream(new ByteArrayOutputStream())); System.setErr(new PrintStream(new ByteArrayOutputStream())); // Do an action, subject to the given security context java.security.AccessController.doPrivileged(new java.security.PrivilegedAction&lt;Void&gt;() { public Void run() { // Do some work, side effects and all, but no I/O whatsoever System.out.println("Will …
has comment: http://stackoverflow.com/comment/39461775
upvote count: 2
tagged with: permissions
has answer: http://stackoverflow.com/a/25316121
score: 2
tagged with: security
type: AnsweredQuestion

http://stackoverflow.com/q/25263629
type: AnsweredQuestion
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25263890
has body: I have this method to get an arrayList from a text file: private ArrayList&lt;String[]&gt; tempList(){ String temp = null; ArrayList&lt;String[]&gt; tempList = new ArrayList&lt;String[]&gt;(); try { BufferedReader bReader = new BufferedReader(new InputStreamReader(getAssets().open(getFilename()))); while ((temp = bReader.readLine()) !=null){ String[] value = temp.split(","); tempList.add(value); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return tempList; } The file has just letters separated by comma with no space or empty lines. The problem is that somehow the first letter of the list has a whitespace in front of it. All other letters are fine. here is the txt file which contains a local alphabet: Α,Β,Γ Δ,Ε,Ζ Η,Θ,Ι Κ,Λ,Μ Ν,Ξ,Ο Π,Ρ,Σ Τ,Υ,Φ Χ,Ψ,Ω Any idea what is wrong?
has comment: http://stackoverflow.com/comment/39363988
has title: Reading text file with bufferedReader adds a whitespace, android
type: Question
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/25264060
has answer: http://stackoverflow.com/a/25264060
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25263890
has comment: http://stackoverflow.com/comment/39364023

http://stackoverflow.com/a/25332641
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25332591
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39493425
answers question: http://stackoverflow.com/q/25332591
has comment: http://stackoverflow.com/comment/39493103
score: 2
has comment: http://stackoverflow.com/comment/39493134
type: AcceptedAnswer
has body: You can use CSS for this: driver.findElement(By.cssSelector("[data-field='carUnder20k']")).click(); Edit: For what you are describing in your comment, it may be that an xpath approach would work better: driver.findElement(By.xpath("//div[@data-field='carUnder20k' and text()='N']")).click();

http://stackoverflow.com/comment/39354165
comment on: http://stackoverflow.com/q/25251938
type: QuestionComment
score: 0
has text: If you don't show us what you've tried or where you got stuck, you may receive more downvotes.
type: Comment

http://stackoverflow.com/q/25304272
has title: java, bit operation, how to calculate the length back?
answer count: 2
type: UnansweredQuestion
has body: In a java programe, people store data in a byte array, and the first two byte were used to store the length of data, byte[] buffer = new byte[100000]; int size = data.getBytes().length; buffer[0] = (byte)((size &gt;&gt; 8 ) &amp; 0xff); buffer[1] = (byte)(size &amp; 0xff); now given value of buffer[0] and buffer[1], how to get size back?
tagged with: java
has answer: http://stackoverflow.com/a/25304316
duplicate of: http://stackoverflow.com/q/7619058
type: Question
has answer: http://stackoverflow.com/a/25304440
linked to: http://stackoverflow.com/q/7619058
score: 0

http://stackoverflow.com/comment/39555608
has text: What program are you trying to run?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25367402
score: 0

http://stackoverflow.com/q/25263013
tagged with: java
tagged with: sqlite
has comment: http://stackoverflow.com/comment/39363486
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25263398
favorite count: 0
type: Question
tagged with: resultset
accepted answer: http://stackoverflow.com/a/25263398
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39363012
has body: I want to update my ResultSet with using SQLite in Java. When i am trying to update the Resultset it is giving me an exception : java.sql.SQLException: not implemented by SQLite JDBC driver. i have also done : stmt = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); but still getting the exception, i think it is because we cannot update the result Set using SQLite DB. Please help that how can i update the Sqlite Resultset in java.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39362826
score: 1
has title: How to update ResultSet in Sqlite in Java
upvote count: 1

rest
tags question: http://stackoverflow.com/q/25321807
tags question: http://stackoverflow.com/q/25355232
tags question: http://stackoverflow.com/q/25284022
tags question: http://stackoverflow.com/q/25348940
tags question: http://stackoverflow.com/q/25287626
tags question: http://stackoverflow.com/q/25366767
tags question: http://stackoverflow.com/q/25387716
tags question: http://stackoverflow.com/q/25277566
tags question: http://stackoverflow.com/q/25240253
tags question: http://stackoverflow.com/q/25258652
tags question: http://stackoverflow.com/q/25294676
tags question: http://stackoverflow.com/q/25330700
tags question: http://stackoverflow.com/q/25234265
tags question: http://stackoverflow.com/q/25261263
tags question: http://stackoverflow.com/q/25236831
tags question: http://stackoverflow.com/q/25387576
tags question: http://stackoverflow.com/q/25265629
tags question: http://stackoverflow.com/q/25323613
tags question: http://stackoverflow.com/q/25247228
type: Tag
tags question: http://stackoverflow.com/q/25338829
tags question: http://stackoverflow.com/q/25377579
tags question: http://stackoverflow.com/q/25296899
tags question: http://stackoverflow.com/q/25377566
tags question: http://stackoverflow.com/q/25295447
tags question: http://stackoverflow.com/q/25272664
tags question: http://stackoverflow.com/q/25298409
tags question: http://stackoverflow.com/q/25345786
tags question: http://stackoverflow.com/q/25241019
tags question: http://stackoverflow.com/q/25263391
tags question: http://stackoverflow.com/q/25313255
tags question: http://stackoverflow.com/q/25287767
tags question: http://stackoverflow.com/q/25388915
tags question: http://stackoverflow.com/q/25301531
tags question: http://stackoverflow.com/q/25311472
tags question: http://stackoverflow.com/q/25251476
tags question: http://stackoverflow.com/q/25317064
tags question: http://stackoverflow.com/q/25257022
tag name: rest
tags question: http://stackoverflow.com/q/25237726
tags question: http://stackoverflow.com/q/25276085
tags question: http://stackoverflow.com/q/25250676
tags question: http://stackoverflow.com/q/25246274
tags question: http://stackoverflow.com/q/25296697
tags question: http://stackoverflow.com/q/25350732
tags question: http://stackoverflow.com/q/25267543
tags question: http://stackoverflow.com/q/25292356
tags question: http://stackoverflow.com/q/25250025
tags question: http://stackoverflow.com/q/25248014
tags question: http://stackoverflow.com/q/25301520

http://stackoverflow.com/q/25331750
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/64942274
type: AnsweredQuestion
upvote count: 3
has body: Hello I develop register screen in android and I need to get id from my database by entered username and password that stores database and make it as int.Firstly user will register then type name and pass and login up.In my database I have many raws like:id username password.I want to get id of entered username and password.For ex:id:1 username:A pass:a id:2, username:B pass:b.. and when user A entered his name and pass and login up i should get his id then make it int type if you dont something please leave comment thanks I tried to made attempt but i dont know is it rightand how to develop it: EditText name; String Username = name.getText().toString(); Cursor c = database.rawQuery("SELECT * FROM " +LOGIN_TABLE + " where username = '"+Username+"'", null); and in this code Login table is my table name?
has answer: http://stackoverflow.com/a/25331811
possible better answer: http://stackoverflow.com/a/25331811
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25334947
accepted answer: http://stackoverflow.com/a/25334947
type: Question
score: 2
answer count: 3
tagged with: sqlite
has comment: http://stackoverflow.com/comment/39491250
has title: Getting id from sqlite raw and make it integer type

http://stackoverflow.com/comment/39352180
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25256885
has text: Yeah, that's kind of the point, it doesn't suffer from decimal rounding issues...you just insert the point where you need it when you format at...
type: Comment

http://stackoverflow.com/q/25311104
type: Question
accepted answer: http://stackoverflow.com/a/25508582
has answer: http://stackoverflow.com/a/25508582
tagged with: soap
tagged with: web-services
tagged with: sharepoint
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: sharepoint-2010
has body: I'm developing a custom component in Java (1.7). This component needs to be able to Push and Pull a file to a SharePoint 2010 Server. I've successfully Pushed a file along with metadata to the Server. I've also successfully Pulled a file from the Server. Well I need to be able to search (query) the Server depending on different search criteria according to what the User feeds my component. I've been unable to successfully connect to the SPSearch Web Service. I get this error: "Error caught in main: javax.xml.ws.WebServiceException: {http://microsoft.com/webservices/SharePoint/QueryService}QueryServiceSoap is not a valid service. Valid services are: {http://schemas.microsoft.com/sharepoint/soap/}Lists " I've searched on Google endlessly and found some C# code that I was able to teach myself how I need to use the service, but it doesn't help me utilize the service successfully. I cannot find a good Java reference to utilize this web service. Any help or suggestions would be greatly appreciated. Thank you. (wsdl = SPURL/_vti_bin/spsearch.asmx?wsdl; endpoint = SPURL/_vti_bin/spsearch.asmx) Here's the Code: protected ListsSoap getListsSoap(String username, String password, String wsdl, String endpoint) throws Exception { System.out.println("Creating a ListsSoap instance..."); Lists service = new Lists(new URL(wsdl), new QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists")); ListsSoap port = service.getListsSoap(); BindingProvider bp = (BindingProvider) port; bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username); bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password); bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint); return port; } protected CopySoap getCopySoap(String username, String password, String wsdl, String endpoint) throws Exception { System.out.println("Creating a CopySoap instance..."); Copy service = new Copy(new URL(wsdl), new QName("http://schemas.microsoft.com/sharepoint/soap/", "C…
has title: Java using SharePoint 2010 Web Services - SPSearch.asmx

groovy
tags question: http://stackoverflow.com/q/25347470
tags question: http://stackoverflow.com/q/25275386
tags question: http://stackoverflow.com/q/25253893
tags question: http://stackoverflow.com/q/25294885
tags question: http://stackoverflow.com/q/25260558
tags question: http://stackoverflow.com/q/25341431
tags question: http://stackoverflow.com/q/25332812
tags question: http://stackoverflow.com/q/25290744
type: Tag
tags question: http://stackoverflow.com/q/25271852
tags question: http://stackoverflow.com/q/25329428
tags question: http://stackoverflow.com/q/25233327
tags question: http://stackoverflow.com/q/25290181
tags question: http://stackoverflow.com/q/25346185
tags question: http://stackoverflow.com/q/25300550
tags question: http://stackoverflow.com/q/25233002
tags question: http://stackoverflow.com/q/25289797
tags question: http://stackoverflow.com/q/25346753
tags question: http://stackoverflow.com/q/25251945
tag name: groovy

http://stackoverflow.com/a/25317019
downvote count: 0
upvote count: 1
has body: Example: 5 lines: 0 0 0 0 1 0 0 0 0 0 0 0 2 1 2 0 0 0 0 0 3 2 1 2 3 0 0 0 4 3 2 1 2 3 4 0 5 4 3 2 1 2 3 4 0 0 = white space You need a for loop that counts up to the given number and every time check which line you print. If the first line every char apart from the middle is a space. So you print 4 spaces - 1 - 4 spaces. Second line everything is space apart apart from the 3 middle chars and so on. See the pattern? Only the middle number is 1 which is always the n-th character where n is the number of lines.
answers question: http://stackoverflow.com/q/25316863
type: Answer
score: 1

http://stackoverflow.com/q/25368054
answer count: 1
has answer: http://stackoverflow.com/a/25368421
has comment: http://stackoverflow.com/comment/39556922
accepted answer: http://stackoverflow.com/a/25368421
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39556921
tagged with: multithreading
linked to: http://stackoverflow.com/q/7416018
downvote count: 0
upvote count: 1
has title: Does a ScheduledExecutorService stops creating new threads when the class's main thread finishes?
has comment: http://stackoverflow.com/comment/39556915
type: AnsweredQuestion
has body: Say you have a ScheduledExecutorService that is initialized in the main thread of the application and we add scheduled jobs to this service. If the main thread finishes, will the ScheduledExecutorService automatically cease creating new threads?
has comment: http://stackoverflow.com/comment/39557576
has comment: http://stackoverflow.com/comment/39560487
score: 1
has comment: http://stackoverflow.com/comment/39557178
tagged with: java

http://stackoverflow.com/comment/75991661
has text: @AllahbakshAsadullah yes its not working with version 1.5.1. What version did you use instead?
comment on: http://stackoverflow.com/a/30063268
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25348702
has comment: http://stackoverflow.com/comment/39520995
score: 0
has comment: http://stackoverflow.com/comment/39521032
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25348604
has comment: http://stackoverflow.com/comment/39520906
accepted answer of: http://stackoverflow.com/q/25348604
has body: IMHO, You have missed couple closing braces. I think you have to pay more attention to it. I'm learning Java now, so not really sure how it should looks like but I think this is a bit better: JButton submitter = new JButton("Submit Request"); submitter.setBounds(145, 204, 144, 23); contentPane.add(submitter); submitter.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { Connection connection = null; Statement insertStmt = null; { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3307/maintenance","root","password"); insertStmt = connection.createStatement(); insertStmt.executeUpdate("INSERT INTO submit (submit_request,loc_string) VALUES ('" + request.getText() + "','" + schools.getText() + "')"); } } }); try { insertStmt.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Submit frame = new Submit(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } } };
type: Answer
has comment: http://stackoverflow.com/comment/39521023

http://stackoverflow.com/comment/39475260
has text: and this on the line where @override is written: Syntax error, annotations are only available if source level is 1.5 or greater
type: QuestionComment
comment on: http://stackoverflow.com/q/25323379
type: Comment
score: 0

http://stackoverflow.com/comment/39455419
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25312562
type: QuestionComment
has text: Can you connect to the database normally from the machine?

http://stackoverflow.com/comment/39561407
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25370228
has text: try deleting 'all-wcprops' file in the .svn directory where your file is located and try to checkin the directory then

http://stackoverflow.com/a/25264018
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25263892
has body: System.out.println is a base Java way of printing out and does not tell the Dalvik VM to send it to the debugging device. You need to use android.util.log then you can use Log.w("myApp", "warning"); Log.e("myApp", "error"); Log.d("myApp", "debug"); //etc.
score: 1

http://stackoverflow.com/q/25260478
has answer: http://stackoverflow.com/a/25260603
score: 0
tagged with: sql
tagged with: java
has comment: http://stackoverflow.com/comment/39358511
tagged with: date
has comment: http://stackoverflow.com/comment/39358176
has title: subtracting two java.sql.timestamp give incorrect year
has answer: http://stackoverflow.com/a/25260697
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/25283213
has answer: http://stackoverflow.com/a/25268770
type: UnansweredQuestion
has body: I am trying to get timestamp form sql and need to calculate the difference between two time stamp. //startDate = 2014-07-10 16:07:00.0 //endDate = 2014-07-11 04:07:00.0 //END_DATE = 2014-07-18 08:07:00.0 private Timestamp calculateWflTime(String vehicleNum, Timestamp startDate, Timestamp endDate) { Timestamp t1 = new Timestamp (END_DATE.getTime()); //2014-07-18 08:07:00.0 Timestamp t2 = new Timestamp (startDate.getTime()); //2014-07-10 16:07:00.0 Timestamp wflTime = null; long diff=0; if(VEH_NUM == vehicleNum){ diff = t1.getTime()-t2.getTime();//diff(END_DATE,startDate); } wflTime = new Timestamp( Math.abs(diff/(1000*60*60*24))); return wflTime; //1970-01-01 05:30:00.007 }
tagged with: timestamp

http://stackoverflow.com/q/25353233
tagged with: build
score: 0
has title: eclipse java project .class path reference ssue
has comment: http://stackoverflow.com/comment/39529156
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39529274
has comment: http://stackoverflow.com/comment/39529574
answer count: 0
has comment: http://stackoverflow.com/comment/39529219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39529919
has body: I imported a javaFX project to eclipse Helios. It is throwing out the below error. "The project was not built since its build path is incomplete. Cannot find the class file for java.util.function.Function" I had tried all the possible solutions like Restarting eclipse Cleaning the project Uninstalling all other jres except jre1.8 as javafx is supported only by jre 1.8 Removing and adding jre 1.8 removing the unnecessary lines from .classpath Still the same error is seen in my eclipse. Could somebody help me out in resolving this Thank you
type: Question

http://stackoverflow.com/comment/39312652
score: 0
type: Comment
type: QuestionComment
has text: But why when I add a period (.) at the end of sentence, the result not like what I expecting (to print "NO" word)
comment on: http://stackoverflow.com/q/25235854

http://stackoverflow.com/comment/39590682
comment on: http://stackoverflow.com/q/25385905
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2808535/round-a-double-to-2-decimal-places
score: 0

struts2
tags question: http://stackoverflow.com/q/25312267
tags question: http://stackoverflow.com/q/25292034
tags question: http://stackoverflow.com/q/25239945
tags question: http://stackoverflow.com/q/25348546
tags question: http://stackoverflow.com/q/25374356
tags question: http://stackoverflow.com/q/25270315
tags question: http://stackoverflow.com/q/25256953
tags question: http://stackoverflow.com/q/25364050
tags question: http://stackoverflow.com/q/25307990
tags question: http://stackoverflow.com/q/25315354
tags question: http://stackoverflow.com/q/25246529
tags question: http://stackoverflow.com/q/25237685
tags question: http://stackoverflow.com/q/25296554
tags question: http://stackoverflow.com/q/25343558
tags question: http://stackoverflow.com/q/25373228
tags question: http://stackoverflow.com/q/25385917
tag name: struts2
tags question: http://stackoverflow.com/q/25345841
tags question: http://stackoverflow.com/q/25357899
type: Tag
tags question: http://stackoverflow.com/q/25295189
tags question: http://stackoverflow.com/q/25294312
tags question: http://stackoverflow.com/q/25260763

http://stackoverflow.com/comment/39348141
score: 0
type: Comment
has text: @tecnomage, I had asked it, because as you know, each thing in Windows SO have yours specific functions for interception and manipulation of messages, like for `Mouse=>MOUSEHOOKSTRUCT and LowLevelMouseProc`, and for `Keyborad=> KBDLLHOOKSTRUCT and LowLevelKeyboardProc` see these example(http://www.oschina.net/code/piece_full?code=9277) :). But and now; and similar functions for usb device? a simple `MSG lParam` varible as one of parameters into `public LRESULT callback` method? you understood this my logic?
type: QuestionComment
comment on: http://stackoverflow.com/q/25246353

http://stackoverflow.com/q/25236201
answer count: 1
has comment: http://stackoverflow.com/comment/39313239
type: Question
has comment: http://stackoverflow.com/comment/39313199
has comment: http://stackoverflow.com/comment/39313512
type: UnansweredQuestion
has title: Replatforming Swing Application to web application?
tagged with: php
has body: I have a fairly large Java application in production (30k lines of code). It uses a decent sized library of business objects I wrote in Java and I have a Swing interface thrown on top of it. However,it functions as a standalone desktop application currently with no server-side at all (except for a MySQL database and some text files housing central data). As data volume and calculation needs increase, this is becoming a problem running on just a quad core workstation with five threads and 4GB of RAM. I'm thinking of going the modern route and create a web based application using PHP, HTML, CSS, Javascript, etc. However, I don't want to rewrite my Java business object libraries from scratch in PHP (and I dont like the loose type style of PHP). I'd prefer to keep everything in Java so I can use my current business object library. That way I only have to scrap the Swing interface and serve up dynamic web pages instead, and have a Java server use the current business object libraries to calculate everything. I've done research but I dont know what I'm looking for as there seems to be several disparate options. Does Apache have a Java web server solution or something that accomplishes this? What is the best way to transform a Java application into a web application?
score: 0
has answer: http://stackoverflow.com/a/29315128
tagged with: java

http://stackoverflow.com/comment/39325043
has text: But when I submit using a jsp page to Servlet, it is fetching correctly users[0].name
type: AnswerComment
comment on: http://stackoverflow.com/a/25242702
score: 0
type: Comment

http://stackoverflow.com/comment/69645001
comment on: http://stackoverflow.com/q/25350579
score: 0
type: Comment
type: QuestionComment
has text: do you find the reason? I have the same problem.

http://stackoverflow.com/a/25764574
has body: I had the same problem with a dummy SoapHandler implementation. (same call order with your log: getHeaders, handleMessage, close, Exception). Turns out my problem was returning false from handleMessage method. Documentation states: "Return true to continue processing." http://docs.oracle.com/javase/6/docs/api/javax/xml/ws/handler/Handler.html
type: Answer
has comment: http://stackoverflow.com/comment/104382597
answers question: http://stackoverflow.com/q/25320390
downvote count: 0
upvote count: 8
score: 8

http://stackoverflow.com/q/25386065
tagged with: regex
has title: regex strip off words from line - proceeded by java
accepted answer: http://stackoverflow.com/a/25386112
has answer: http://stackoverflow.com/a/25386112
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
answer count: 1
favorite count: 0
type: Question
has body: Im trying to strip off one word from line my backend is java I did the following. Example line: TICKET0041960 Fix code at css I want to strip off TICKET0041960 so the result will be Fix code at css I used this TICKET[.0-9] and I ended up with result as 041960 Fix code at css Any tips to adjust regex to strip off TICKET0041960 consider numbers always random
tagged with: java

http://stackoverflow.com/q/25272433
possible better answer: http://stackoverflow.com/a/25289868
has comment: http://stackoverflow.com/comment/39380990
has title: Creating an Array of String[] from Notes Multivalue fileds
accepted answer: http://stackoverflow.com/a/25272517
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25272517
score: 0
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/25289868
tagged with: xpages
type: Question
has body: I am creating a JAVA method that returns an array of Strings, my method looks like this: public String[] getReaders(String linkKey){ ... String[] rtn = {thisDoc.getItemValue("WFSOriginator")[0] , thisDoc.getItemValue("WFSReadDraftName")}; return rtn; } Now the field WFSOriginator is a single value field so I can just get the first value in the getItemValue, however, WFSReadDraftName may be null, a single value or have multiple names in it. I get the error that can't convert the vector to string. So do I have to iterate through the values in WFSReadDraftName and store them in an array first? Also, is there an easy way to make the array. I could iterate through the list and put them into a hashMap to ensure uniqueness, but that seems a bit of overkill.
tagged with: java

http://stackoverflow.com/a/25247905
accepted answer of: http://stackoverflow.com/q/25247808
has comment: http://stackoverflow.com/comment/39336923
score: 0
answers question: http://stackoverflow.com/q/25247808
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39336813
has comment: http://stackoverflow.com/comment/39336686
has comment: http://stackoverflow.com/comment/39335188
has body: I am assuming that you only want to use the number.If you want to use the rest of the please update your post and i will update the answer. So only for the numbers, you can do the following: Scanner in = new Scanner(new FileInputStream("Avar.txt")); while(in.hasNextLine){ Scanner lineScanner = new Scanner(in.nextLine()); if(lineScanner.hasNextInt()){ int x = lineScanner.nextInt(); // do something with x } } This will read you input line by line. For every line, if the line starts with an int ( a line starting with "£01" does not start with an int) then that int will be stored in the variable x. After that you can do w/e. If you want them all you can pass them in an Array etc... BufferedReader Version: BufferedReader file = new BufferedReader(new FileReader("Avar.txt")); String line; while((line = file.readLine()) != null){ if(line.charAt(0) &gt;= 48 &amp;&amp; line.charAt(0) &lt;= 57 ){ String number = line.substring(0, 2); int x = Integer.valueOf(number); //do something with x } } file.close(); Same logic as the Scanner version. Hope this helps
has comment: http://stackoverflow.com/comment/39336439
type: Answer
has comment: http://stackoverflow.com/comment/39335283

http://stackoverflow.com/q/25271799
has comment: http://stackoverflow.com/comment/39381139
type: Question
tagged with: zlib
answer count: 0
type: UnansweredQuestion
has title: Example code for java.util.zip.Deflater that uses batch modes for both input and output
has comment: http://stackoverflow.com/comment/39382551
has body: The example code in the javadoc for java.util.zip.Deflater is too optimistic, and assumes that you have a byte array containing all input, and a byte array that is large enough for the output. >:( Is there an example somewhere that calls both needsInput() to add input in batches, and finished() to get output in batches? I can't seem to find one, and the docs are a little hazy about what is the right order of operations. Example: I have a ByteBuffer that is a 100MB memory-mapped file I'm writing the output to a stream I have a these byte arrays of length 1024 for batches of input and output: byte[] inbatch = new byte[1024]; byte[] outbatch = new byte[1024]; It seems like something like this might work, but I'm not sure, and I suspect there may be some subtle edge cases... Deflater deflater = ...; byte[] inbatch = new byte[1024]; byte[] outbatch = new byte[1024]; boolean inputDone = false; while (true) { if (!inputDone &amp;&amp; deflater.needsInput()) { int n = get_more_input(..., inbatch); if (n == 0) inputDone = true; else deflater.setInput(inbatch, 0, n); } if (deflater.finished() { if (inputDone) break; } else { int n = deflater.deflate(outbatch); handle_output(outbatch, n); } }
score: 0
tagged with: java

http://stackoverflow.com/comment/39554694
score: 0
has text: Your `String myRegexp` doesn't compile.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25366896

http://stackoverflow.com/q/25245052
has title: Edit shapes in java3d
has comment: http://stackoverflow.com/comment/39329894
answer count: 0
score: 1
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/39329669
type: Question
tagged with: 3d
type: UnansweredQuestion
has body: I want to know if it is possible to edit a shape (for e.g. Cube) in runtime? Like I have a Cube drawn and i have to edit it in runtime, for e.g. change the height, width or depth of the cube. Please let me know if such a thing is possible Thanks
downvote count: 0
upvote count: 1
tagged with: swing
tagged with: java-3d

parseexception
tags question: http://stackoverflow.com/q/25307819
tag name: parseexception
type: Tag

http://stackoverflow.com/q/25326638
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39485262
score: 0
answer count: 3
tagged with: java
tagged with: swing
tagged with: jtextfield
has body: I have this code (this is all code). I want to write file path(choosing file) on JTextField. I run the program and i press button and file chooser open, i choose file but file path not write on JTextField. import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; import org.dyno.visual.swing.layouts.Bilateral; import org.dyno.visual.swing.layouts.Constraints; import org.dyno.visual.swing.layouts.GroupLayout; import org.dyno.visual.swing.layouts.Leading; //VS4E -- DO NOT REMOVE THIS LINE! public class xailabsPanel extends JFrame { private static final long serialVersionUID = 1L; private JButton jButton0; public static String path; private JTextField jTextField0; private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel"; public xailabsPanel() { initComponents(); } private void initComponents() { setLayout(new GroupLayout()); add(getJText(), new Constraints(new Bilateral(12, 12, 4), new Leading(100, 10, 10))); add(getJButton0(), new Constraints(new Bilateral(117, 117, 94), new Leading(57, 12, 12))); setSize(328, 252); } private JButton getJButton0() { if (jButton0 == null) { jButton0 = new JButton(); jButton0.setText("jButton0"); jButton0.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton0MouseMouseClicked(event); } }); } return jButton0; } private JTextField getJText() { if (jTextField0 == null) { jTextField0 = new JTextField(); } return jTextField0; } private static void installLnF() { try { String lnfClassname = PREFERRED_LOOK_AND_FEEL; if (lnfClassname == null) lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName(); UIManager.setLookAndFeel(lnfClassname); } catch (Exception e) { System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL…
tagged with: jfilechooser
has title: Choosing file path not seen on JTextField in Ubuntu on Eclipse
type: Question
has answer: http://stackoverflow.com/a/25327722
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25326757
has answer: http://stackoverflow.com/a/25327709

http://stackoverflow.com/comment/39386314
comment on: http://stackoverflow.com/a/25275281
score: 0
type: Comment
type: AnswerComment
has text: The issue i'm having is in the return type of `op.process(mapper);` that should depend on the `mapper` and not on `Op`. But if i do use `Op<?> op = new Op1();` it works as intended, my question is mainly why that happens?

http://stackoverflow.com/comment/39497547
comment on: http://stackoverflow.com/a/25334835
type: AnswerComment
has text: I read over your answer but I am confused where I would go with the implementation. Would I use similar code as I did in my adapter in the store method-- creating a SharedPreference, putting the boolean in for the item? And I guess I would use the getBoolean method in retrieve method? Im having trouble understanding what would go in parse the gson from shared preferences, create the lastInstalledApp list. Would GSON be best approach. Because I may need all the key values of checked boxes. I appreciate your help and apologize for the questions. I guess little more explanation is necessary.
score: 0
type: Comment

http://stackoverflow.com/a/25305840
answers question: http://stackoverflow.com/q/25305697
has body: class Boolean { public Boolean(Object object) { } public Boolean() { } public static void main(String s[]) { Boolean c = new Boolean(null); Boolean d = new Boolean("null"); Boolean e = new Boolean("TRue"); Boolean f = new Boolean("TRue"); Boolean g = new Boolean(true); Boolean h = new Boolean(); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); System.out.println(g); System.out.println(h); } } try this
type: Answer
score: 0

http://stackoverflow.com/a/38982476
downvote count: 1
answers question: http://stackoverflow.com/q/25352329
type: Answer
score: -1
has body: Better try assertThat with matchers. Check this blog about it https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; .... @Test public void testNum() { assertThat(repo.getNum(), is(equalTo(111))); }
upvote count: 0

http://stackoverflow.com/q/25357166
score: 0
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25359635
accepted answer: http://stackoverflow.com/a/25359635
possible better answer: http://stackoverflow.com/a/25357243
type: Question
has body: i am working on a GWT project , and i want to use another javascript project that written in javascript . at this moment i refer to its javascript libs in this maner : &lt;script type="text/javascript" src="http://192.168.10.100:7001/mapviewer/fsmc/jslib/oraclemaps.js"&gt;&lt;/script&gt; for some reason i want to use a dynamic Ip (i do not hard code it in my main page); i copied javascript in my project but as you see it is deployed on weblogic app server and it does not work correct when i copy that javascript in my project; how can i do this. please help me thanks in advanced
has title: how to pass references to javascript links in main page in gwt main page
tagged with: javascript
has answer: http://stackoverflow.com/a/25357243
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/q/25259007
tagged with: java
has answer: http://stackoverflow.com/a/25259945
has comment: http://stackoverflow.com/comment/39356846
has body: I am trying to remove the last line of a CVS file, to do so I need to rename / delete my input file, I tried several things, but I can't get it to work, this is what I got now: File inputFile = new File((file.getParent() + "/ExportLijst " + dateFormat.format(date) + ".csv")); inputFile.setWritable(true, true); File f = (inputFile); if (!f.exists()) throw new IllegalArgumentException( "Delete: no such file or directory: " + inputFile); if (!f.canWrite()) throw new IllegalArgumentException("Delete: write protected: " + inputFile); if (f.isDirectory()) { String[] files = f.list(); if (files.length &gt; 0) throw new IllegalArgumentException( "Delete: directory not empty: " + inputFile); } boolean success = f.renameTo(removeFile); if (!success) throw new IllegalArgumentException("Delete: deletion failed"); I also tried this, with no result: public void forceRename(File source, File target) throws IOException { if (target.exists()) target.delete(); source.renameTo(target); }
type: AnsweredQuestion
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39356946
type: Question
has title: Can't remove or rename file
tagged with: delete-file
accepted answer: http://stackoverflow.com/a/25259945

http://stackoverflow.com/comment/39334155
has text: the first approch seems to be good
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25247134

http://stackoverflow.com/comment/81363220
comment on: http://stackoverflow.com/a/25239167
type: Comment
score: 0
type: AnswerComment
has text: It wasn't going to be convincing, I do not express my opinion as if it was the only and ultimate truth ;). In fact, there *are* APIs to achieve that despite your arguments - both guava and eclipse collections provide methods for that. I just don't think that this answer should be marked as accepted as it provides ungrounded theoretizing instead of the real answer which people are looking for.

http://stackoverflow.com/comment/39537117
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25357666
type: QuestionComment
has text: ... So what are you trying to do? Also, take a [tour].

http://stackoverflow.com/comment/39479942
type: AnswerComment
comment on: http://stackoverflow.com/a/25325605
has text: The questioner may not need a multi-thead process to do what he wants to do .. if having his program "pause" for some number of seconds does not create a "user experience" problem. See alternative answer below.
score: 0
type: Comment

http://stackoverflow.com/comment/39325674
score: 0
comment on: http://stackoverflow.com/a/25242527
type: Comment
type: AnswerComment
has text: No, that's not the problem, because none of the two ` ` are even renderized (I looked at source code of the page, and this two blocks aren't displayed there either). I fit was a problem with the style, at least one block should be displayed (only one is hidden). BTW, the problem is with the block ` ` and ` `.

point
type: Tag
tag name: point
tags question: http://stackoverflow.com/q/25288273

aes
tag name: aes
tags question: http://stackoverflow.com/q/25297681
type: Tag
tags question: http://stackoverflow.com/q/25345075
tags question: http://stackoverflow.com/q/25284279

http://stackoverflow.com/comment/39436068
has text: Thank you. I found where "getXml" snapped. I removed the "try-catch" statement and now I can acces my string; it's very odd.
comment on: http://stackoverflow.com/a/25281246
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25257232
type: Question
upvote count: 0
type: UnansweredQuestion
score: -2
tagged with: asyncsocket
tagged with: c++
has comment: http://stackoverflow.com/comment/39352715
has title: sending tcp data from c++ and receive to java socket
tagged with: serversocket
tagged with: java
downvote count: 2
answer count: 1
has body: I am creating an application using visual c++ which will communicate with java server using tcp. how can I do this using socket programming.
has answer: http://stackoverflow.com/a/25257290
favorite count: 0

http://stackoverflow.com/q/25241895
downvote count: 0
type: UnansweredQuestion
has title: issue - creating a directory with gradle not working
answer count: 1
has answer: http://stackoverflow.com/a/25243248
score: 4
tagged with: java
has body: I have the following build.gradle: task wrapper(type: Wrapper) { gradleVersion = '2.0' } apply plugin: 'java' task filter(type: Copy) { def subdir = new File(project.buildDir, "subdir") println("subdir: "+subdir) if( !subdir.exists() ) { println("creating subdir") if(subdir.mkdirs()) { println("succeeded in making folder") if(subdir.exists()) { println("folder exists") } else { println("folder does not exist") } } else { println("failed to make folder") } } else { println("folder exists already") } } After downloading the wrapper using gradle wrapper I then run: /tmp/test $ ./gradlew clean filter subdir: /tmp/test/build/subdir creating subdir succeeded in making folder folder exists :clean :filter UP-TO-DATE BUILD SUCCESSFUL Total time: 4.121 secs Which seems to indicate everything went okay. However, when I double check I get this: /tmp/test $ ls -l /tmp/test/build/subdir ls: /tmp/test/build/subdir: No such file or directory Notes: This is on MacOS Mavericks. The executing user is able to create the directory at the shell. There is sufficient disk space. Please advise what I might be doing wrong here with Gradle that fails to create the directory, but that Gradle indicates it was successful? Any troubleshooting tips would be appreciated. Thanks!
has comment: http://stackoverflow.com/comment/39351979
tagged with: shell
tagged with: gradle
favorite count: 0
upvote count: 4
type: Question
has comment: http://stackoverflow.com/comment/43980188

http://stackoverflow.com/q/25252558
tagged with: java
tagged with: javafx
upvote count: 10
has answer: http://stackoverflow.com/a/25252616
downvote count: 1
favorite count: 0
type: Question
score: 9
has answer: http://stackoverflow.com/a/50672660
accepted answer: http://stackoverflow.com/a/25252616
has body: Sorry if this seems a little too easy, I'm brand new to JavaFX, this is my first little app built with it. I am trying to make a bare bones chat client. I am using the JavaFX Scene builder to make the client UI, and a controller class connected to the FXML. How can I make is so that the current text of in the text area is submitted to the server and the text area is cleared upon the enter key press, instead of using some kind of "send" button? EDIT: Here is the code that is not working: //... public class FXMLDocumentController { //... @FXML private TextArea messageBox; //... messageBox.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent keyEvent) { if(keyEvent.getCode() == KeyCode.ENTER) { //sendMessage(); } } }); //...
tagged with: chat
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36486026
possible better answer: http://stackoverflow.com/a/36486026
answer count: 3
has title: JavaFX: How to make enter key submit TextArea

http://stackoverflow.com/comment/39490697
type: QuestionComment
has text: @Steven It's throwing the exception while trying to access $Recycle.Bin, which is a hidden Windows system folder. From what I can tell it can't be accessed normally as it is protected: http://superuser.com/questions/697966/windows-cant-delete-folder-from-recycle-bin-and-it-wont-restore
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25328867

http://stackoverflow.com/a/25267776
has comment: http://stackoverflow.com/comment/39375674
score: 0
answers question: http://stackoverflow.com/q/25255433
type: Answer
has body: For some unknown reason, the problem just went away. I have no idea how, but it's no longer happening and the app starts up just fine. Probably a weird unreproducible Eclipse bug; I hate it when that happens.

http://stackoverflow.com/comment/81374122
has text: @skwisgaar The question was about standard libraries, my answer was correct (no such method) and it contains a correct explanation of why it makes no sense (and why there's a special case for singletons). Are you sure that Guava and/or Eclipse libraries contain special methods for building mutable singleton lists? I think you are not correct - they don't (but didn't check, so you can prove me wrong; I think Eclipse collections has singleton lists which are mutable, but have fixed size, and this is clearly not what OP was asking about)
comment on: http://stackoverflow.com/a/25239167
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25254055
has comment: http://stackoverflow.com/comment/39347992
has body: I have an entity representing a person and it has a java.util.Date dateOfBirth field. When someone sends us this entity to insert or update, we want to ignore the timezone of the date: Even if you're visiting Japan, your date of birth is the same as when you're in New York, right? The problem is, when the Date comes in externally, Java is interpreting the date to be in our timezone. So if someone sends it from a different timezone, the date may shifted back or forward by a day. There are ways of dealing with this in Java code (it always makes my head hurt), but I was hoping there's a way that JPA/eclipselink could make my life easier somehow. Perhaps there's a way to tell it to ignore timezones and the time component, even if the actual java class has these fields set? If JPA supports this, how do I use it? If JPA doesn't support this, what's a general strategy I can use to resolve this issue?
tagged with: java
tagged with: datetime
answer count: 1
tagged with: jaxb
tagged with: date
has comment: http://stackoverflow.com/comment/39361558
type: Question
has title: In JPA, is there a way to ignore timezones on a date?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39349114
has comment: http://stackoverflow.com/comment/39357057
has comment: http://stackoverflow.com/comment/39349276
score: 0
has comment: http://stackoverflow.com/comment/39376949
has answer: http://stackoverflow.com/a/25303185

http://stackoverflow.com/q/25302186
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25302464
has title: Updating an Object from different threads
has comment: http://stackoverflow.com/comment/39435808
has body: I am calling 4 threads separately at the same time. These threads are making http calls and are fetching data from separate links. Now, I created a class, instantiated a single object of that class for accessing the data. All four threads are accessing the data simultaneously. Now the problem is, the data is not stored in a synchronized manner . One threads data is being replaced by another data. How to prevent this? How to do it in synchronized manner? Any ideas? Please help.
score: 0
tagged with: java
answer count: 2
tagged with: multithreading
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/25302377
tagged with: synchronize
tagged with: android

http://stackoverflow.com/q/25347957
tagged with: java
has body: i have written a web server in java. It is so simple and its job is to answer http requests on 8181 port. Let's have a look on code: public void start() throws IOException { ServerSocket listener = new ServerSocket(8181,1000); System.out.println("Webserver starting up on port 8181"); System.out.println("Waiting for connection"); //==========================regex String pathRegex = "(?<=GET /).+?(?= HTTP)"; Pattern pathPattern = Pattern.compile(pathRegex); //==========================/regex try { while (true) { Socket socket = listener.accept(); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String requestHeaders = in.readLine(); Matcher pathMatcher = pathPattern.matcher(requestHeaders); Boolean anyPath = pathMatcher.find(); System.out.println("Connection, sending data to request : " + requestHeaders); try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); if (!anyPath) { JustHello(out); } else { String directory = pathMatcher.group(); System.out.println(directory); if (directory.toString().equals("pic")) { JustPic(out); } } } finally { socket.close(); } } } finally { listener.close(); } } private void JustHello(PrintWriter out) { // TODO Auto-generated method stub out.println("HTTP/1.0 200 OK"); out.println("Content-Type: text/html"); out.println("Server: Bot"); // this blank line signals the end of the headers out.println(""); out.flush(); // Send the HTML page out.print(" \n \n \n Just Hello \n \n \n \nHello World\n \n "); out.flush(); } private void JustPic(PrintWriter out) { // TODO Auto-generated method stub out.println("HTTP/1.0 200 OK"); out.println("Content-Type: text/html"); out.println("Server: Bot"); // this blank line signals the end of the headers out.println(""); out.flush(); // Send the HTML page out.print(" \n \n \n Just Hello \n \n \n \n \n \n "); out.flush(); } now the problem is that, the path of the file is ok but it does't work. after loading the page with this "http://localhost:8181/pi…
tagged with: webserver
has comment: http://stackoverflow.com/comment/39519727
has comment: http://stackoverflow.com/comment/39519972
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25352192
has title: java web server src doesn't work
has answer: http://stackoverflow.com/a/25352192
linked to: http://stackoverflow.com/q/4908171
possible better answer: http://stackoverflow.com/a/25348108
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25348108
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/192080
score: 1

http://stackoverflow.com/comment/39345389
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25237020
has text: any clue? please help

http://stackoverflow.com/comment/39343960
type: AnswerComment
has text: I added the import. I'm using Fragment, maybe it's something else?
comment on: http://stackoverflow.com/a/25251935
type: Comment
score: 0

http://stackoverflow.com/a/25270874
has body: When I was learning to build 2D games I used star-assault for an example. You can find their github repository here: https://github.com/chrismorales/2d-sidescroller &amp;&amp; https://github.com/chrismorales/2d-sidescroller/blob/master/star-assault/src/net/obviam/starassault/view/WorldRenderer.java should be useful to look at.
score: 0
answers question: http://stackoverflow.com/q/25264017
type: Answer

http://stackoverflow.com/comment/39931320
score: 0
has text: I shall add that I made two function calls in a C++ DLL project to call my java methods. Then call those two C++ functions resided in the DLL in a C++ console application. C++ console application will successfully create a JVM call function #1, but output failed to create JVM when calling function #2.
comment on: http://stackoverflow.com/a/25374412
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39615392
type: Comment
comment on: http://stackoverflow.com/a/25385435
type: AnswerComment
has text: This means that I have to import my project there once again ?
score: 0

http://stackoverflow.com/q/25349418
type: UnansweredQuestion
tagged with: regex
has title: match ASCII characters except alphanumeric
has comment: http://stackoverflow.com/comment/39522360
has body: I have a question that come to my mind when I answered this post to match ASCII characters except alphanumeric. This is what I have tried but it's not correct. (?=[\x00-\x7F])[^a-zA-Z0-9] regex101 demo I am not looking for solution, just want to know, where I am wrong. What is the meaning of this regex pattern? Thanks As per my understanding (?=[\x00-\x7F]) is used to check for ASCII character and [^a-zA-Z0-9] is used to exclude alphanumeric character. So finally it will match any ASCII character except alphanumeric. Am I right?
has comment: http://stackoverflow.com/comment/39522389
has comment: http://stackoverflow.com/comment/39522331
downvote count: 0
has comment: http://stackoverflow.com/comment/39522319
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/39522825
has comment: http://stackoverflow.com/comment/39522629
answer count: 1
has answer: http://stackoverflow.com/a/25357012
favorite count: 0
has comment: http://stackoverflow.com/comment/39522369
has comment: http://stackoverflow.com/comment/39522992
type: Question
linked to: http://stackoverflow.com/q/25349213
tagged with: java

http://stackoverflow.com/comment/39576618
type: AnswerComment
has text: Thanks for the information. Turns out WMQ does not have support for JMS 2.0. WMQ version 8.0 has that support
score: 0
comment on: http://stackoverflow.com/a/25302451
type: Comment

http://stackoverflow.com/q/25329457
has comment: http://stackoverflow.com/comment/39487076
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/39486855
has answer: http://stackoverflow.com/a/25329700
accepted answer: http://stackoverflow.com/a/25329700
type: AnsweredQuestion
has body: I'm using https://github.com/umano/AndroidSlidingUpPanel. It works great, but I'm trying to figure out some way to listen for a sliding up/down event. I didn't really see anything relating to that in the README. file.xml: <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" sothree:fadeColor="@android:color/transparent" sothree:panelHeight="30dp" sothree:shadowHeight="4dp"> <ImageView android:id="@+id/sliderImage" android:layout_width="match_parent" android:layout_height="20dp" android:src="@drawable/slide_up" android:gravity="center|top" /> </com.sothree.slidinguppanel.SlidingUpPanelLayout> someJava.java: SlidingUpPanelLayout slider = (SlidingUpPanelLayout)findViewById(R.id.sliding_layout); ImageView sliderImage = (ImageView)findViewById(R.id.sliderImage); /* slider.setOnSomethingListenerIdk(new SomeSortOfOnSomethingListener(){ @Override public boolean onSomething(View view, SomeEvent someEvent) { if (view.isUpOrSomething) sliderImage.setImageResource(R.drawable.slide_down); else sliderImage.setImageResource(R.drawable.slide_up); } });*/ So basically I have an image of an arrowhead that I want to change when the bottom panel slides up or down. I am unable to figure out how to do this.
tagged with: slider
tagged with: java
tagged with: events
tagged with: panel
favorite count: 0
type: Question
has title: Android SlidingUpPanelLayout slide up event
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/a/27152613
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25363884
downvote count: 0
has body: Did you consider variant to change design of your classes and use composition instead of inheritance ? Then you will be able to just mock / spy instance of class A and inject it to instance of class B. In such case you will be able to configure whatever behavior that you need. I really not sure doCallRealMethod() will make trick for you, cause you have option to mock method or invoke real one, but not both simultaneously.
type: Answer

http://stackoverflow.com/a/25386767
answers question: http://stackoverflow.com/q/25386661
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39592437
has body: I think you want to initialize the List with an object in it: Try using an instance block, like this: List&lt;String&gt; list = new ArrayList&lt;String&gt;() {{ add("Egg"); }};
has comment: http://stackoverflow.com/comment/39592408
upvote count: 0
downvote count: 1

http://stackoverflow.com/comment/39464869
type: Comment
has text: Related - http://stackoverflow.com/questions/1262239/natural-sort-order-string-comparison-in-java-is-one-built-in
type: QuestionComment
comment on: http://stackoverflow.com/q/25317877
score: 0

http://stackoverflow.com/q/25363408
has comment: http://stackoverflow.com/comment/39547749
has body: I am trying to set the maximum capacity of my JList to 5 elements. I can only seem to find a way of setting the minimum using .capacity(). Is there anyway of setting the maximum to 5 and for a dialogue box to be displayed when it exceeds this limit? So far I have this: String getProcessName = ""; getProcessName = jTextField1.getText(); if (info.size() &gt;= 5) { JOptionPane.showMessageDialog(null,"5 elements reached"); } else { info.addElement(getProcessName); } This displays an error message but still adds the next value on to this list. Any suggestions?
type: Question
upvote count: 2
has title: Set the maximum capacity of JList?
tagged with: jlist
answer count: 2
has comment: http://stackoverflow.com/comment/39547680
possible better answer: http://stackoverflow.com/a/25363516
score: 2
type: AnsweredQuestion
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25363516
tagged with: swingx
accepted answer: http://stackoverflow.com/a/25363503
favorite count: 0
has answer: http://stackoverflow.com/a/25363503

http://stackoverflow.com/q/25295137
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39422588
has comment: http://stackoverflow.com/comment/39422627
has answer: http://stackoverflow.com/a/25295250
possible better answer: http://stackoverflow.com/a/25295243
tagged with: swing
has answer: http://stackoverflow.com/a/25295243
type: AnsweredQuestion
has title: Efficienctly convert List<Object> to Object[][]
has comment: http://stackoverflow.com/comment/39422722
answer count: 3
has body: I currently have a List of Student objects that I need to convert to Object[][] so that I can append the data into my JTable in GUI, I'm kind of lost as to how to do it in an efficient/dynamic manner. I don't have anything written down to post here, I can give you the details of the data: List&lt;Student&gt; myStudents = new ArrayList&lt;&gt;(); Needs to somehow be morphed to: Object[][] data = {{...}}; Each student has 11 fields to be added, so it would go to Object[i][0 .. 10] The alternative to all of this, is to somehow find a way to pass List&lt;Student&gt; inside new JTable(data, columnNames) instead of Object[][] Either or would solve this issue
has comment: http://stackoverflow.com/comment/39422714
tagged with: java
accepted answer: http://stackoverflow.com/a/25295470
has comment: http://stackoverflow.com/comment/39422732
has comment: http://stackoverflow.com/comment/39422584
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39422658
score: 1
has answer: http://stackoverflow.com/a/25295470

http://stackoverflow.com/comment/39459199
has text: In your jsp just add one more hidden variable as counter and set value as for the first time 0 (you can set this value from your method dont hardcode as 0), now click on tomorrow button and pass this value to your method and there change this code `today = today.plusDays(1);` to `today = today.plusDays(counter);` and add one more line as `counter++;` and set this counter again so that jsp page the value will come 2 ,
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25314292
score: 0

http://stackoverflow.com/a/25372322
answers question: http://stackoverflow.com/q/25372167
downvote count: 0
score: 3
upvote count: 3
type: Answer
has body: If you mean you want the active worksheet, there is a getActiveSheetIndex() method in the Workbook class, so you might be able to combine that with getSheetName() String worksheetName = workbook.getSheetName(workbook.getActiveSheetIndex()); Unless you want the actual path to the workbook (xls) open in Excel that is calling the java program, then you'd likely want to pass in the name of the workbook file as a parameter to your java executable. Ex. in VB: Application.ActiveWorkbook.Path will get you the active workbook path. My VB is a bit rusty but I think it'll be something like: Call Shell("java YourJavaProgram" &amp; Application.ActiveWorkbook.Path) And you can refer to user506069's answer for getting arguments on the Java side.

http://stackoverflow.com/a/25395106
answers question: http://stackoverflow.com/q/25371284
upvote count: 20
has comment: http://stackoverflow.com/comment/60724566
has body: So after working on it for hours, I found the root cause of the problem. In Java 7u65, they made the byte code verifier more strict as a result, the byte code verifier is reading PowerMock byte code and throwing a VerifyError. So ,basically, PowerMock's byte code is not passing the byte code verifier. The only way around is add -XX:-UseSplitVerifier as VM arguments or to switch to Java 6. In my case, when I remove ruleRecord[1].split(",") and when I implement my own split functionality, the tests work just fine. I guess Powermock messes up the bytecode when we use,for e.g, methods like whenNew(). Hope this helps.
type: Answer
score: 20
accepted answer of: http://stackoverflow.com/q/25371284
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25262435
has title: Generate random json for given json-schema in Java
has comment: http://stackoverflow.com/comment/39362004
has comment: http://stackoverflow.com/comment/67347163
answer count: 0
has comment: http://stackoverflow.com/comment/39362601
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
upvote count: 1
tagged with: jsonschema
linked to: http://stackoverflow.com/q/26795661
favorite count: 0
type: Question
has body: For testing our project, I want to generate random json objects respect to a given json-schema, how can I do this work? The given json-schemas won't be really complex.
type: UnansweredQuestion

http://stackoverflow.com/comment/39520354
type: QuestionComment
comment on: http://stackoverflow.com/q/25348388
has text: What kind of time constraints?
score: 0
type: Comment

http://stackoverflow.com/comment/39522020
type: Comment
type: AnswerComment
has text: @user1065869 I have no idea. Apparently not.
comment on: http://stackoverflow.com/a/25348898
score: 0

http://stackoverflow.com/a/25239113
score: 3
upvote count: 3
type: Answer
has body: No, if you deploy your app into app-server (like tomcat, glassfish, etc.), then the real .html's that shows in browser located somewhere in app-server folders. For glassfish it can be "/path_to_glassfish/glassfish/domains/domainXX/applications/APP_NAME/WEB-INF/classes/...". So, even if you change .html's at your project, you must to redeploy this changes. Wicket JavaDoc says : if the configuration type is DEVELOPMENT, resources are polled for changes... Yes, but is holds for resources located at appropriate folders. I think this wicket forum thread will give you some answers of how to implements behavior you want. This post is actually for old wicket version, but I think it is suitable for newer versions too. In our company we use firebug or chrome console to stylize components right in browser without redeploying app, and this is enough for us, because static components rarely added on the html page.
downvote count: 0
answers question: http://stackoverflow.com/q/25234200

http://stackoverflow.com/q/25233340
type: AnsweredQuestion
score: 0
answer count: 2
duplicate of: http://stackoverflow.com/q/3382996
has answer: http://stackoverflow.com/a/25233665
has comment: http://stackoverflow.com/comment/39308369
has title: Android Unzip zip file
tagged with: java
has comment: http://stackoverflow.com/comment/39307378
type: Question
possible better answer: http://stackoverflow.com/a/25233665
has body: I need some help really fast. I am having troubles with unzipping a file that I have downloaded to my phone as a background process in the app that I am building. The code that I have downloads a zip file from a server that I have set up specifically for the app. The zip file is not corrupted or anything like that. But if you guys could help me find a way to unzip the file that would be fantastic I have tried a few different ways and I cant seem to get it right. :/
accepted answer: http://stackoverflow.com/a/25233628
has answer: http://stackoverflow.com/a/25233628
tagged with: android
linked to: http://stackoverflow.com/q/3382996
has comment: http://stackoverflow.com/comment/39307490

http://stackoverflow.com/q/25318651
tagged with: java
has answer: http://stackoverflow.com/a/25318720
tagged with: templates
has comment: http://stackoverflow.com/comment/39466394
tagged with: generics
possible better answer: http://stackoverflow.com/a/25318698
has body: In C++ I build a little wrapper around cout like this: template &lt;class T&gt; void output( T a ){ if(is_this_enabled==true) std::cout&lt;&lt;a&lt;&lt;endl; return; } When certain kinds of output flood the command-line, I'd only need to change is_this_enabled and I can suppress them in one stop when they weren't relevant. I'm new to java, and I started writing a class to accomplish the same ends. I found myself reviewing the tutorials and seeing that there's no direct analog to templates in java. Is there a better/shorter way to do this then writing accompanying functions methods for each ofSystem.out.println()'s overloads? Generics don't seem to do it.
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39467188
has answer: http://stackoverflow.com/a/25318698
answer count: 3
has comment: http://stackoverflow.com/comment/39467206
has comment: http://stackoverflow.com/comment/39466391
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has title: Work around the lack of templates in java
accepted answer: http://stackoverflow.com/a/25318720
score: 1
has answer: http://stackoverflow.com/a/25318808

http://stackoverflow.com/comment/39501228
has text: Sorry, that was just a typo on my part when posting here - not related to my compilation problem. Thanks for the catch and sorry for any confusion!
type: Comment
comment on: http://stackoverflow.com/q/25336993
type: QuestionComment
score: 0

http://stackoverflow.com/comment/45183635
type: Comment
comment on: http://stackoverflow.com/a/25360308
has text: Here, can we secure static pages by role of a user?
type: AnswerComment
score: 0

http://stackoverflow.com/q/25309741
tagged with: mysql
favorite count: 0
type: Question
has body: In android app I have spinner which populate marathi values from .xml file Now I have one insert.php which will insert values from spinner to mysql table. But i get runtime exception :( Null.exception strings.xml सार्वजनिक पाळणा घर बस सेवा सार्वजनिक अभ्यासिका जॉगीग पार्क input_box.xml <Spinner android:id="@+id/spinner_problems" android:entries="@array/problems" android:layout_width="match_parent" android:layout_height="wrap_content" /> MainActivity.java final Spinner problems = (Spinner) findViewById((R.id.spinner_problems)); String myvalue = String.valueOf(problems .getSelectedItem()); ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("name",myval)); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://wwwd.emo.com/insert.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); BufferedReader reader = new BufferedReader (new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); JSONObject json_data = new JSONObject(result); code=(json_data.getInt("code")); if(code==1) { new DialogTask().execute("Success"); } else { new DialogTask().execute("Failure"); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25310835
score: -2
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/39450053
has title: unable to save marathi language value from spinner to mysql database using android code
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39451127

http://stackoverflow.com/comment/39469578
score: 1
type: Comment
type: AnswerComment
has text: Yeah, I just don't know. The OP says he wants to continue working in the SAME command window after starting it. He didn't say anything about it being a service or Java program. But concept of daemon is different than background. He says daemon (which your answer is right), but then says "continue to do other commands on this window" which says to me he just wants `start /b` like in my linked superuser post. His Linux example wasn't helpful as it is neither an example of a daemon process start, nor a background process start. His example leaves process in foreground but discards all output.
comment on: http://stackoverflow.com/a/25320424

http://stackoverflow.com/comment/39360073
type: Comment
comment on: http://stackoverflow.com/q/25261224
type: QuestionComment
score: 0
has text: @ThusithaThilinaDayaratne No. The JVM doesn't 'handle the buffer for us'. You don't seem to know what this method actually does. Have a look at the Javadoc.

http://stackoverflow.com/q/25273481
answer count: 2
has answer: http://stackoverflow.com/a/25273515
possible better answer: http://stackoverflow.com/a/25273520
accepted answer: http://stackoverflow.com/a/25273515
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25273520
upvote count: 1
has body: I have a number of data classes that are similar but slightly different. From these classes I set "common fields" then other "special fields" depending on the class. I want to create a method to set the common fields (so I don't have to repeat code for each data type). Right I have something like this: public CommonDataClass getCommonFieldsFromClass1(class1 dataObj) { CommonDataClass out = new CommonDataClass(); out.SetField1(data.getField1); return out; } public CommonDataClass getCommonFieldsFromClass2(class2 dataObj) { CommonDataClass out = new CommonDataClass(); out.SetField1(data.getField1); return out; } ... public CommonDataClass getCommonFieldsFromClassN(classN dataObj) { CommonDataClass out = new CommonDataClass(); out.SetField1(data.getField1); return out; } I would like something like this public CommonDataClass getCommonFields(MysteryClass dataObj) { CommonDataClass out = new CommonDataClass(); out.SetField1(data.getField1); return out; }
downvote count: 1
favorite count: 0
type: Question
has title: Four data classes to one common classes

http://stackoverflow.com/comment/39419556
type: QuestionComment
comment on: http://stackoverflow.com/q/25293368
score: 0
has text: @laune true, but if he is claiming that execution moves past the return statement then that will prove conclusively if it is. Which it can't, but yeah....
type: Comment

http://stackoverflow.com/comment/39565653
type: AnswerComment
comment on: http://stackoverflow.com/a/25372271
has text: @user2698 if you can define `min`, which can also be done using `abs` you are done.
type: Comment
score: 0

http://stackoverflow.com/a/25315115
has comment: http://stackoverflow.com/comment/39459884
has comment: http://stackoverflow.com/comment/39459995
type: Answer
answers question: http://stackoverflow.com/q/25314989
has body: Yes and no. When all references, not including weak references, an object is available for garbage collection on the next sweep. In your case it would not work as expected because the Map would still contain the entry for a WeakReference that points to nothing and is mapped to a WeakReference that points to nothing, with I believe no way to remove that element without iterating over all keys/values. The second problem with your last example is that Callback is now also a WeakReference meaning it can be garbage collected, even if it is still in use, as long as no other references exist to it. Which doesn't sound like what you want. Client client = ...; Callback callback = ...; Map&lt; WeakReference&lt; Client &gt;, WeakReference&lt; Callback &gt; &gt; map = ...; map.put( new WeakReference&lt; Client &gt;( client ), new WeakReference&lt; Callback &gt;( callback ) ); callback = null; // Uh oh, callback can now be collected but client is still connected The best solution is to explicitly remove the elements from all collections when no longer needed. This removes any reliance on the GC which you never really want to rely on, and there is no dangling entries in collections that will need to be cleaned up later. Another solution is to use a WeakHashMap. This appears to do exactly what you want, it will handle any dangling entries when the key is reclaimed. It does come with it's own pitfalls. It doesn't guarantee when those entries will be reclaimed, and it will not work with circular references as values are still referenced through a strong reference. Meaning if Callbacks keep a reference to their Client it will never be reclaimed as the Callback is strongly reference which strongly references the Client, and so on. To clarify why the 'when' is an issue with WeakHashMap, is that WeakHashMap can cleanup dangling entries whenever it wants. As long as it get's done without developer intervention. This means that values can still be strongly referenced long after they are n…
has comment: http://stackoverflow.com/comment/39459873
has comment: http://stackoverflow.com/comment/39459672
score: 0

http://stackoverflow.com/a/25250300
type: Answer
upvote count: 3
downvote count: 0
has body: There is no good reason for this, it will result in a very brittle application. It's easy for a database connection to go stale if there's a network problem or if the database doesn't respond for a little while, and with the reliance on a single existing connection there's no recovering without restarting the application. There are other bad points to this. For instance, typically connections are synchronized so if a web application with multiple concurrent users was built this way it would limit the concurrency of the application. But the inability of your application to recover from transient problems is enough to make this worth fixing.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25249224
score: 3
answers question: http://stackoverflow.com/q/25249224

http://stackoverflow.com/comment/39579259
score: 0
has text: the link you sent doesnt work. but ill do a search on the topic. Thanks for answering.
comment on: http://stackoverflow.com/q/25379824
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39546760
score: 0
type: AnswerComment
has text: A conforming SP implementation must ensure that a specific Response message is only used once. Typically that is done by keeping a list of used Ids of response messages until the `NotOnOrAfter` time has passed.
type: Comment
comment on: http://stackoverflow.com/a/25352955

http://stackoverflow.com/comment/39443632
type: Comment
type: QuestionComment
has text: just create background service .
comment on: http://stackoverflow.com/q/25306503
score: 0

http://stackoverflow.com/a/25370435
type: Answer
answers question: http://stackoverflow.com/q/25370388
has comment: http://stackoverflow.com/comment/39562203
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
has body: Check this line: ImageIO.read(SpriteSheet.class.getResourceAsStream(path)) It seems that SpriteSheet.class.getResourceAsStream(path) is returning a null value. It's quite possible that path isn't pointing to an actual file in the filesystem. Notice that you're passing "/sprite_sheet.png", that's a path relative to the source code's directory. Take a look at this post to get an idea of how you can build a relative path that works. If all else fails you could use an absolute path, but that won't be portable.
accepted answer of: http://stackoverflow.com/q/25370388

http://stackoverflow.com/comment/39537708
score: 0
type: AnswerComment
has text: This is exactly my problem. I'm asking if there is a way to get the raw byte array the client sent which is half in memory. I don't need or want this converted String object.
type: Comment
comment on: http://stackoverflow.com/a/25357973

http://stackoverflow.com/q/25307480
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
tagged with: dependency-injection
upvote count: 0
accepted answer: http://stackoverflow.com/a/25309549
score: -1
has answer: http://stackoverflow.com/a/25309549
tagged with: spring
tagged with: autowired
has title: Inject all dependencies automatically in Spring
has body: I'm currently trying to implement Spring Dependency Injection into my Desktop Application (I am only trying to inject my services). Apparently I dont really understand how it works, despite all the tutorials (most of them address web applications though). So the current state is that I have added a dependency in my pom.xml to add the spring jars, which works properly. I also managed to scan for my services. application-Context.xml: &lt;beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="FireworksApp" /&gt; &lt;/beans&gt; I am pretty sure that I have to tell Spring where my application-Context.xml is. Therefore I have found a loader class in a guide: public class ApplicationContextLoader { protected ConfigurableApplicationContext applicationContext; public ConfigurableApplicationContext getApplicationContext() { return applicationContext; } /** * Loads application context. Override this method to change how the * application context is loaded. * * @param configLocations * configuration file locations */ protected void loadApplicationContext(String... confi…

http://stackoverflow.com/q/25317674
has comment: http://stackoverflow.com/comment/39490735
downvote count: 3
has title: Does java version "1.6.0_65" equivocate to java 6?
has answer: http://stackoverflow.com/a/25317776
possible better answer: http://stackoverflow.com/a/25317776
has answer: http://stackoverflow.com/a/25317800
accepted answer: http://stackoverflow.com/a/25317800
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39464479
tagged with: java
duplicate of: http://stackoverflow.com/q/2053061
score: -3
tagged with: macos
has comment: http://stackoverflow.com/comment/39464451
has body: On OS X (10.6.8) and in terminal: java -version returns java version "1.6.0_65" Is this actually Java 6? I'm guessing that the version of Java in 10.6.8 is at least relatively current. I'm asking because of planning to install jMeter.
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39464449
upvote count: 0

http://stackoverflow.com/comment/39584369
has text: Thank you very much I will try this. I thought I had read the getting started page, but obviously not closely enough. I figured it was something simple. Thanks again for your help and patience.
type: Comment
comment on: http://stackoverflow.com/a/25374603
score: 0
type: AnswerComment

http://stackoverflow.com/a/25232832
has comment: http://stackoverflow.com/comment/39307500
accepted answer of: http://stackoverflow.com/q/25232441
has body: OK, I see what you're saying, and thanks for posting compilable code. One solution to use both release KeyStrokes, one for alt-key and one for plain key. For example, InputMap inMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actMap = panel.getActionMap(); for (final Key key : Key.values()) { KeyStroke altPressed = KeyStroke.getKeyStroke(key.getKeyCode(), InputEvent.ALT_DOWN_MASK, false); KeyStroke altReleased = KeyStroke.getKeyStroke(key.getKeyCode(), InputEvent.ALT_DOWN_MASK, true); KeyStroke released = KeyStroke.getKeyStroke(key.getKeyCode(), 0, true); inMap.put(altPressed, altPressed.toString()); inMap.put(altReleased, altReleased.toString()); inMap.put(released, released.toString()); actMap.put(altPressed.toString(), new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { keyMap.put(key, true); } }); Action releaseAction = new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { keyMap.put(key, false); } }; actMap.put(altReleased.toString(), releaseAction); actMap.put(released.toString(), releaseAction); Another solution is to not do the above, but rather to re-set the Map with each iteration of the Timer: for (Key key : Key.values()) { // run through the ALL of the keys if (keyMap.get(key)) { // if key in HashMap is true (i.e. the // actionPerformed() above set it true) switch (key.toString()) { case "a": System.out.println("a"); break; case "b": System.out.println("b"); break; case "c": System.out.println("c"); break; case "d": System.out.println("d"); break; case "e": System.out.println("e"); break; case "f": System.out.println("f"); } // ***** add this ***** keyMap.put(key, Boolean.FALSE); } } This second solution suffers from the delay that the OS puts in keystroke submission when the key is held down.
answers question: http://stackoverflow.com/q/25232441
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39307563
upvote count: 5
score: 5
type: Answer

http://stackoverflow.com/comment/39309898
type: Comment
comment on: http://stackoverflow.com/a/25234395
type: AnswerComment
has text: Thanks for your answer Romin but would you explain to me the last part of your answer: How Web Services can help me to realize my object?
score: 0

http://stackoverflow.com/comment/54183636
type: Comment
has text: 'HttpServletReqiest' IS A 'ServletRequest'. It is a sub-interface of. ServletRequest. There can be various classes/interfaces of ServletRequest such as 'PortletRequest' hence its always to do an 'instanceof' check for various servlet types.
type: AnswerComment
comment on: http://stackoverflow.com/a/25247239
score: 1

http://stackoverflow.com/comment/39438581
has text: Are you looking at doing this for `.xls` (HSSF) or `.xlsx` (XSSF)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25295776

swt
tags question: http://stackoverflow.com/q/25318380
tags question: http://stackoverflow.com/q/25338985
tags question: http://stackoverflow.com/q/25386103
tags question: http://stackoverflow.com/q/25304700
tags question: http://stackoverflow.com/q/25258243
tags question: http://stackoverflow.com/q/25372282
tags question: http://stackoverflow.com/q/25382699
tags question: http://stackoverflow.com/q/25259409
tags question: http://stackoverflow.com/q/25280256
type: Tag
tags question: http://stackoverflow.com/q/25240219
tags question: http://stackoverflow.com/q/25292666
tags question: http://stackoverflow.com/q/25319909
tags question: http://stackoverflow.com/q/25246991
tags question: http://stackoverflow.com/q/25354653
tags question: http://stackoverflow.com/q/25299559
tags question: http://stackoverflow.com/q/25255310
tags question: http://stackoverflow.com/q/25297262
tags question: http://stackoverflow.com/q/25235119
tags question: http://stackoverflow.com/q/25241236
tags question: http://stackoverflow.com/q/25306418
tags question: http://stackoverflow.com/q/25278907
tags question: http://stackoverflow.com/q/25295987
tags question: http://stackoverflow.com/q/25384809
tags question: http://stackoverflow.com/q/25313396
tags question: http://stackoverflow.com/q/25332168
tags question: http://stackoverflow.com/q/25324633
tags question: http://stackoverflow.com/q/25378778
tags question: http://stackoverflow.com/q/25285184
tags question: http://stackoverflow.com/q/25259071
tags question: http://stackoverflow.com/q/25278235
tag name: swt

http://stackoverflow.com/comment/39490500
score: 1
type: QuestionComment
type: Comment
has text: Well yes, you *are* setting the score to 0. You haven't told us what you're observing, nor have you provided us with a short but complete program demonstrating the problem.
comment on: http://stackoverflow.com/q/25331323

http://stackoverflow.com/a/25510785
has body: Input Data In order to facilitate readability, I restructured your model into TURTLE syntax for others to read. @prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; . @prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; . @prefix crm: &lt;http://www.cidoc-crm.org/cidoc-crm/&gt; . &lt;http://phdprototype.tk/collectionimage /4D0BFF17-5810-4644-A550-D35EE090D4A8.png&gt; a "Painting" ; rdfs:label "Brett WHITELEY" ; crm:E21_Person [ a &lt;E39_Actor&gt; ; rdfs:label "Brett WHITELEY" ] ; crm:E62_String "Painting\n" ; crm:P108i_was_produced_by [ a crm:E12_Production ; crm:P126_employed [ a crm:E57_Material ; rdfs:label "Oil" ] ; crm:P4_has_time-span [ a crm:E52_Time-Span ; crm:P82_at_some_time_within "\n 1976\n " ] ] ; crm:P3_has_note [ a crm:P102_has_title ; rdfs:label "Interior with Time Past" ] ; crm:P7_took_place_at [ a crm:E53_Place ; crm:E44_Place_Appellation " \n 5D\n " ] ; crm:P91_has_unit [ a crm:E58_Measurement_Unit ; rdfs:label "182.0 h * 200.0 w cm" ] . There are some issues with this data. For example, your painting has rdf:type the plain literal "painting", which is extremely bad. This is denoted by the a "painting" property-object pair. We can execute a query over this data, but you may wish to restructure your ontology so that it uses terms like rdf:type properly. Query For the sample data provided, the following query will extract what you are looking for: prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; prefix crm: &lt;http://www.cidoc-crm.org/cidoc-crm/&gt; SELECT * WHERE{ [ crm:E21_Person/rdfs:label ?creator ; crm:P108i_was_produced_by [ crm:P126_employed [ rdfs:label ?material ] ; crm:P4_has_time-span [ crm:P82_at_some_time_within ?timespan ] ] ; crm:P3_has_note [ a crm:P102_has_title ; rdfs:label ?title ] ] FILTER( ?creator = "Brett WHITELEY" ). } will result in: ---------------------------------------------------------------------------------- | creator | mate…
accepted answer of: http://stackoverflow.com/q/25375482
has comment: http://stackoverflow.com/comment/39891210
has comment: http://stackoverflow.com/comment/39899304
type: Answer
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25375482
type: AcceptedAnswer

http://stackoverflow.com/q/25362553
has title: can't verify pdf signatures. itext, pdf, GOST3410
has comment: http://stackoverflow.com/comment/39579179
score: 0
has comment: http://stackoverflow.com/comment/39549284
linked to: http://stackoverflow.com/q/37156747
has answer: http://stackoverflow.com/a/25393202
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
tagged with: gost3410
type: Question
has comment: http://stackoverflow.com/comment/39582068
has comment: http://stackoverflow.com/comment/39548139
has comment: http://stackoverflow.com/comment/39588114
type: UnansweredQuestion
answer count: 1
has body: I'am trying to verify signatures in pdf file. There are three of them. I have signed that file with the code i've found in internet and adopted to my needs, so it might be encorrect too. Here is that signed file pdf file Verifier code here: package com.mycompany.verifysignature; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.bouncycastle.crypto.digests.GOST3411Digest; import ru.CryptoPro.CAdES.CAdESSignature; import ru.CryptoPro.CAdES.CAdESType; public class Main { public static void main(String args[]) { try { ArrayList&lt;Map&lt;String, String&gt;&gt; resList = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); InputStream pdfIs = new FileInputStream("/home/user1/Desktop/321-17.pdf"); com.itextpdf.text.pdf.PdfReader reader = new com.itextpdf.text.pdf.PdfReader(pdfIs); ByteArrayOutputStream baos = new ByteArrayOutputStream(); com.itextpdf.text.pdf.PdfStamper stamper = com.itextpdf.text.pdf.PdfStamper.createSignature(reader, baos, '\0'); com.itextpdf.text.pdf.PdfSignatureAppearance sap = stamper.getSignatureAppearance(); com.itextpdf.text.pdf.AcroFields fields = reader.getAcroFields(); for (String signame : fields.getSignatureNames()) { HashMap&lt;String, String&gt; m = new HashMap(); m.put("name", signame.toString()); System.out.println("name:"+signame); com.itextpdf.text.pdf.PdfDictionary sig = fields.getSignatureDictionary(signame); if (sig != null &amp;&amp; sig.getAsString(com.itextpdf.text.pdf.PdfName.REASON) != null) { m.put("reason", sig.getAsString(com.itextpdf.text.pdf.PdfName.REASON).toString() .replaceAll("\"", "\\\"")); System.out.println("reason:"+sig.getAsString(com.itextpdf.text.pdf.PdfName.REASON).toString() .replaceAll("\"", "\\\"")); } else { m.put("reason", "undefined"); System.out.println("reason:undefined"); } byte signature[] = null; if (sig != null &amp;&amp; sig.getBytes() != nul…
tagged with: itext

http://stackoverflow.com/comment/46996542
type: QuestionComment
comment on: http://stackoverflow.com/q/25374568
score: 0
has text: Did you manage to get this to work?
type: Comment

http://stackoverflow.com/a/77132775
type: Answer
score: -1
has body: Use Pixmap The expansion function combines 2 textures in the center. fun Texture.combineByCenter(texture: Texture): Texture { if (textureData.isPrepared.not()) textureData.prepare() val pixmap1 = textureData.consumePixmap() if (texture.textureData.isPrepared.not()) texture.textureData.prepare() val pixmap2 = texture.textureData.consumePixmap() pixmap1.drawPixmap(pixmap2, (width / 2) - (texture.width / 2), (height / 2) - (texture.height / 2), ) val textureResult = Texture(pixmap1) if (pixmap1.isDisposed.not()) pixmap1.dispose() if (pixmap2.isDisposed.not()) pixmap2.dispose() return textureResult } Don't forget to dispose the texture later. If before merging at least one of the textures had pixmap.dispose [pixmap.isDisposed=true], then you will have problems. The solution is simply to use pure textures and their pixmaps since they are created and disposed 1 time.
answers question: http://stackoverflow.com/q/25257012
upvote count: 0
downvote count: 1

http://stackoverflow.com/comment/39324469
has text: @MadProgrammer Thx for your answer! I changed it now. However, this is just a simple use case and not the actual problem. My problem is that the table does not udpate, my action!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25242372

http://stackoverflow.com/comment/39393007
type: Comment
has text: Thank you, this solution worked for me! I would like to vote this answer up but I need 15 reputation to do so :\
score: 0
comment on: http://stackoverflow.com/a/25267494
type: AnswerComment

http://stackoverflow.com/q/25279532
tagged with: java
tagged with: spring
tagged with: spring-mvc
type: Question
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/25279867
has body: I am trying to access localhost:8080/HelloWeb/helloWorld, but keep getting a file not found error. I know that I'm not doing the mapping correctly, but as a beginner, I can't really pinpoint where. Please help. I have the following view in WEB-INF/jsp/helloWorld.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Spring MVC Web Service Name: ${name} The following is my web.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 2 dispatcher *.htm 30 redirect.jsp The following is my dispatcher-servlet.xml file: <?xml version='1.0' encoding='UTF-8' ?> <!-- was: <?xml version="1.0" encoding="UTF-8"?> --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> indexController <mvc:annotation-driven/> <context:component-scan base-package="controller" /> </beans> And the following is my HelloWorldController.java file: package controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Mod…
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/25279867
has title: Basic Spring 4 MVC - Hello World - Error 404 File Not Found
favorite count: 0
has answer: http://stackoverflow.com/a/25280722
accepted answer: http://stackoverflow.com/a/25279676
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25279676
has comment: http://stackoverflow.com/comment/39393133
answer count: 3

http://stackoverflow.com/a/25290997
answers question: http://stackoverflow.com/q/25290458
type: Answer
has body: If you want builds to work on other systems you need to set up a repository manager like Nexus or Artifactory. I'm guessing that's what you want, though you didn't actually ask a question.
score: 0

http://stackoverflow.com/q/25283562
type: Question
has comment: http://stackoverflow.com/comment/39401817
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has body: I wrote a class to dynamically display EditTexts as you need them. So in any case where an interface needs a variable amount of inputs for strings the class generates the needed EditTexts. It does this by supplying an extra blank EditText at all times. It also removes those that are not used. Any editText that loses focus that is blank is destroyed unless it is the last remaining EditText. It works pretty well except for the fact that leaving a blank EditText and making it lose focus removes it but also sets the focus to the first EditText on the page (which isn't dynamic it's part of the page's XML) as well as whatever other field I clicked on. So I have two cursors and can no longer edit the first field on the page. I think what's happening is when the EditText loses focus and is destroyed android is setting focus to the default field on the page and then when the next field gains focus that gets a cursor too. It's something to do with the removal of the EditText I believe. I really like this functionality though so I would like to get it working. Here is the code for my class: package com.bentles.attempt3; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.ViewGroup; import android.widget.EditText; public class SmartEditTexts { List&lt;EditText&gt; boxes = new ArrayList&lt;EditText&gt;(); Context context; ViewGroup parent; int index; public SmartEditTexts(Context context, ViewGroup parent, int index) { this.context = context; this.parent = parent; this.index = index + 1; add(); } private void add() { EditText newEdit = new EditText(context); newEdit.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { EditText changed= (EditText)v; if (hasFocus) { if (boxes.indexOf(changed) == (boxes.size() - 1)) { add(); } } else if (changed.getText().toString().trim().isEmpty()) //if there…
has comment: http://stackoverflow.com/comment/39413631
tagged with: android
tagged with: java
has title: removeView causing multiple EditTexts to have focus

http://stackoverflow.com/comment/39454583
type: AnswerComment
comment on: http://stackoverflow.com/a/25312192
has text: this instead, shows the startTime and endTime together when the process has not even finished. and then the `aJProgressBar.setIndeterminate(false);` is uncommented, by right, it should run. but then it does not. But if it is commented, the progress bar is able to run when the "START" button is clicked. but does not stop when the process ends.
type: Comment
score: 0

http://stackoverflow.com/q/25324076
has title: Terminology for relationships defined by interfaces
has answer: http://stackoverflow.com/a/25328582
type: Question
tagged with: interface
type: UnansweredQuestion
upvote count: 6
score: 6
has answer: http://stackoverflow.com/a/25344794
tagged with: terminology
has body: If inheritance is the OO technique for implementing an is-a relationship and composition/aggregation implements a has-a relationship what would would the appropriate name for the relationship implemented by a Java/.NET style interface be? I'm really keen on the term can-do relationship since such interfaces are often used to specify supported operations such as Sortable, Clonable etc. plus it sounds really affirmative. The only name that comes to mind that I've actually seen is a realizes relationship but it doesn't really describe all that much.
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/25344862
answer count: 3
downvote count: 0
tagged with: .net
favorite count: 0

http://stackoverflow.com/comment/39579360
has text: is this correctly labelled as `java` and `jquery` at the same time? What is the framework that you are using?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25379782
score: 0

methods
tags question: http://stackoverflow.com/q/25288499
tags question: http://stackoverflow.com/q/25247669
tags question: http://stackoverflow.com/q/25318814
tags question: http://stackoverflow.com/q/25386839
tags question: http://stackoverflow.com/q/25251023
tags question: http://stackoverflow.com/q/25356516
tags question: http://stackoverflow.com/q/25231752
tags question: http://stackoverflow.com/q/25276828
tag name: methods
tags question: http://stackoverflow.com/q/25384324
tags question: http://stackoverflow.com/q/25308474
tags question: http://stackoverflow.com/q/25374168
tags question: http://stackoverflow.com/q/25285932
tags question: http://stackoverflow.com/q/25316647
tags question: http://stackoverflow.com/q/25342085
type: Tag
tags question: http://stackoverflow.com/q/25322852
tags question: http://stackoverflow.com/q/25378611
tags question: http://stackoverflow.com/q/25338216
tags question: http://stackoverflow.com/q/25355711
tags question: http://stackoverflow.com/q/25232990
tags question: http://stackoverflow.com/q/25349741

http://stackoverflow.com/comment/39463338
type: Comment
comment on: http://stackoverflow.com/q/25316687
type: QuestionComment
score: 0
has text: I understand, but I am simply not allowed to use that method for this task.

http://stackoverflow.com/q/25290482
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25290615
has answer: http://stackoverflow.com/a/25290693
tagged with: awt
has title: Setting the full screen to a java.awt.Window on Ubuntu
score: 0
has body: I want to set the full screen to a java.awt.Window, but it doesn't work on Ubuntu. The following code doesn't work: import java.awt.*; import javax.swing.*; public class test { public static void main(String[] args) { Window wnd = new Window(new Frame()); wnd.setLocation(100, 100); wnd.setSize(wnd.getToolkit().getScreenSize()); wnd.setBackground(Color.red); wnd.setVisible(true); } } I think, the problem is in the line: wnd.setSize(wnd.getToolkit().getScreenSize()); If I change it to: wnd.setSize(400,300) it will work. Can someone help me? Thanks very much!
linked to: http://stackoverflow.com/q/12520658
has comment: http://stackoverflow.com/comment/39415114
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39413682

http://stackoverflow.com/q/25265781
downvote count: 5
has answer: http://stackoverflow.com/a/25266824
has answer: http://stackoverflow.com/a/25265893
has comment: http://stackoverflow.com/comment/39368314
has comment: http://stackoverflow.com/comment/39368045
has comment: http://stackoverflow.com/comment/39368019
has comment: http://stackoverflow.com/comment/39368027
possible better answer: http://stackoverflow.com/a/25265894
answer count: 3
tagged with: for-loop
upvote count: 2
has answer: http://stackoverflow.com/a/25265894
tagged with: java
has comment: http://stackoverflow.com/comment/39368164
has comment: http://stackoverflow.com/comment/39367928
has comment: http://stackoverflow.com/comment/39369742
has comment: http://stackoverflow.com/comment/39367989
has title: Can someone explain this Java code to me? (beginner in Java)
favorite count: 0
type: Question
type: AnsweredQuestion
has body: This is from the book "Java: A beginner's Guide". Chapter #3: While loops. I want to know how these to loops work together in the following program. // Compute integer power of 2. public class Power { public static void main(String[] args) { int e, result; for(int i = 0; i &lt; 10; i++) { result = 1; e = i; while(e &gt; 0) { result = result * 2; e--; } System.out.println("2 to the " + i + " power is " + result); } } }
tagged with: while-loop
score: -3
accepted answer: http://stackoverflow.com/a/25265893

http://stackoverflow.com/comment/39582894
type: AnswerComment
has text: Well can't you let the ProcessLine take care of the termination logic then? Or put the results in another queue which is processed by a result processor.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25378547

http://stackoverflow.com/q/25346767
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25349678
has answer: http://stackoverflow.com/a/25347147
tagged with: concurrency
downvote count: 4
has comment: http://stackoverflow.com/comment/39517879
has comment: http://stackoverflow.com/comment/39517887
upvote count: 0
has title: How to ensure that a particular thread finishes execution first and the other last?
answer count: 3
has answer: http://stackoverflow.com/a/25383881
has body: So say there are 3 threads (t1, t2, t3) spawned off the main thread. How would I ensure that a particular thread finishes its execution first and another thread as last. I don't mean to begin a thread after the "completion" of another, but want to ensure they finish in a particular order. A sample code will be extremely helpful. To be more precise, say in a gaming application, you would want to change the graphics first, then you want the sound to be produced followed by the score update.
tagged with: java
score: -4
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39517932
has comment: http://stackoverflow.com/comment/39518170
has comment: http://stackoverflow.com/comment/39518000
favorite count: 0

http://stackoverflow.com/comment/39627826
type: Comment
comment on: http://stackoverflow.com/q/25379340
type: QuestionComment
score: 0
has text: Hi, you are right, have fixed you notices in the code.

http://stackoverflow.com/comment/39447208
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25308413
has text: Learn java and read the doc: http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
score: 0

http://stackoverflow.com/q/25238334
type: Question
has comment: http://stackoverflow.com/comment/39317253
has answer: http://stackoverflow.com/a/25238655
has comment: http://stackoverflow.com/comment/39317165
tagged with: multidimensional-array
score: -2
has body: I have the following variables and ArrayList: int rowLength, columnLength; ArrayList&lt;String[]&gt; data = new ArrayList&lt;String[]&gt;(); I need to fill this array list with random data. The data must be string (recommended int that has been converted to String). The main goal is to fill multidimensional array list with random data. I've tried to do that but I had too many troubles. I'm new in Java, so sometime I need help with basic things as well.
answer count: 4
accepted answer: http://stackoverflow.com/a/25238624
has title: Filling Array List with random data
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39317053
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/39317517
tagged with: java
has comment: http://stackoverflow.com/comment/39317125
has answer: http://stackoverflow.com/a/25238648
has answer: http://stackoverflow.com/a/25238629
has answer: http://stackoverflow.com/a/25238624
possible better answer: http://stackoverflow.com/a/25238629
favorite count: 0

void
tags question: http://stackoverflow.com/q/25280644
tag name: void
type: Tag

http://stackoverflow.com/a/25343745
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/42673194
has comment: http://stackoverflow.com/comment/39587600
downvote count: 0
upvote count: 10
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25282540
has comment: http://stackoverflow.com/comment/42634610
has body: Can MyBatis create the database schema? I'm afraid not. In order to do that you need an ORM and MyBatis is not an ORM. With an ORM solution (like Hibernate for example) you map tables to entities. The entity is the (object) representation of the (relational) table and contains all the metadata (getters/setters, annotations etc) necessary to create the table. MyBatis does not map entities to tables, it maps methods to SQL statements. There is no way to determine from the methods or the SQL statements what the structure of the database should be. When you use MyBatis the tables must already exist.
has comment: http://stackoverflow.com/comment/42673188
answers question: http://stackoverflow.com/q/25282540

http://stackoverflow.com/q/25318732
has comment: http://stackoverflow.com/comment/39475933
tagged with: download
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39466770
linked to: http://stackoverflow.com/q/18517400
has body: I'm trying to get into Android app development and as a test I'm trying to make an app download a simple web page in the background, while the main UI can be used. The user presses a 'search' button and the page is downloaded in a background task. The code I have for this is as follows: DownloadTask.java //all the necessary package and import statements public class DownloadTask extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... urls) { FPDownloader fpDownloader = new FPDownloader(context); if (fpDownloader.isConnected()) { return fpDownloader.download(urls[0]); } else { return null; } } } Where FPDownloader is a class I made. It downloads a web page and returns its content as a String. SearchButtonListener.java public class SearchButtonListener implements View.OnClickListener { private Activity context; private String type; private String category; private String page; public SearchButtonListener(Activity context, String type, String category, String page) { this.context = context; this.type = type; this.category = category; this.page = page; } public void onClick(View view) { String url = new FPUrlBuilder().getBrowseUrl(type, category, page); DownloadTask downloadTask = new DownloadTask(context); String result; TextView test = (TextView)context.findViewById(R.id.testTextView); try { downloadTask.execute(url); result = downloadTask.get(); if (result != null) { test.setText("It worked! Downloaded " + url); } else { test.setText("Something went wrong while downloading the data"); } } catch (Exception e) { //e.printStackTrace(); test.setText("Something went wrong while executing the download"); } } } Here FPUrlBuilder is another class I made, which simply returns an url based on the parameters you provide. (If necessary, I can provide the activity's source aswell. Also, I know I'm passing Activity instances around- is this a bad practice or not?) The problem I'm having is that the task executes fine - the results are shown as exp…
has comment: http://stackoverflow.com/comment/39466575
answer count: 0
has comment: http://stackoverflow.com/comment/39466964
score: 0
tagged with: java
has title: Android - AsyncTask not executing in background?
duplicate of: http://stackoverflow.com/q/18517400
has comment: http://stackoverflow.com/comment/39466618
tagged with: android-asynctask
type: Question

http://stackoverflow.com/comment/39530583
type: QuestionComment
comment on: http://stackoverflow.com/q/25354032
type: Comment
score: 0
has text: I meant if the `(A)(B)` cast was used or if the cast wasn't there at all.

http://stackoverflow.com/comment/39479305
score: 0
comment on: http://stackoverflow.com/q/25325763
type: QuestionComment
has text: because it is default... means a class declaration without public or private is always private.
type: Comment

wrapper
tag name: wrapper
tags question: http://stackoverflow.com/q/25247893
tags question: http://stackoverflow.com/q/25381903
type: Tag
tags question: http://stackoverflow.com/q/25363027
tags question: http://stackoverflow.com/q/25292510
tags question: http://stackoverflow.com/q/25329428

http://stackoverflow.com/a/25307771
score: 0
has body: Check the PowerMockIgnore annotation. It allows you to configure which classes (eg: "javax.*") will not be substituted by mocks.
answers question: http://stackoverflow.com/q/25307632
type: Answer

http://stackoverflow.com/comment/39460044
comment on: http://stackoverflow.com/q/25315147
type: Comment
score: 0
has text: Cool, I wrote it up as a more descriptive answer.
type: QuestionComment

http://stackoverflow.com/a/47328393
downvote count: 0
answers question: http://stackoverflow.com/q/25375228
type: Answer
has body: For anybody looking on more info on this topic: I was facing the same issue as well, and thanks to the tip of kennyg, i managed to come up with the following solution: import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; @ControllerAdvice public class JSendAdvice implements ResponseBodyAdvice&lt;Object&gt; { @Override public boolean supports(MethodParameter returnType, Class&lt;? extends HttpMessageConverter&lt;?&gt;&gt; converterType) { return true; } @Override public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class&lt;? extends HttpMessageConverter&lt;?&gt;&gt; selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { if (body instanceof JSendResponse) { return body; } return new JSendResponse&lt;&gt;().success(body); } } This solution wraps all the objects returned in your controllers inside a (for this example) JSendResponse class, which saves you the hassle of returning JSendResponses in all of your controller methods.
score: 2
upvote count: 2

http://stackoverflow.com/comment/81377764
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25239167
type: AnswerComment
has text: The question doesn't mention 'standard libraries', correct? Though it does states that author wants to get a mutable collection with one element. Of course, such method wouldn't be called 'singleton' as it implies single element but if we're talking about analogs - guava and eclipse are perfectly fine, e.g. as @fgb answered. So a full answer, I think, should be that no, there are no methods in standard libraries but one can use those two to initialize a collection with single element.

http://stackoverflow.com/q/25383949
has answer: http://stackoverflow.com/a/25383969
type: Question
tagged with: search
upvote count: 0
has title: How to make a searchIndex in android with java
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/25383969
tagged with: lucene
favorite count: 0
has body: I try make an android app with java and have a problem with searchIndex I just don't know ho to make it right I already used lucene in C# but I want to know if I could use it in java.
type: AnsweredQuestion
tagged with: android
tagged with: java
score: -1

http://stackoverflow.com/a/25292925
has body: Either the bytecode executes normally and performs the instructions given or the jvm rejects them. I played around with programming directly in java bytecode some time ago using jasmin, and I noticed some things. If the bytecode you edited it into makes sense, it will of coursse run as expected. However there are some bytecode patterns that are rejected with a VerifyError. For the specific examble of out of bounds access, you can compile code with out of bounds just fine. They will get you an ArrayIndexOutOfBoundsException at runtime. int[] arr = new int[20]; for (int i = 0; i &lt; 100; i++) { arr[i] = i; } However you can construct bytecode that is more fundamentally flawed than that. To give an example I'll explain some things first. The java bytecode works with a stack, and instructions works with the top elements on the stack. The stack naturally have different sizes at different places in the program but sometimes you might use a goto in the bytecode to cause the stack to look different depending on how you reached there. The stack might contain object, int then you store the object in an object array and the int in an int array. Then you go on and from somewhere else in that bytecode you use a goto, but now your stack contains int, object which would result in an int being passed to an object array and vice versa. This is just one example of things that could happen which makes your bytecode fundamentally flawed. The JVM detects these kinds of flaws when the class is loaded at runtime, and then emits a VerifyError if something dosen't work.
answers question: http://stackoverflow.com/q/25292551
downvote count: 0
upvote count: 1
score: 1
type: Answer

http://stackoverflow.com/q/25342601
has answer: http://stackoverflow.com/a/25343702
has comment: http://stackoverflow.com/comment/39512176
favorite count: 0
has comment: http://stackoverflow.com/comment/39512190
type: Question
has title: Hibernate issue : must appear in the GROUP BY clause or be used in an aggregate function
has comment: http://stackoverflow.com/comment/39511461
tagged with: postgresql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39511944
upvote count: 5
tagged with: java
tagged with: hibernate
tagged with: database
has body: Query I want to run: SELECT date_trunc('month',UA.activity_date),SUM(UA.points) FROM user_activity UA WHERE UA.activity_date &gt; '01/01/2014' AND UA.activity_date &lt; '12/31/2014' GROUP BY date_trunc('month',UA.activity_date) ORDER BY date_trunc('month',UA.activity_date) Expected Results: 03/01/2014 00:00:00 66.04000000000000000 05/01/2014 00:00:00 13.50000000000000000 07/01/2014 00:00:00 27.00000000000000000 08/01/2014 00:00:00 26.00000000000000000 09/01/2014 00:00:00 13.50000000000000000 When I use Hibernate to run that query, I get this error thrown: ERROR: column "useractivi0_.activity_date" must appear in the GROUP BY clause or be used in an aggregate function To fix that, I have modified the above query as : SELECT date_trunc('month',UA.activity_date),SUM(UA.points) FROM user_activity UA WHERE UA.activity_date &gt; '01/01/2014' AND UA.activity_date &lt; '12/31/2014' GROUP BY date_trunc('month',UA.activity_date),***UA.activity_date*** ORDER BY date_trunc('month',UA.activity_date) But, the results are wrong: 03/01/2014 00:00:00 25.40000000000000200 03/01/2014 00:00:00 25.40000000000000200 03/01/2014 00:00:00 15.24000000000000000 05/01/2014 00:00:00 13.50000000000000000 07/01/2014 00:00:00 9.00000000000000000 07/01/2014 00:00:00 18.00000000000000000 08/01/2014 00:00:00 4.50000000000000000 How can I fix this? When I run the first query from my toad shell directly on the db, it seems to work just fine. However, when I run the same query from code using Hibernate I get that error.
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/55649274
tagged with: sql
downvote count: 0

http://stackoverflow.com/a/25301286
answers question: http://stackoverflow.com/q/25292471
score: 0
has body: You can also create a dummy jar by not having any sources and deps in a dummy modules. Ex: 4.0.0 com.test dummyJar jar 1.0-SNAPSHOT dummyJar And then use this artifact and the dependencies plugin to copy this jar to specific locations that are you need them to be at. Also a suggestion, if possible would recommend that these empty jars be under target folder instead of the base project dir as these are not really sources. But it really depends if you can do it in your legacy build.
type: Answer

http://stackoverflow.com/comment/39473673
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25322679
type: QuestionComment
has text: may be because in `++i<n` it `first increment i then compare`

http://stackoverflow.com/comment/39623232
has text: thkala where i need to mention exact OS, Java and Tomcat versions
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25338592
score: 0

http://stackoverflow.com/q/25238132
score: 1
has comment: http://stackoverflow.com/comment/39316734
tagged with: java
answer count: 1
downvote count: 0
has body: I'm trying to get all dates between 2 given dates from a datastore (appengine), I found this query that gives the ascending and descending dates but I need what is between Query q = new Query("Employee Attendance Sheet test1").addSort("Date", Query.SortDirection.ASCENDING); If there is somehow to mix an ascending and descending queries maybe I found these codes also query.setFilter("dateField &lt; dateParam"); but the setFilter function is telling me that it does not accept string. What is wrong ?
favorite count: 0
type: Question
tagged with: google-cloud-datastore
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
has comment: http://stackoverflow.com/comment/39319090
has title: Query to get all dates between 2 given dates
linked to: http://stackoverflow.com/q/23319489
has answer: http://stackoverflow.com/a/25239681

http://stackoverflow.com/q/25289910
has answer: http://stackoverflow.com/a/25291303
type: Question
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: How can I write my schema so elements in sequence are mapped to separate properties instead of one List<Object> in JAXB-generated class?
tagged with: java
downvote count: 0
tagged with: jaxb
score: 1
upvote count: 1
answer count: 1
has body: I have the following types in my .xsd file: &lt;complexType name='FooType' mixed='true'&gt; &lt;sequence&gt; &lt;element name='Bar' minOccurs='0' type='xenc:BarType'/&gt; &lt;element name='Baz' minOccurs='0' type='base64Binary'/&gt; &lt;any namespace='##other' minOccurs='0' maxOccurs='unbounded'/&gt; &lt;/sequence&gt; &lt;attribute name='Moo' type='anyURI' use='required'/&gt; &lt;/complexType&gt; &lt;simpleType name='BarType'&gt; &lt;restriction base="integer"/&gt; &lt;/simpleType&gt; ...From which JAXB XJC generates the following in the FooType class: @XmlElementRefs({ @XmlElementRef(name = "Bar", namespace = "http://namespace.blargh", type = JAXBElement.class), @XmlElementRef(name = "Baz", namespace = "http://namespace.blargh", type = JAXBElement.class) }) @XmlMixed @XmlAnyElement(lax = true) protected List&lt;Object&gt; content; @XmlAttribute(name = "Moo", required = true) @XmlSchemaType(name = "anyURI") protected String moo; I need access to the value of the Bar element, but it's in a List&lt;Object&gt; as a JAXBElement, and I'd have to hard-code the QName up in my business logic to make sure I have the right thing. How can I modify my schema to get a bar property in the generated class? Either a List&lt;Integer&gt; or List&lt;BarType&gt; with a new class generated would work. (It's not ideal, but even List&lt;JAXBElement&gt; bar would work if I can know every item is a "Bar" element and only have to deal with the value.)
favorite count: 0
accepted answer: http://stackoverflow.com/a/25291303
tagged with: xjc

http://stackoverflow.com/comment/39464760
has text: `Object#clone` will provide a new instance of the class of the object being cloned, so that's not a reason to avoid using `clone`. Anyway, I prefer to never use `clone` and follow one of the methods explained [in this Q/A](http://stackoverflow.com/q/2156120/1065197).
type: QuestionComment
comment on: http://stackoverflow.com/q/25317748
score: 0
type: Comment

http://stackoverflow.com/q/25231685
type: Question
upvote count: 4
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
score: 4
has answer: http://stackoverflow.com/a/25570208
has body: I am creating a zip file using ZipOutputStream. There will also be a manifest file (a csv file) which will have links to the entries in the Zip file. How do I programmatically create links for the zip entries ?
has comment: http://stackoverflow.com/comment/39304108
has title: programmatically creating links in Zip file - java
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25328143
has answer: http://stackoverflow.com/a/25328542
linked to: http://stackoverflow.com/q/5656124
score: 0
tagged with: java
answer count: 1
tagged with: interceptor
has title: HTTP Status 500 - Spring MVC unable to add interceptors
type: Question
has body: I'm getting an exception when I run this application on Tomcat 7 server. It runs perfectly fine when I don't add this piece of line on my dispatcherservlet. <mvc:interceptors> </mvc:interceptors> but when I add it. I get this error. I doubled check for spelling errors. There is none. I'm not sure whats causing the issue. DispatcherServlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <mvc:annotation-driven enable-matrix-variables="true" /> <context:component-scan base-package="com.spring.maria" /> <mvc:resources location="/resources/" mapping="/resources/**" /> <mvc:interceptors> </mvc:interceptors> com.spring.maria.domain.Product Root Cause Error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#1': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39484465
tagged with: spring-mvc

http://stackoverflow.com/comment/39337892
has text: You're right, he did say what he wanted to capture.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25249425

scala
tags question: http://stackoverflow.com/q/25329412
tags question: http://stackoverflow.com/q/25365556
tags question: http://stackoverflow.com/q/25249424
tags question: http://stackoverflow.com/q/25379764
tags question: http://stackoverflow.com/q/25315753
tag name: scala
tags question: http://stackoverflow.com/q/25346672
tags question: http://stackoverflow.com/q/25315912
tags question: http://stackoverflow.com/q/25326629
tags question: http://stackoverflow.com/q/25280040
tags question: http://stackoverflow.com/q/25325478
tags question: http://stackoverflow.com/q/25337074
tags question: http://stackoverflow.com/q/25271352
tags question: http://stackoverflow.com/q/25263564
tags question: http://stackoverflow.com/q/25233186
tags question: http://stackoverflow.com/q/25273808
tags question: http://stackoverflow.com/q/25302350
tags question: http://stackoverflow.com/q/25303651
tags question: http://stackoverflow.com/q/25330208
type: Tag
tags question: http://stackoverflow.com/q/25349018
tags question: http://stackoverflow.com/q/25282911
tags question: http://stackoverflow.com/q/25279434
tags question: http://stackoverflow.com/q/25231558
tags question: http://stackoverflow.com/q/25355592

http://stackoverflow.com/q/25383441
type: Question
linked to: http://stackoverflow.com/q/10773978
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/10773978
has answer: http://stackoverflow.com/a/25383533
tagged with: jprogressbar
answer count: 1
linked to: http://stackoverflow.com/q/10847308
tagged with: swing
has title: how to change the color of "string painted" of JProgressbar?
has body: I have a JProgressBar in my java code and I want to change the color of its "string painted" (string which shows percentage on JProgressBar), so Is there any way in java to change the color of the "string painted" of JProgressBar???
score: 0
tagged with: colors
has comment: http://stackoverflow.com/comment/39585752
tagged with: java

http://stackoverflow.com/comment/39485828
type: Comment
has text: Thank you for your answer. Could kindly let me know where I can update the setting?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25329009

http://stackoverflow.com/comment/39309098
type: Comment
has text: Not your down-voter, but consider making less comments and more improvement to the question. Try to streamline it so we can see just what specifically your problem/question is. I've been reading it a few times and have yet to fully understand it.
type: QuestionComment
comment on: http://stackoverflow.com/q/25234057
score: 0

grails
tags question: http://stackoverflow.com/q/25360064
tags question: http://stackoverflow.com/q/25290744
tags question: http://stackoverflow.com/q/25301785
tags question: http://stackoverflow.com/q/25251945
tags question: http://stackoverflow.com/q/25299611
tags question: http://stackoverflow.com/q/25290181
tags question: http://stackoverflow.com/q/25259864
tags question: http://stackoverflow.com/q/25387105
tags question: http://stackoverflow.com/q/25239944
type: Tag
tags question: http://stackoverflow.com/q/25346753
tags question: http://stackoverflow.com/q/25356989
tag name: grails
tags question: http://stackoverflow.com/q/25275386
tags question: http://stackoverflow.com/q/25357447
tags question: http://stackoverflow.com/q/25258083
tags question: http://stackoverflow.com/q/25346185
tags question: http://stackoverflow.com/q/25313020

http://stackoverflow.com/comment/73692780
has text: @daydreamer I have the similar issue. Have you figured it out?
type: AnswerComment
comment on: http://stackoverflow.com/a/25239145
score: 0
type: Comment

http://stackoverflow.com/comment/39341200
has text: You could write your own parser rather easily. Essentially going through each character and checking if it is '&', and whether or not the previous character is an escape character or not. If it is a valid separator character, you break off the characters you've read into a new string, and continue. Though I usually recommend importing the Guava libraries to any Java project, because they are incredibly useful.
comment on: http://stackoverflow.com/a/25250724
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25230385
has comment: http://stackoverflow.com/comment/39302057
accepted answer of: http://stackoverflow.com/q/25230226
has comment: http://stackoverflow.com/comment/39301548
answers question: http://stackoverflow.com/q/25230226
upvote count: 2
type: AcceptedAnswer
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/39302766
has body: You can use xpath and findElements for this: @Test public void testGuayaki() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Download")).click(); List&lt;WebElement&gt; downloadHeader = driver.findElements(By.xpath("//h2[contains(text(), 'Downloads')]")); if(downloadHeader.size() &gt; 0) { System.out.println("Found h2 header Downloads"); } } If you want to perform an exact match, you can modify the xpath as follows: //h2[text() = 'Downloads']
type: Answer

http://stackoverflow.com/comment/39399674
type: AnswerComment
comment on: http://stackoverflow.com/a/25282855
type: Comment
has text: Thanks that worked. My project is now running just fine on my device
score: 0

http://stackoverflow.com/comment/39518318
comment on: http://stackoverflow.com/q/25346968
score: 0
has text: Unless you do something weird, you can't produce characters with invalid encoding. In Java, you have String (and char) values, and the XML Writer uses the marshaller's setting to produce the encoded output. You'll have to provide more information for advice about what needs to be done, what may have gone wrong etc. What is the String value/unicode code point that produces those "invalid" characters?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39383250
comment on: http://stackoverflow.com/q/25273732
score: 0
type: QuestionComment
type: Comment
has text: You don't need to worry about newline characters, forget it -- java deals with that for you.

http://stackoverflow.com/comment/39366927
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25264767
score: 0
has text: @Mardoz - I am just reviewing the answers in the question you have provided to see if they can do what I require. I will update here shortly. Cheers

jax-ws
tags question: http://stackoverflow.com/q/25231177
tags question: http://stackoverflow.com/q/25372307
tags question: http://stackoverflow.com/q/25247358
tags question: http://stackoverflow.com/q/25384073
tags question: http://stackoverflow.com/q/25258888
type: Tag
tag name: jax-ws

http://stackoverflow.com/q/25272543
has answer: http://stackoverflow.com/a/48442472
answer count: 6
tagged with: spring
tagged with: spring-mvc
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/39380799
has comment: http://stackoverflow.com/comment/39380881
accepted answer: http://stackoverflow.com/a/25272687
has answer: http://stackoverflow.com/a/60871413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39380914
has answer: http://stackoverflow.com/a/25273113
has answer: http://stackoverflow.com/a/25272687
tagged with: java
linked to: http://stackoverflow.com/q/40113406
has answer: http://stackoverflow.com/a/76685126
has answer: http://stackoverflow.com/a/57740156
score: 40
downvote count: 1
favorite count: 0
has body: I am working with Spring MVC controller project. Below is my Controller and I have a constructor declared which I am specifically using for testing purpose. @Controller public class TestController { private static KeeperClient testClient = null; static { // some code here } /** * Added specifically for unit testing purpose. * * @param testClient */ public TestController(KeeperClient testClient) { TestController.testClient = testClient; } // some method here } Whenever I am starting the server, I am getting below exception - No default constructor found; nested exception is java.lang.NoSuchMethodException: But if I remove TestController constructor then it works fine without any problem. What wrong I am doing here? But if I add this default constructor then it starts working fine - public TestController() { }
type: Question
has comment: http://stackoverflow.com/comment/39380847
possible better answer: http://stackoverflow.com/a/25273113
upvote count: 41
has title: No default constructor found; nested exception is java.lang.NoSuchMethodException with Spring MVC?

http://stackoverflow.com/a/25295326
has body: You could use a for-loop and loop trough all the Layout's children via view. getChildAt(index) :)
answers question: http://stackoverflow.com/q/25295293
type: Answer
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39423141
upvote count: 1

http://stackoverflow.com/comment/39470339
score: 0
has text: Is there no Ant or Maven build file included?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25317650

http://stackoverflow.com/a/25324374
score: 1
type: Answer
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/82538064
accepted answer of: http://stackoverflow.com/q/25324170
has body: Branching statements(return ,goto ) should no be used inside finally because execution of such statement nullifies other instructions which are executed before finally. The Java Language Specification says : If execution of the try block completes abruptly for any other reason R, then the finally block is executed, and then there is a choice: If the finally block completes normally, then the try statement completes abruptly for reason R. If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and reason R is discarded). Note - A return statement inside a finally block will cause any exception that might be thrown in the try or catch block to be discarded.
answers question: http://stackoverflow.com/q/25324170

http://stackoverflow.com/a/25237102
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25236084
type: Answer
accepted answer of: http://stackoverflow.com/q/25236084
has body: Adding to the @Jigar Joshi answer , it is good practice to write the database details in separate config file . It is also useful in the case when you consider to change. as you said you many files holding this values you change them in one common place and load them to apply in all files. Create a config.properties file in your class path of your application. In your jsp read from the property file , so your code wont show them Properties props = new Properties(); FileInputStream fis = null; Connection con = null; fis = new FileInputStream("File.properties"); props.load(fis); // load the Driver Class Class.forName(props.getProperty("DB_DRIVER_CLASS")); // create the connection now con = DriverManager.getConnection(props.getProperty("DB_URL"), props.getProperty("DB_USERNAME"), props.getProperty("DB_PASSWORD")); in your jsp will do the job for you . but you to learn about optimizing the database through Datasource and also learn about connection pooling to avoid leaked connections. Hope this helps !!
downvote count: 0

http://stackoverflow.com/comment/44757543
comment on: http://stackoverflow.com/q/25365952
score: 0
type: Comment
has text: @NivethaT tried with InterClient versions 7.5.1 and 8.1.5. Do you suggest that we should try a newer InterClient version?
type: QuestionComment

cookies
tags question: http://stackoverflow.com/q/25277504
tags question: http://stackoverflow.com/q/25294677
tags question: http://stackoverflow.com/q/25279129
tag name: cookies
tags question: http://stackoverflow.com/q/25384534
tags question: http://stackoverflow.com/q/25262416
type: Tag
tags question: http://stackoverflow.com/q/25376443
tags question: http://stackoverflow.com/q/25246311
tags question: http://stackoverflow.com/q/25333612

http://stackoverflow.com/a/25316466
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25316151
has body: There is no need to use TestActivity.this instead use getActivity() also getResource().getString() would replaced with getString() btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String text = getString(R.string.test); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } });
score: 1

http://stackoverflow.com/comment/39497308
comment on: http://stackoverflow.com/q/25334370
score: 0
type: Comment
type: QuestionComment
has text: BTW: I dont think this is really "Junit" related - the title and the tags are rather missleading. You pretty much used JUnit correctly. And if you dont think so, replace it by if/println or just use a debugger.

http://stackoverflow.com/comment/39515445
score: 0
has text: did you check if you are accessing the page you really need ? User is not logged in. is what I get
type: QuestionComment
comment on: http://stackoverflow.com/q/25345401
type: Comment

http://stackoverflow.com/a/25279838
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39395378
accepted answer of: http://stackoverflow.com/q/25278784
score: 5
has comment: http://stackoverflow.com/comment/39394543
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39395083
has comment: http://stackoverflow.com/comment/39393822
downvote count: 0
answers question: http://stackoverflow.com/q/25278784
has comment: http://stackoverflow.com/comment/39395421
has body: First add this block after description tag <test.users>30</test.users> <test.tiff>true</test.tiff> Add after executions tag this block: ${test.users} ${test.tiff} Then run; mvn -Dtest.users=50 -Dtest.tiff=true verify

http://stackoverflow.com/q/25342489
possible better answer: http://stackoverflow.com/a/25342684
has answer: http://stackoverflow.com/a/25342684
tagged with: mysql
has body: I'm developing a small wab project with Netbeans 7.4, Maven, JSF 2.2, Primefaces 5.0, Hibernate 3.6.10 and Spring 3.2.3. I have these MySQL tables/relationships: CREATE TABLE `usuarios` ( `usu_nick` varchar(25) NOT NULL, `usu_pass` varchar(20) default NULL, `usu_rol` char(3) NOT NULL, PRIMARY KEY (`usu_nick`), KEY `usu_rol` (`usu_rol`) ) ENGINE = innodb CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE TABLE `roles` ( `rol_cod` char(3) NOT NULL, `rol_per` char(3) NOT NULL, `rol_des` varchar(25) default NULL, PRIMARY KEY (`rol_cod`), KEY `rol_per` (`rol_per`) ) ENGINE = innodb CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE TABLE `permisos` ( `per_cod` char(3) NOT NULL, `per_des` varchar(25) default NULL, `per_lvl` tinyint default NULL, PRIMARY KEY (`per_cod`) ) ENGINE = innodb CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE TABLE `datosusu` ( `datosusu_cod` varchar(25) NOT NULL, `datosusu_fecalta` date default NULL, `datosusu_fecbaja` date default NULL, `datosusu_nomfisc` varchar(100) default NULL, `datosusu_nomcomer` varchar(100) default NULL, `datosusu_nifcif` varchar(15) default NULL, `datosusu_contacto` varchar(100) default NULL, `datosusu_tlfempre` varchar(15) default NULL, `datosusu_tlfparti` varchar(15) default NULL, `datosusu_fax` varchar(15) default NULL, `datosusu_mailempre` varchar(50) default NULL, `datosusu_mailparti` varchar(50) default NULL, `datosusu_dir` varchar(50) default NULL, `datosusu_cp` varchar(5) default NULL, `datosusu_localidad` varchar(50) default NULL, `datosusu_prov` char(2) NOT NULL, `datosusu_zona` char(3) NOT NULL, `datosusu_tipo` char(3) NOT NULL, `datosusu_titular` varchar(100) default NULL, `datosusu_sucur` varchar(50) default NULL, `datosusu_ccc` varchar(30) default NULL, `datosusu_web` varchar(20) default NULL, `datosusu_cargo` varchar(20) default NULL, `datosusu_foto` varchar(100) default NULL, `datosusu_des` varchar(500) default NULL, `datosusu_lat` double default NULL, `datosusu_lon` double default NULL, PRIMARY KEY (`…
type: Question
tagged with: primefaces
tagged with: java
tagged with: hibernate
has title: Hibernate saving one to one objects
accepted answer: http://stackoverflow.com/a/25461893
tagged with: spring
has answer: http://stackoverflow.com/a/25461893
type: AnsweredQuestion
score: 0
answer count: 2

http://stackoverflow.com/a/25355633
type: Answer
answers question: http://stackoverflow.com/q/25349803
score: 2
has body: jsoup only provides manipulation of HTML. It can get you slight further than your attempt but not much: Element el = doc.select("p.critic_status").last(); Will get you the element containing: "Rotten: 10 liked it Average Rating: 3.7/5 User Ratings: 313,393" This is because there are no further sub-elements to be able to dig into. To extract the data you want will require using other text-processing tools. For example using regular expressions: Pattern pattern = Pattern.compile("User Ratings: ([0-9,]+)"); Matcher = pattern.matcher(el.text()); if(matcher.matches()) { String userRating = matcher.group(1); // "313,393" } For your second question, you need to chain selectors: doc.select("div.txt-block"); // &lt;div class=&lt;txt-block"&gt; doc.select("div.txt-block &gt; h4.inline"); // &lt;h4 class="inline"&gt; doc.select("div.txt-block &gt; a[itemprop=url]"); // &lt;a href="..." itemprop="url"&gt; jsoup selectors are documented in the Selector class. Also Jsoup is modelled after jQuery so that documentation is also useful: jsoup: org.jsoup.select.Selector jQuery: Selectors
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/25244266
type: Answer
has comment: http://stackoverflow.com/comment/39328309
score: 0
has comment: http://stackoverflow.com/comment/39328249
has body: Your List "pressureUnits" is empty. You've specified that it is a list of Pressures but not added anything to it. Usually this is done with the "add" method, i.e. pressureUnits.add(...). However what I think you want to use is Enums.Pressures.values(). This will return an array containing each of your enum elements. Then you will be able to create an adapter using that array. If you can't do it with the BaseAdapter you are using now, have a look at using the ArrayAdapter class rather than the BaseAdapter.
answers question: http://stackoverflow.com/q/25244090

http://stackoverflow.com/q/25248755
has answer: http://stackoverflow.com/a/25248803
favorite count: 0
possible better answer: http://stackoverflow.com/a/25248803
type: AnsweredQuestion
tagged with: custom-object
has title: In Java HashSet, how it calculate hashCode for custom object?
has comment: http://stackoverflow.com/comment/39336576
tagged with: hashcode
score: 1
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/25248782
accepted answer: http://stackoverflow.com/a/25248782
linked to: http://stackoverflow.com/q/2427631
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/2427631
tagged with: hashmap
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39336584
has body: If we do not override the hashCode(), how it calculate hashCode for custom object by default? i.e. class TrieNode { Character letter; TrieNode parent; Map&lt;Character, TrieNode&gt; children; boolean isEndOfWord; TrieNode(Character letter, TrieNode parent, boolean isEndOfWord) { this.letter = letter; this.parent = parent; this.isEndOfWord = isEndOfWord; children = new HashMap&lt;Character, TrieNode&gt;(); } } Usage: Set&lt;TrieNode&gt; set = new HashSet&lt;TrieNode&gt;(); TrieNode trieNode = new TrieNode('c', parentNode, true); set.add(trieNode); Note: If we do not override the "hashCode()". Clarify Question: By default, how this HashSet calculate the hashCode for this custom object? Where to find it in the Java doc? Addition: I have tried to find it in the Java doc, but did not get it. I have tried to find these places: HashSet.class AbstractSet.class Object.class System.class

http://stackoverflow.com/a/25375523
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/25375228
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25375228
has body: Well, looks like I'm looking for Spring's "ResponseBodyAdvice" and "AbstractMappingJacksonResponseBodyAdvice".
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/39576225

http://stackoverflow.com/a/25356896
type: Answer
score: 0
has body: Here is your toString, method: public String toString() { NumberFormat fmt = NumberFormat.getCurrencyInstance(); return ("Annual Salary: " + fmt.format(salary) + "\n" + "Total Sales: " + fmt.format(sales) + "\n" + "Total Commission: " + fmt.format(getCommission()) + "\n" + "Total Annual Compensation: " + fmt.format(getCompensation())); } commission and compesantion variables were not set.
answers question: http://stackoverflow.com/q/25356789

http://stackoverflow.com/a/25375488
type: Answer
answers question: http://stackoverflow.com/q/25375418
score: 0
has comment: http://stackoverflow.com/comment/39575794
has comment: http://stackoverflow.com/comment/39575769
has comment: http://stackoverflow.com/comment/39574074
has body: This kind of error happen when jre jar file are not in build path. Add jar file to the build path and try to run again.
has comment: http://stackoverflow.com/comment/39573574

http://stackoverflow.com/comment/39597221
has text: another information: it takes around 8seconds until the database times out.
score: 0
comment on: http://stackoverflow.com/q/25388889
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25342245
downvote count: 0
upvote count: 1
has body: Its actually string property that you need to assign the value after calling these method, Lets take an example even if: String S1= "Hello"; S1.concat("World"); and if you print the value of S1 it will print only "Hello". but if you write like this: S1=S1.concat(" World"); then it will print "Hello World". Similarly you need to assign the value as: s1=s1.intern(); s2=s2.intern(); and if you compare s1==s2 it will return true value but, Lets say: String s3=s1.intern(); String s4=s2.intern(); and if you compare s3==s4 then its true but (s3==s1) and (s4==s2) are false.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25341634

http://stackoverflow.com/a/25308557
has body: Pattern pattern = Pattern.compile("Balance: \\$([0-9]*(?:\\.[0-9]*)?)");
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25308478

http://stackoverflow.com/a/25348809
answers question: http://stackoverflow.com/q/25337233
score: 0
has body: double quotes encloses Strings and single quotes encloses Chars.
type: Answer

http://stackoverflow.com/q/25249480
has answer: http://stackoverflow.com/a/25249651
answer count: 2
accepted answer: http://stackoverflow.com/a/25341781
has comment: http://stackoverflow.com/comment/39339110
has answer: http://stackoverflow.com/a/25341781
has body: I'm creating a media player app for Android. I have two threads: one producing audio frames, and another consuming those frames. I want my customer to be able to experiment with using different sizes of ArrayBlockedQueue's, from "no" buffering (really 1) to up to 10 blocks of buffering. I can't seem to find any classes in Java that provide a similar functionality to ArrayBlockedQueue, but allows me to dynamically make the list of items longer/shorter. Question 1) Does anyone know of a class that functions similar to ArrayBlockedQueue, yet allows me to change the amount of items to hold? Then I had a strange thought: Could I fudge it? Could I create a new ArrayBlockedQueue with the new size, and step through copying the 1-10 items that are currently in the old ArrayBlockedQueue and putting them into the new ArrayBlockedQueue, and then storing a pointer to the new ArrayBlockedQueue over the old one? Since there'll never be more than 10 (or whatever my buffer limit is), it shouldn't take too much time copying the items to the new array. Question 2) Is that a "reasonable" way to approach an ArrayBlockedQueue implementation that still gives me flexibility? Question 3)Is there a better way to approach this? -Ken
type: Question
type: AnsweredQuestion
score: 0
has title: In Java how do I change the length of a ArrayBlockedQueue?
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39379556
tagged with: concurrency
possible better answer: http://stackoverflow.com/a/25249651

http://stackoverflow.com/comment/39351770
comment on: http://stackoverflow.com/q/25256474
type: Comment
has text: @pratik yes but my background have gradiant.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39553721
has text: I'm interested in which(in the sense variable or combination of variable is null) and act accordingly
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25366441
score: 0

http://stackoverflow.com/comment/39823695
type: Comment
has text: Put all your comments to question.
type: QuestionComment
comment on: http://stackoverflow.com/q/25367402
score: 0

http://stackoverflow.com/comment/39445601
comment on: http://stackoverflow.com/a/25293524
has text: The `x` was just an example showing that it could be _any_ character. In Regular Expressions, _any character_ is expressed as **\w**. Also, in Regular Expressions, the **[** is a reserved keyword or character, and is used for ranges, so, in order to tell the compiler we want the **explicit [**, we should escape it by using the back slash, therefore we shall write it as `\[`
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/53414458
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25284724
type: Answer
has body: I realize this is pretty old but it is one of the only examples I have found for reading and writing to a socket with clojure. I needed to experiment a bit to get your code working so it might be useful to someone to the results of that effort: (import (java.net Socket)) (import (java.io DataInputStream DataOutputStream)) (def IPaddress "127.0.0.1") (def port 1500) (def command "Some string\n") (def socket (Socket. IPaddress port)) (def in (DataInputStream. (.getInputStream socket))) (def out (DataOutputStream. (.getOutputStream socket))) (println "Input:" command) (.writeUTF out command) (def response (.readLine in)) (println "Output: " response)
upvote count: 3

http://stackoverflow.com/comment/39527456
type: Comment
has text: As @jim said onClick() is not the 30th line in your code..
type: QuestionComment
comment on: http://stackoverflow.com/q/25352185
score: 0

http://stackoverflow.com/q/25340608
has answer: http://stackoverflow.com/a/25348393
has title: Unable to load XML configuration file from relative path
has comment: http://stackoverflow.com/comment/39508201
answer count: 1
tagged with: relative-path
accepted answer: http://stackoverflow.com/a/25348393
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39509153
tagged with: path
tagged with: java
has body: My Java program is supposed to load a configuration file from a relative path. First, the configuration file was loaded from a full path and it's worked fine. Now i'm trying to load the configuration file from the relative path, so at the end the configuration file will be loaded from the same path of the exe file. Here is the code. could anyone tell my what wrong with that? I marked the problematic line with a comment. Main class: public class App { private static Object string; public static void main(String[] args) { CsvConfiguration conf = CsvConfiguration.getInstance(); } CsvConfiguration class (relevant parts): public class CsvConfiguration { private static CsvConfiguration instance = null; private static Document doc = null; static{ URI path; try { path = Thread.currentThread().getClass().getClassLoader().getResource("/csv-generator/src/main/config/config.xml").toURI(); //my program is collapsing in this line DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new File(path)); doc.getDocumentElement().normalize(); } catch (URISyntaxException e) { throw new RuntimeException("Config is unparsable"); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } catch (SAXException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } private CsvConfiguration(){ try{ setGenerationRate(); setNumberOfRows(); setNumberOfColumns(); setOutputFolder(); }catch(NumberFormatException nExc){ throw new RuntimeException(nExc); } catch (IOException e) { throw new RuntimeException(e); } setColumnsList(); } public synchronized static CsvConfiguration getInstance(){ if (instance==null) instance = new CsvConfiguration(); return instance; }
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/comment/45192280
comment on: http://stackoverflow.com/q/25246571
type: QuestionComment
type: Comment
has text: @MartinR thank you, wait for release
score: 0

http://stackoverflow.com/a/25276077
score: 5
has body: javaw seems to be what you are looking for: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason. If you are looking to hide the windows .bat console, you can use vbs -- take a look at this page for various options for doing this: https://superuser.com/questions/62525/run-a-completly-hidden-batch-file .
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25276014
answers question: http://stackoverflow.com/q/25276014
upvote count: 5
type: Answer

http://stackoverflow.com/comment/39631862
type: Comment
score: 0
has text: You're not [the first person](https://github.com/RNCryptor/JNCryptor/issues/11) to mention JNCryptor is slow to decrypt on Android. I'd welcome your input on that issue, because I'd like to understand the root cause. Please feel free to post some information about your environment into that GitHub issue.
type: QuestionComment
comment on: http://stackoverflow.com/q/25345075

http://stackoverflow.com/a/25298595
accepted answer of: http://stackoverflow.com/q/25298169
type: Answer
has body: If you want to just lookup values with a string then use a Map like Michael suggested. However, if you want to do something more based on a string, then use a switch statement (as of Java 7). String input = ....; switch(input) { case "input1": // do stuff break; case "input2": // do stuff } More info: http://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html
answers question: http://stackoverflow.com/q/25298169
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39507744
comment on: http://stackoverflow.com/a/25340503
has text: Do it as..first try to comment the try catch block--> ClassNotFound excption will be thrown away....now comment //Class cls = Class.forName("testError") and uncomment try catch block..this time it will work fine..Why???..if the ClassNotFound exception is there then the control must have gone into try catch block and should have printed "Error found"
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25344052
has comment: http://stackoverflow.com/comment/39513231
has title: Writing a serialized object to file garbaged?
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: file
type: Question
accepted answer: http://stackoverflow.com/a/25344090
has answer: http://stackoverflow.com/a/25344090
has body: try { File dataFile = new File("C:/Users/keatit/Desktop/players.txt"); if(!dataFile.exists()) { dataFile.createNewFile(); } FileOutputStream fos = new FileOutputStream("C:/Users/keatit/Desktop/players.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(players); oos.close(); } catch(FileNotFoundException fnfex) { System.out.println(fnfex.getMessage()); } catch(IOException ioex) { System.out.println(ioex.getMessage()); } I have a class player which implement Serializable but when I write objects to files the text is messed up and looks like the following. Any help would be much appreciated. Thank you. "¬í sr java.util.ArrayListxÒ™Ça I sizexp w sr players.playerÌ`~%×êòœ I ageL firstNamet Ljava/lang/String;xp t Trevorsq ~ t Michaelax"
answer count: 1

http://stackoverflow.com/comment/39312351
has text: Thank you, your solution works for me. But I am still trying to understand why mine doesn't :P
comment on: http://stackoverflow.com/a/25235539
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25314941
type: Question
has title: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined - Java Based Configuration
has answer: http://stackoverflow.com/a/25316617
has answer: http://stackoverflow.com/a/34546911
tagged with: spring
tagged with: spring-mvc
answer count: 2
type: UnansweredQuestion
score: 1
has body: Trying to resolve org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined in Java based configuration. web.xml <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation com.examples.config.WebAppConfig 1 appServlet / springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* 404 /WEB-INF/views/error/404.jsp The WebAppCinfig java based: @EnableWebMvc @Configuration @Import(value = SecurityConfig.class) @ComponentScan(basePackages = {"com.examples"}) @ImportResource({ "classpath:spring-security-config.xml" }) public class WebAppConfig extends WebMvcConfigurerAdapter { public WebAppConfig() { super(); } @Override public void addViewControllers(final ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/anonymous.html"); registry.addViewController("/login.html"); registry.addViewController("/homepage.html"); } @Bean public ViewResolver viewResolver() { final InternalResourceViewResolver bean = new InternalResourceViewResolver(); bean.setViewClass(JstlView.class); bean.setPrefix("/WEB-INF/views/"); bean.setSuffix(".jsp"); return bean; } } The SecurityConfig.java file for the security: @Configuration @ImportResource({ "classpath:spring-security-config.xml" }) public class SecurityConfig { public SecurityConfig() { super(); } } And finally the WebAppConfig.java class: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework.org/schema/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.sp…
tagged with: java
downvote count: 0
upvote count: 1
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/a/25318414
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25318314
has body: Here is your mistake. super(context, DATABASE_NAME, null, 1); you always setting the database version to 1! So you never update the database. change is to 2.
answers question: http://stackoverflow.com/q/25318314
type: Answer
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39348992
type: QuestionComment
has text: thanks for responding! mvn appengine:devserver
comment on: http://stackoverflow.com/q/25254514
score: 0
type: Comment

http://stackoverflow.com/q/25266028
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25266124
favorite count: 0
has answer: http://stackoverflow.com/a/25266124
type: AnsweredQuestion
has body: I'm working with two sets of data that contain complex java objects that I've created. Let's say that the elements contained are of type People.java, that has a String name and an int age. Let's say I have these sets: Set1 = [{James, 25}, {Arthur, 18}, {Anne, 22}] Set2 = [{Arthur, 18}, {James, 25}] I'm trying to get the asymmetrical difference between set1 and set2 so that the result of that difference is {Anne, 22}. I've tried storing the elements in HashSets and using set1.removeAll(set2), but the answer equals set1. Important to note is that each element is a different instance, meaning that I created a Person object for {James, 25} in set1 and a new Person object for {James, 25} in set2 (there's a reason why they are different instances, since I'm simplifying the project's goal). I also tried Google's Guava's difference, but the answer remains equal to set1. I have two questions: 1) Why is that happening? Is is because since they're different instances, the removeAll process considers them to be different? 2) What's a good way to get the asymmetrical difference in this case? I'm guessing using a Comparator, but I'm open to suggestions. Thanks!
answer count: 3
tagged with: java
score: 1
has answer: http://stackoverflow.com/a/25266111
type: Question
has title: Asymmetrical difference between sets
possible better answer: http://stackoverflow.com/a/25266077
has answer: http://stackoverflow.com/a/25266077

http://stackoverflow.com/comment/39557009
has text: Test `Date date = new SimpleDateFormat("dd/MM/yyyy").parse(" 14/08/2010 ");` Works fine for me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25368116
type: Comment

http://stackoverflow.com/comment/39313623
comment on: http://stackoverflow.com/a/25236363
score: 0
type: AnswerComment
has text: @recursive well, you're wrong! The code above **does** create a new object with a distinct address in memory (on the heap). Try: `String s1 = new String(); String s2 = new String(); System.out.println(s1 == s2);` it'll print `false` - cause the objects are not the same! For more info - see my answer below.
type: Comment

http://stackoverflow.com/a/25375854
type: Answer
score: 0
has body: Put this to your MainActivity1 in your button Intent dialogIntent = new Intent(getBaseContext(), MainActivity2.class); dialogIntent.putExtra("message", "calling MainActivity2.class"); dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplication().startActivity(dialogIntent); and put this to your MainActivity2 inside onCreate() String message = getIntent().getStringExtra("message"); if(message != null){ Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); }
answers question: http://stackoverflow.com/q/25375602
has comment: http://stackoverflow.com/comment/39574099
has comment: http://stackoverflow.com/comment/39573875

http://stackoverflow.com/comment/39336405
comment on: http://stackoverflow.com/q/25248147
score: 0
type: Comment
type: QuestionComment
has text: oh no 'files' is an ArrayList of strings, just storing the first part of a file name

http://stackoverflow.com/a/57083057
downvote count: 0
answers question: http://stackoverflow.com/q/25272391
has body: This is what worked for me Firstly a resttemplate needs to be mocked in the test class @Mock private RestTemplate mockRestTemplate; Since ResponseEntity returns an Object create another method that returns the expected response wrapped in ResponseEntity private ResponseEntity<Object> generateResponseEntityObject(String response, HttpStatus httpStatus){ return new ResponseEntity<>(response, httpStatus); } In your test case, you can now mock the expected response as follows String string = "result"; when(mockRestTemplate.postForEntity(anyString(), any(), any())) .thenReturn(generateResponseEntityObject(string, HttpStatus.OK));
upvote count: 5
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/123758378
has comment: http://stackoverflow.com/comment/136988888

http://stackoverflow.com/comment/39308436
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25233783
type: Comment
has text: when foo() throws the exception he is not inside the bar code block yet. It will first execute foo() then pass the return to bar()

http://stackoverflow.com/comment/39517471
has text: @immibis I know that my solution works, but I also know that any good programming language doesn't parse code the way I do.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25346555

http://stackoverflow.com/q/25366844
has comment: http://stackoverflow.com/comment/39554471
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25366893
tagged with: nullpointerexception
answer count: 3
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25366862
has title: I pass a string -> NullPointerException
type: AnsweredQuestion
downvote count: 8
upvote count: 0
score: -8
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25366862
has comment: http://stackoverflow.com/comment/39554365
possible better answer: http://stackoverflow.com/a/25366867
favorite count: 0
has body: I am writing a ADnroid app, and when i pass a string at this point, I get a nullpointer ...Does someone know why? Code Elements titles = doc.select("h3 a"); String[] titlelist = null; Bitmap[] bitmaps = null; outputText = ""; int i = 0; for (Element title : titles) { titlelist[i] = title.text(); // &lt;--- here comes the NullPointer i = i + 1; } Log: 08-18 17:17:54.522 26470-26470/de.m4lik.somesampleapp E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: de.m4lik.somesampleapp, PID: 26470 java.lang.NullPointerException at de.m4lik.somesampleapp.MainActivity$TheTask.onPostExecute(MainActivity.java:95) at de.m4lik.somesampleapp.MainActivity$TheTask.onPostExecute(MainActivity.java:68) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) ... The doc.select part is jsoup code where i select headings from a website.
has answer: http://stackoverflow.com/a/25366867
type: Question

class
tags question: http://stackoverflow.com/q/25288850
tags question: http://stackoverflow.com/q/25245654
tags question: http://stackoverflow.com/q/25303277
type: Tag
tags question: http://stackoverflow.com/q/25378611
tags question: http://stackoverflow.com/q/25373034
tags question: http://stackoverflow.com/q/25241759
tags question: http://stackoverflow.com/q/25345923
tags question: http://stackoverflow.com/q/25260546
tags question: http://stackoverflow.com/q/25341916
tags question: http://stackoverflow.com/q/25371453
tags question: http://stackoverflow.com/q/25288499
tag name: class
tags question: http://stackoverflow.com/q/25245907
tags question: http://stackoverflow.com/q/25305872
tags question: http://stackoverflow.com/q/25381903
tags question: http://stackoverflow.com/q/25334353
tags question: http://stackoverflow.com/q/25247669
tags question: http://stackoverflow.com/q/25379560
tags question: http://stackoverflow.com/q/25378772
tags question: http://stackoverflow.com/q/25231752
tags question: http://stackoverflow.com/q/25247006
tags question: http://stackoverflow.com/q/25318925
tags question: http://stackoverflow.com/q/25366924
tags question: http://stackoverflow.com/q/25336811
tags question: http://stackoverflow.com/q/25340310
tags question: http://stackoverflow.com/q/25237345
tags question: http://stackoverflow.com/q/25341737
tags question: http://stackoverflow.com/q/25330769
tags question: http://stackoverflow.com/q/25233853
tags question: http://stackoverflow.com/q/25362990
tags question: http://stackoverflow.com/q/25256885

http://stackoverflow.com/a/25258618
has comment: http://stackoverflow.com/comment/61949453
has comment: http://stackoverflow.com/comment/39355199
has comment: http://stackoverflow.com/comment/39356043
answers question: http://stackoverflow.com/q/25258529
accepted answer of: http://stackoverflow.com/q/25258529
type: Answer
score: 4
has body: problem: Arrays.asList(array) You cant transform an array of primitive types to Collections that it needs to be an array of Objects type. Since asList expects a T... note that it needs to be an object. why is it working? That is because upon passing it in the parameter it will autoBox it since array are type object. solution: You need to change it to its wrapper class, and use it as an array. sample: Long[] array = new Long[]{1L, 2L, 3L}; JSONArray jsonArray = new JSONArray(Arrays.asList(array)); jsonArray.toString(); result: [1, 2, 3]
upvote count: 4
has comment: http://stackoverflow.com/comment/39355188
has comment: http://stackoverflow.com/comment/39355157
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39524781
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25350728
has text: The only connection is the hotspot. When its on (the hotspot) the user can enter to my local site (my tablet is the server for this site). When the user click send to send his details i would never have an Internet connection. Can i update my sqlite database that i created in my android app, from the javascript and it will works for the browsers i wrote above??

http://stackoverflow.com/comment/39582068
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25362553
has text: Google does not allow access.

http://stackoverflow.com/q/25259315
has body: I'm working with an OpenCV Java code, and I have a problem: the method dilate needs a matrix so it can perform the transform, but what kind of matrix returns Mat() when it doesn't have any parameters? I know that in Python you define a matrix with cv2.getStructuringElement or numpy, but I don't understand this type of call. Here's an example, any suggestions? Thanks! Imgproc.dilate(cannyImg, cannyImg, new Mat());
accepted answer: http://stackoverflow.com/a/25259568
tagged with: opencv
type: AnsweredQuestion
score: 0
tagged with: matrix
tagged with: java
answer count: 1
has title: How Mat() works on dilate?
type: Question
has answer: http://stackoverflow.com/a/25259568
tagged with: python

http://stackoverflow.com/a/25378702
type: Answer
answers question: http://stackoverflow.com/q/25378616
upvote count: 2
score: 2
downvote count: 0
type: AcceptedAnswer
has body: I would have said to use something like (Where file is actually f for you): Desktop.getDesktop().open(File file) See the documentation here: http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html#open%28java.io.File%29
accepted answer of: http://stackoverflow.com/q/25378616

http://stackoverflow.com/q/25335183
tagged with: regex
has comment: http://stackoverflow.com/comment/39498097
tagged with: parentheses
type: AnsweredQuestion
has body: I've been stuck trying to write a regular expression in Java to remove everything in the parenthesis below while preserving everything else. Note that the parenthesis can be nested, and I think this is why my pattern fails. Can someone help me? Below I tried: String testData = "1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. Nf3 O-O 6. Be2 e5 7. dxe5 dxe5 8. Qxd8 Rxd8 9. Bg5 Nbd7 10. O-O-O {Diagram [#]} " + "Rf8 (10... Re8 11. Nb5 (11. Nd5)) (10... h6 11. Bxf6 Bxf6 12. Nd5) 11. Nd5 c6 (11... Nxe4 12. Nxc7 Rb8 13. Be3 b6 ) 12. Ne7+ Kh8 13. " + "Nxc8 Raxc8 14. Bxf6 (14. Be3) 14... Nxf6 15. Nd2 (15. Bd3) 15... Bh6 16. f3 Nd7 17. Kc2 Bxd2 (17... Rcd8 18. b4) 18. Rxd2 Nc5 19. b4 Ne6 20. Rd7 b5 " + "(20... Rcd8 21. Rxb7 Nd4+ 22. Kd3) 21. Rxa7 Nd4+ 22. Kd3 Rcd8 23. Ke3 Nc2+ 24. Kf2 Rd2 25. Rd1 Rfd8 26. Rxd2 {Diagram [#]} (26. cxb5 cxb5 " + "27. Rc7 Rxd1 28. Bxd1 Rd2+ 29. Kg3 Ne1 30. Bb3 f6 31. Rf7 Nxg2 32. Rf8+ Kg7 33. Rf7+ Kh6 34. Rxf6 Nf4 35. Kh4 (35. Rxf4 exf4+ 36. Kxf4 Rxh2) 35... " + "Rxh2+ 36. Kg4 Rg2+ 37. Kh4 Nd3 38. a3 Rh2+ 39. Kg4 Rh1 40. Rc6 {Diagram [#]}) 26... Rxd2 27. Kf1 Nd4 28. cxb5 cxb5 29. a4 (29. Rd7 Rxa2 30. Bd3 Ra3 31. " + "Be2 Ra1+ 32. Kf2 Ra2 ) (29. Bxb5 Nxb5) 29... Rxe2 (29... bxa4 30. Bc4) 30. axb5 Rb2 31. b6 Rxb4 32. b7 Kg7 "; testData = testData.replaceAll(Pattern.quote("{") + ".*" + Pattern.quote("}"), "") .replaceAll(Pattern.quote("(") + ".*" + Pattern.quote(")"), "") .replaceAll(Pattern.quote("$") + "[0-9]+", ""); System.out.println(testData); but this prints: d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. Nf3 O-O 6. Be2 e5 7. dxe5 dxe5 8. Qxd8 Rxd8 9. Bg5 Nbd7 10. O-O-O Rf8 ) 11. Nd5 c6 12. Ne7+ Kh8 13. Nxc8 Raxc8 14. Bxf6 14... Nxf6 15. Nd2 15... Bh6 16. f3 Nd7 17. Kc2 Bxd2 18. Rxd2 Nc5 19. b4 Ne6 20. Rd7 b5 21. Rxa7 Nd4+ 22. Kd3 Rcd8 23. Ke3 Nc2+ 24. Kf2 Rd2 25. Rd1 Rfd8 26. Rxd2 35... Rxh2+ 36. Kg4 Rg2+ 37. Kh4 Nd3 38. a3 Rh2+ 39. Kg4 Rh1 40. Rc6 ) 26... Rxd2 27. Kf1 Nd4 28. cxb5 cxb5 29. a4 29... Rxe2 30. axb5 Rb2 31. b6 Rxb4 32. b7 Kg7 which is obvious…
upvote count: 3
has answer: http://stackoverflow.com/a/25335225
accepted answer: http://stackoverflow.com/a/25335225
answer count: 2
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25335576
has comment: http://stackoverflow.com/comment/39497892
has answer: http://stackoverflow.com/a/25335576
favorite count: 0
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39497837
has title: Regexp to remove nested parenthesis

http://stackoverflow.com/comment/41377129
type: AnswerComment
has text: OpenSessionInView will never have this "N+1 effect", that would'nt make any sense. Only _ONE_ session will be opened and every entity-lookup within that will be handled normally - most likely via JOINs, depending on your fields. You have obviously not understood how the open-session-in-view method works. The one and only problem with it is : in bad situations (and with bad coding) your user may not get any information if your transaction actually got rolled back or even failed, dending on your transaction-configuration.
type: Comment
comment on: http://stackoverflow.com/a/25367976
score: 0

http://stackoverflow.com/a/25248708
accepted answer of: http://stackoverflow.com/q/25248634
answers question: http://stackoverflow.com/q/25248634
has body: I personally like SVNKit for Java. I have used both the IDE plugins and the API itself and it provides plenty of functionality for interfacing with an SVN and diffing specific files
score: 3
type: Answer
upvote count: 3
type: AcceptedAnswer
downvote count: 0

append
tags question: http://stackoverflow.com/q/25305933
tags question: http://stackoverflow.com/q/25355041
tag name: append
tags question: http://stackoverflow.com/q/25273818
type: Tag

http://stackoverflow.com/comment/39591865
has text: myjar-1.0.jar
comment on: http://stackoverflow.com/q/25386409
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25374538
linked to: http://stackoverflow.com/q/266373
answer count: 1
linked to: http://stackoverflow.com/q/504103
type: Question
has body: I know how to profile methods in netbeans to see which one is taking the most time, but I wonder if there is a way to find which line of statements in that method is responsible for that.
has comment: http://stackoverflow.com/comment/39622820
tagged with: profiler
has comment: http://stackoverflow.com/comment/39580584
has title: how to profile a statement used in a method in java
accepted answer: http://stackoverflow.com/a/25374648
type: AnsweredQuestion
tagged with: netbeans
score: 0
has answer: http://stackoverflow.com/a/25374648
tagged with: java

http://stackoverflow.com/comment/39461884
type: AnswerComment
has text: @darlik I would not really recommend for you to use global instance of it. it is really a bad design, but if you really want it then set global instance(`Resources res;`) of it but initialized it in your `onCreate()` -> `res = getResources()`.
score: 0
comment on: http://stackoverflow.com/a/25316199
type: Comment

http://stackoverflow.com/q/25270461
answer count: 0
upvote count: 3
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39379757
tagged with: classloader
type: UnansweredQuestion
has title: How to getResource from Bootstrap Class Loader?
has comment: http://stackoverflow.com/comment/39381350
score: 3
has body: In a Java application, the Bootstrap Class Loader (which is used to load classes from JRE such as rt.jar) is null. That is, java.util.ArrayList.class.getClassLoader() == null. This is annoying because when writing a library that uses reflection, one must use the appropriate class loader, which sometimes is null. So in case the ClassLoader is null, a library should call Class.forName(String, false, classLoader) instead of classLoader.loadClass(String). By the way, the static method Proxy.newProxyInstance(classLoader, interfaces, invocationHandler) works fine when the classLoader is null. But is there any equivalent of ClassLoader.getResource(String) or ClassLoader.getResources(String) that works even when the classLoader is null? The closest I can think of is new ClassLoader(classLoader).getResource(String), but that uses extra SecurityManager permissions than necessary.

http://stackoverflow.com/q/25314989
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39459895
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/25315115
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39459691
has body: I believe I have finally understood WeakReference and I wanna make sure I'm not mistaken. Consider a Map&lt;Client,Callback&gt; clientMap that is a private attribute of a Singleton class called MyService that we use to map registered clients to their respective callbacks. Now consider the following code: // We register a client and it's callback MyService.getInstance().register(client,callback); // .. some code happens .. // At this point, we decide client no longer lives anymore client = null; Up to this point, even though client is now pointing to null, the clientMap stills has a reference to the address client was previously pointing to, causing a memory leak. Am I correct? If question 1 is YES, Then continue: we decide that to prevent memory leak, we should remove the object from the client map too: client = null; MyService.getInstance().unregister(client); // This methods calls Map#remove(Client) Now we have fixed the memory leak. Am I still correct? If question 2 is YES: Due to some unexplained issues, we can't really call Map#remove() so this is where WeakReference comes in. By using Map&lt;WeakReference&lt;Client&gt;, WeakReference&lt;Callback&gt;&gt; clientMap, the reference counter won't increase, and once we set client = null; it automatically deletes it from the clientMap Am I still still correct?
type: Question
tagged with: weak-references
has title: Understanding WeakReference
has answer: http://stackoverflow.com/a/25315254

http://stackoverflow.com/comment/122803620
type: AnswerComment
has text: If the system wall clock is changed while you're waiting on the condition, you might get a deadlock (or an early wait) if the condition is never met. You should use a monotonic clock for these kind of situations.
comment on: http://stackoverflow.com/a/50757591
score: 2
type: Comment

http://stackoverflow.com/a/25258721
answers question: http://stackoverflow.com/q/25256199
type: Answer
score: 0
has body: Let's start with the progress bar..zk provides a component..you can see here how it works and how implement it. Now for your task, you can easily use Event Queues. If you have any problems just ask. Greets

http://stackoverflow.com/comment/39472252
type: Comment
type: AnswerComment
has text: That's finding the count, which apparently *isn't* what the OP wants. Oh, and you're never declaring or initializing `max`, *or* resetting `maxCount` when changing `max`. With "1,2,3,4,5,6" your code would report a max of 6 and a count of 6.
score: 0
comment on: http://stackoverflow.com/a/25321890

http://stackoverflow.com/q/25252441
tagged with: numbers
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39344471
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39345394
has comment: http://stackoverflow.com/comment/39343965
answer count: 1
favorite count: 0
has title: If any object of the java abstract class "Number" is equal to zero
has comment: http://stackoverflow.com/comment/39343943
has comment: http://stackoverflow.com/comment/39343911
type: Question
accepted answer: http://stackoverflow.com/a/25252533
has comment: http://stackoverflow.com/comment/39343988
has body: I'm trying to make a generic function that takes any type of Number and conditionally does something if that number is equal to zero. I want anyone to be able to pass it any of the classes that extend Number (BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, or Short) So far, I've attempted to use instanceof to find out what type the number is, then compare it to an equivalent type public static boolean isZero(Number number) { if (number instanceof BigDecimal) { return BigDecimal.ZERO.equals(number); } else if (number instanceof BigInteger) { return BigInteger.ZERO.equals(number); } else if (number instanceof Byte) { return new Byte((byte) 0).equals(number); } else if (number instanceof Double) { return new Double(0).equals(number); } else if (number instanceof Float) { return new Float(0).equals(number); } else if (number instanceof Integer) { return new Integer(0).equals(number); } else if (number instanceof Long) { return new Long(0).equals(number); } else if (number instanceof Short) { return new Short((short) 0).equals(number); } return false; } This works, but it is quite long and cumbersome. Is there any way to simplify this?
upvote count: 5
score: 5
has answer: http://stackoverflow.com/a/25252533

http://stackoverflow.com/comment/39559688
type: Comment
score: 3
comment on: http://stackoverflow.com/a/25369504
has text: What if the keys are "apple" and "pineapple"?
type: AnswerComment

http://stackoverflow.com/a/25233668
accepted answer of: http://stackoverflow.com/q/25233313
type: Answer
has body: @PersistenceContext EntityManager em; @Transactional public List&lt;Person&gt; listPerson() { CriteriaQuery&lt;Person&gt; c = em.getCriteriaBuilder().createQuery(Person.class); Root&lt;Person&gt; from = c.from(Person.class); c.select(from); c.where(em.getCriteriaBuilder().equal(from.get("owner_email"),"john@gmail.com")); // &lt;- this will add the restriction. c.orderBy(em.getCriteriaBuilder().asc(from.get("firstname"))); return em.createQuery(c).getResultList(); }
has comment: http://stackoverflow.com/comment/39308275
answers question: http://stackoverflow.com/q/25233313
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/118890140
has comment: http://stackoverflow.com/comment/39308252

http://stackoverflow.com/q/25300098
tagged with: java
possible better answer: http://stackoverflow.com/a/25301674
has answer: http://stackoverflow.com/a/25301674
has title: Eclipse RCP - Add submenu to existing file menu
answer count: 2
has body: I want to add submenu to existing file menu. I tried below: Can someone help to add submenu to existing file menu using plugin.xml? Thanks in advance.
upvote count: 2
accepted answer: http://stackoverflow.com/a/25301680
downvote count: 0
has answer: http://stackoverflow.com/a/25301680
tagged with: eclipse-plugin
favorite count: 0
type: Question
tagged with: eclipse-rcp
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/25286768
has comment: http://stackoverflow.com/comment/39407137
score: 0
has body: If you use F5, then the page will refresh items which are modified, considers cache, so you will get warning. Instead try reloading the entire page something like, driver.navigate().refresh(); This will load the page without any warning. This post will give you some insights. Look for Diff b/w F5 and navigate().refresh()
answers question: http://stackoverflow.com/q/25285439
type: Answer

http://stackoverflow.com/comment/39488567
has text: @Mik378: if you make an immutable object, there shouldn’t be a setter at all, so the question does not apply, however, it is strongly recommended to make the *entire class* `final` for immutable objects, so you don’t need to think about the getters….
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25329340
type: Comment

http://stackoverflow.com/comment/39576335
type: AnswerComment
has text: If you don't apply a license, Aspose.Words for Java will run in evaluation mode. You can [buy](http://www.aspose.com/purchase/) or request a [free temporary license](http://www.aspose.com/corporate/purchase/temporary-license.aspx). Check [our documentation](http://www.aspose.com/docs/display/wordsjava/Applying+a+License) for how to apply a license.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25327425

http://stackoverflow.com/q/25369112
has answer: http://stackoverflow.com/a/25369174
type: Question
has comment: http://stackoverflow.com/comment/39559186
tagged with: android
has comment: http://stackoverflow.com/comment/39558951
accepted answer: http://stackoverflow.com/a/25369174
type: AnsweredQuestion
score: 0
has title: Better way to parse String to Double in Android
has body: I am trying to parse a Currency Formatted String back to Double and then back to String in Android like so: String replaceable = String.format("[%s,.\\s]", NumberFormat.getCurrencyInstance().getCurrency().getSymbol()); String cleanString = s.toString().replaceAll(replaceable, ""); double parsed = Double.parseDouble(cleanString); String formatted = NumberFormat.getCurrencyInstance().format((parsed/100)); I was continually getting java.lang.NumberFormatException: Invalid double: "" I finally wrapped this in a Try Catch block like so double parsed = 0.00; try { parsed = Double.parseDouble(cleanString); } catch (NumberFormatException e) { e.printStackTrace(); } String formatted = NumberFormat.getCurrencyInstance().format((parsed/100)); Now it works as far the Android app no longer crashes, however this line of code pumps out many lines of exception so I am wondering if there is a better way I can parse the string into double and not have these many exceptions thrown because of the "" character. Below is a sample of the exceptions I am getting Thanks for your time
tagged with: java
answer count: 1

throws
tags question: http://stackoverflow.com/q/25330169
tag name: throws
type: Tag

http://stackoverflow.com/q/25268148
has comment: http://stackoverflow.com/comment/39372600
has body: I want to make a java application to be runable. Let's say I generate an .exe file to use with windows. Now I'm able to link it to a specific file-type, as example: txt-files. If I open a txt-file it should be opened with my application. You all know this thing from pdf-files, jpg-files and so on. But where goes the filepath of this txt-file in java? I have to know / work with it to do the right things with the file. Comes the full path at args[0] to my main method or is this only for openings by terminal? Thank you.
linked to: http://stackoverflow.com/q/1238991
has title: Get filepath of opening file with executable java-application by GUI-OS
score: 0
answer count: 0
tagged with: executable
tagged with: java
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39375529

http://stackoverflow.com/a/25262935
type: Answer
has comment: http://stackoverflow.com/comment/39362890
has body: here it goes import java.util.Vector; class vector1 { //classes should be capitalized Vector first = new Vector(); public void name() { //methods must have a return type //(even if it's void) and must have input parameters between () int a = 1; //java statements end with ; Vector last = new Vector(); //java statements end with ; // int num1 = ((vector1) last.elementAt(a)).first.size(); /* * this is the same as */ Object lastElement = last.elementAt(a); //this is the second element from "last" //because the first element's index is 0 //Since "last" is empty, you'll get an error here vector1 v = (vector1)lastElement; //now you're forcing the compiler to assume that lastElement is a Vector Vector v2 = v.first; //now you're getting vector's attribute "first", which is another Vector int num1 = v2.size(); //now you're calling the method size() on v.first to get the vector number of elements } }
accepted answer of: http://stackoverflow.com/q/25262686
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39362907
answers question: http://stackoverflow.com/q/25262686
score: 0

http://stackoverflow.com/q/25342176
has comment: http://stackoverflow.com/comment/39510702
has comment: http://stackoverflow.com/comment/39510326
has answer: http://stackoverflow.com/a/28786721
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39510317
type: UnansweredQuestion
has body: I am a beginner in Java and I want to send an email in Java. For that I am using this code to send the email, but this code is throwing an exception. I have verified my username and password and they are absolutely fine, so please, tell if there is any other way to send email in Java? This is stack trace of exception: javax.mail.AuthenticationFailedException: 534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbsNX 534-5.7.14 No6jJbDc4l7fZ_WLdBD0sNHIIp_nLvplRMm0bYFBnZBF_XOyVvNSdd1FenDZJPwBTFQyRH 534-5.7.14 lriPK3myMm-dXkW3zK0-6XpO7BzI8hfRcByG1k7YiVzXlddTvs7QhjtgCWNcrzMBuPhoof 534-5.7.14 GjME2TgYzXJVHz5MV98nRnr_kq-kP7RmgOtX3IQHLwM5E8QGBC9-2THVQr_Ch_U0-1nZsc 534-5.7.14 yoPuNEw&gt; Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 wr6sm26888533wjc.24 - gsmtp at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:892) at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:814) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:728) at javax.mail.Service.connect(Service.java:364) at javax.mail.Service.connect(Service.java:245) at SendEmail.sendFromGMail(SendEmail.java:50) at SendEmail.main(SendEmail.java:18) sent This is my code import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class SendEmail { private static String USER_NAME = "me"; private static String PASSWORD = "xyz"; private static String RECIPIENT = "abc@seecs.edu.pk"; public static void main(String[] args) { String from = USER_NAME; String pass = PASSWORD; String[] to = { RECIPIENT }; String subject = "Java send mail example"; String body = "Welcome to JavaMail!"; sendFromGMail(from, pass, to, subject, body); System.out.println("sent"); } private static void sendFromGMail(String from, String pass, String[] to, String subject, String body) { Properties props = System.getProperties(); String host …
linked to: http://stackoverflow.com/q/25341198
linked to: http://stackoverflow.com/q/18778240
type: Question
has title: an exception is thrown while sending email in java
has comment: http://stackoverflow.com/comment/39510282
has comment: http://stackoverflow.com/comment/55368993
has answer: http://stackoverflow.com/a/25342300
tagged with: java

http://stackoverflow.com/comment/39395570
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25280447
has text: As you can see #23 is used for the both object which mean they are located on the same memory location. whts the meaning please explain
type: Comment

http://stackoverflow.com/a/25277075
answers question: http://stackoverflow.com/q/25264701
score: 0
type: Answer
has body: Chrome willnot resize to the size that is larger than your current resolution. If you need to resize your browser, please try with firefox, or resize your current resolution by java Change screen resolution in Java

http://stackoverflow.com/comment/39457672
type: Comment
has text: but would that always add it to the end?
type: AnswerComment
comment on: http://stackoverflow.com/a/25314012
score: 0

http://stackoverflow.com/comment/39419789
has text: This is a code from GIT: https://github.com/cdmatta/robotframework-maven-project I think that library is inside javalib-core-1.0.1.jar and I actually tried to use the jar itself but keeps giving me the same error
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25293507
type: Comment

http://stackoverflow.com/a/25289626
answers question: http://stackoverflow.com/q/25289461
score: 0
has body: When you call System.out.println(someObject);, you invoke the toString() method on that object. An ArrayList doesn't override the standard toString() method inherited from Object, so the result is Type name + @ + hashcode. You need to override toString() in your ToDo list so that it prints prettily. Then adopt an approach to print your collection, e.g. System.out.println(Arrays.toString(toDoList.toArray())); See Printing Java collections nicely for further inspiration.
type: Answer

http://stackoverflow.com/q/25231401
tagged with: mysql
has answer: http://stackoverflow.com/a/25231469
has comment: http://stackoverflow.com/comment/39303768
type: Question
has body: public void addPhoneInvoice(String IMEI,String price,String name, String pNumber) throws SQLException { con = GetConnection.GetConnection(); stmt = con.createStatement(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date date = new Date(); String date1 = dateFormat.format(date); this.price = Double.parseDouble(price); String updatePhn = "DELETE FROM phonestock where IMEI = '"+IMEI+"'"; int j = stmt.executeUpdate(updatePhn); if(j!=0){ String getDescriptionQuary = "SELECT PhoneName,WarrantyPeriod,YearORMonth FROM phonestock WHERE IMEI = '"+IMEI+"'"; ResultSet rs1 = stmt.executeQuery(getDescriptionQuary); while(rs1.next()){ this.phoneName = rs1.getString("PhoneName"); this.warranty = rs1.getInt("WarrantyPeriod"); this.yearOrMonth = rs1.getString("YearORMonth"); } String addPhnTemp = "INSERT INTO invoiceTemp(Description,Date,IMEI,Price,Amount,ContactName,ContactNumber,Warranty,YearOrMonth) VALUES ('"+phoneName+"','"+date1+"','"+IMEI+"',"+price+","+price+",'"+name+"','"+pNumber+"',"+warranty+",'"+yearOrMonth+"')"; String addPhnPer = "INSERT INTO invoicepermanent(Description,Date,IMEI,Price,Amount,ContactName,ContactNumber,Warranty,YearOrMonth) VALUES ('"+phoneName+"','"+date1+"','"+IMEI+"',"+price+","+price+",'"+name+"','"+pNumber+"',"+warranty+",'"+yearOrMonth+"')"; int i = stmt.executeUpdate(addPhnTemp); i = stmt.executeUpdate(addPhnPer); if(i != 0) JOptionPane.showMessageDialog(null,"Success"); } else JOptionPane.showMessageDialog(null,"Error"); } } this shows Success, but phoneName, warranty, and yearOrMonth didn't return from the database.
answer count: 2
has title: while(rs1.next()) not returning any values
possible better answer: http://stackoverflow.com/a/25231469
has comment: http://stackoverflow.com/comment/39303416
accepted answer: http://stackoverflow.com/a/25231441
linked to: http://stackoverflow.com/q/19758467
has answer: http://stackoverflow.com/a/25231441
has comment: http://stackoverflow.com/comment/39303427
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/39435503
has text: However, on second thought, I think you should go with `Jared`'s answer. I was thinking that the additional overhead my answer introduces compared to his was warranted because my version could handle certain special cases better. But now I think it's not worth it, and you're better off with his approach.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25294479

http://stackoverflow.com/comment/39566666
has text: unprintable characters at the beginning or end of line. readLine says it eats the <CR/LF>. Something else perhaps?
type: QuestionComment
comment on: http://stackoverflow.com/q/25372949
type: Comment
score: 0

themes
type: Tag
tag name: themes
tags question: http://stackoverflow.com/q/25387387

http://stackoverflow.com/comment/127891041
comment on: http://stackoverflow.com/a/57599963
score: 1
type: Comment
type: AnswerComment
has text: 9 to 1 isn't bad, but here's another +1 :)

http://stackoverflow.com/a/61471413
score: -1
has body: Perhaps you can simply use Mockito.doReturn(value).when(xxx)
downvote count: 2
answers question: http://stackoverflow.com/q/25317804
upvote count: 1
type: Answer

http://stackoverflow.com/q/25315717
has comment: http://stackoverflow.com/comment/39461844
has comment: http://stackoverflow.com/comment/39461759
has comment: http://stackoverflow.com/comment/39462130
has comment: http://stackoverflow.com/comment/39460975
has comment: http://stackoverflow.com/comment/39461786
has comment: http://stackoverflow.com/comment/39461366
has comment: http://stackoverflow.com/comment/39461877
type: Question
has answer: http://stackoverflow.com/a/25316710
has comment: http://stackoverflow.com/comment/39461207
tagged with: screen
tagged with: bitmap
has comment: http://stackoverflow.com/comment/39462270
has comment: http://stackoverflow.com/comment/39461013
has comment: http://stackoverflow.com/comment/39461296
accepted answer: http://stackoverflow.com/a/25316710
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25296081
score: 0
has title: Android display Dimensions and Drawable size scaling
has comment: http://stackoverflow.com/comment/39461930
has comment: http://stackoverflow.com/comment/39461507
tagged with: scale
has body: It is the next stage of: Scale and align in custom android AnalogClock hands ...this one. Soon I realized that a Drawable can not be scaled, if it fits the size box, then it will be displayed. Otherwise not. So now I need a Bitmap to scale it and then convert back to Drawable and draw it. It doesn't seem elegant, but according to what I found, I don't see any other way. (Idea is to create own alarm app with some special tricks. Firstly, I need clock hands. For creating custom clock, I used own class, which extends View. Hour and minute hands are PNG images. They should be located in the center of the screen, but they are not even visible. Emulator do not display the clock at all, and is not throwing any ecxeptions (basic layer is displayed)) Again I need screen dimensions to set up size of Hour and Minute hands. The code now looks as: import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.Display; import android.view.WindowManager; import android.widget.ImageView; @SuppressLint("NewApi") public class Clock extends ImageView { private Drawable mHourHand; private Drawable mMinuteHand; private int sizeXHour; private int sizeXMinute; private int sizeYHour; private int sizeYMinute; private int xHour; private int xMinute; private int yHour; private int yMinute; private int w; private int h; private Drawable Hh; private Bitmap HourHnd; private Drawable Mh; private Bitmap MinuteHnd; private boolean mAttached; static private float mMinutes; static private float mHour; private boolean mChanged; Context mContext; // Getters&amp;setters protected float getmMinutes() { return mMinutes; } prot…
tagged with: android
tagged with: java
answer count: 1

http://stackoverflow.com/q/25250179
tagged with: swing
has body: I'm trying to make a message dialog appear when the user enters an invalid input. When I try to use null as the location for the dialog, the dialog appears correctly when 0 or a negative number is entered, but there's no title or text in the dialog. @Override public void paintComponent(Graphics g) { super.paintComponent(g); // draw lines endY = getHeight(); // bottom endX = getWidth(); // right side Input = Integer.parseInt(inputField.getText()); if (Input &gt; 0 ) { for (int beginY = getHeight() / 2; beginY &lt;= endY; beginY += Input) { g.drawLine(0, beginY, endX, beginY); } } else { JOptionPane.showMessageDialog(null, "Please do not enter 0 or a negative number.", "Wrong input", JOptionPane.ERROR_MESSAGE); } } I've tried using my JFrame object which has been declared and initialized in a different class as the first parameter and this works. However, I want to be able to use this code in my JPanel class in the paintComponent method so I can add if/else logic to it when drawing the lines.
linked to: http://stackoverflow.com/q/13453331
score: 0
has answer: http://stackoverflow.com/a/25250459
tagged with: dialog
tagged with: java
answer count: 1
type: Question
type: UnansweredQuestion
has title: Why is no text shown within the JOptionPane when my paintComponent method is called?

http://stackoverflow.com/a/70455822
has comment: http://stackoverflow.com/comment/124545171
score: 0
has body: private final static int tzDiff = TimeZone.getDefault().getRawOffset() - TimeZone.getTimeZone("America/New_York").getRawOffset();
type: Answer
answers question: http://stackoverflow.com/q/25348121

http://stackoverflow.com/comment/39520322
comment on: http://stackoverflow.com/q/25348388
score: 3
type: Comment
type: QuestionComment
has text: why you wanna avoid loops?

http://stackoverflow.com/q/25324132
tagged with: post-increment
accepted answer: http://stackoverflow.com/a/25324176
has comment: http://stackoverflow.com/comment/39476587
tagged with: pre-increment
has answer: http://stackoverflow.com/a/25324176
has answer: http://stackoverflow.com/a/25324161
has comment: http://stackoverflow.com/comment/39476354
has comment: http://stackoverflow.com/comment/39476308
type: AnsweredQuestion
answer count: 3
score: 0
tagged with: java
has title: A program with for loop
possible better answer: http://stackoverflow.com/a/25324161
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39476535
has body: I was writing a for loop program when this code came across my mind. for(int i=1; i&lt;=10; i++,i++) The program works fine and the output is also correct. But then I tried the following code: for(int i=1; i&lt;=10; ++i,++i) for(int i=1; i&lt;=10; ++i,i++) for(int i=1; i&lt;=10; i++,++i) To my amazement, all of them produce the same output, 1 3 5 7 9. Now my question is, how exactly do for loops work and why did all the code produce the same output when I used pre-increment and post-increment in the same for loop?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25324172
tagged with: for-loop
has comment: http://stackoverflow.com/comment/39476389

http://stackoverflow.com/q/25230445
has answer: http://stackoverflow.com/a/47485720
has title: Cannot autowire UserDetailsService in GlobalMethodSecurityConfiguration
upvote count: 3
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/50323367
has answer: http://stackoverflow.com/a/42191609
tagged with: spring
has body: I'm getting the java.lang.IllegalArgumentException: A UserDetailsService must be set when trying to autowire custom UserDetailsService implementation in my SecurityConfig Java Config class. Here is the overview of my configuration classes. Root config @Configuration @Import(value = { SecurityConfig.class, ServiceConfig.class }) public class RootConfig { } ServiceConfig @Configuration @ComponentScan(value = "basepackage.service") // this package includes the custom UserDetailsService implementation // annotated by @Service public class ServiceConfig { } SecurityConfig @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends GlobalMethodSecurityConfiguration { // this service is injected using setter injection, omitted for clarity private UserDetailsService userDetailsService; @Autowired public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); } } Now, the problem is: sometimes (but only sometimes - it seems completely random) the custom UserDetailsService is not autowired before the instantiation of methodSecurityInterceptor and I get the org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityInterceptor' defined in class basepackage.SecurityConfig... and the stack ends at Caused by: java.lang.IllegalArgumentException: A UserDetailsService must be set at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.security.authentication.dao.DaoAuthenticationProvider.doAfterPropertiesSet(DaoAuthenticationProvider.java:94) As I mentioned previously, the UserDetailsService implementation is annotated with the @Service annotation and should be instantiated by the ServiceConfig in the right order. This problem happens only from time to time when deploying the app. Usually everything is instantiated correctly. When I create the UserDetailsService bean inside the SecurityConfig using @Bean annota…
tagged with: autowired
tagged with: spring-security
favorite count: 0
score: 3
has answer: http://stackoverflow.com/a/31226176
tagged with: java
has comment: http://stackoverflow.com/comment/39526572
answer count: 6
has answer: http://stackoverflow.com/a/45019672
tagged with: spring-java-config
type: Question
has answer: http://stackoverflow.com/a/34680934

http://stackoverflow.com/q/25286219
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39536638
has title: Using Proguard to embed Guava in another jar
tagged with: java
accepted answer: http://stackoverflow.com/a/25364752
has body: I have a Tomcat 6 server which is hosting a portlet container (in a war) and several portlets (each one packaged in its own war). We have a requirement to share data between these portlets, and due to the version of the portlet container we are using, the only way that we can see to do this is to place a jar with our logic into the endorsed folder to ensure that the same instance is seen by the different wars (each one has its own classloader). This jar makes use of the various caching functions of Google Guava and has been proven to work in unit tests and within the portlet container. However, we have found ourselves faced with a clash of different versions of Guava due to the endorsed classloader taking preference over the subsequent classloaders. The portlet container uses an early version of Guava and our portlets use our internal framework which uses a more recent version! If we write our endorsed jar to use the same version of Guava as the portlet container then the framework boots but the portlets won't start as the API is different. If we write our endorsed jar to use the same version of Guava as our own framework, then the portlet framework won't start because the API is different, so our portlets never load. The approach we are trying at the moment is copying the Guava source code into our own jar under a new package - this has been done in various open source projects - for example the class com.google.common.base.Ascii would be repackaged com.mycompany.com.google.common.base.Ascii. This works, though it means recompiling Guava each time we make a new version of our endorsed jar. We would prefer being able to automate the generation of this endorsed jar, and having seen documentation for using ProGuard with Guava in an Android context, have a feeling that Proguard might be able to help. Is ProGuard capable of repackaging a jar dependency inside another jar, maintaining a single internal package hierarchy? Could the -flattenpackagehierarchy option do this?
has comment: http://stackoverflow.com/comment/39484368
has answer: http://stackoverflow.com/a/25364752
tagged with: proguard
type: Question
tagged with: classloader
answer count: 1
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25271644
possible better answer: http://stackoverflow.com/a/25273254
has answer: http://stackoverflow.com/a/25289009
accepted answer: http://stackoverflow.com/a/25289009
tagged with: windows
tagged with: java
has answer: http://stackoverflow.com/a/25273254
has body: I am creating a scheduled task from command line: schtasks /Create /SC ONSTART /TN "Zookeeper server" /TR D:\Zookeeper\zookeeper-3.4.6\bin\zkServer.cmd /RU System /V1 /f The issue is that the "Stop task if running for X days" options is always checked. I tried unchecking it, but it always comes back on right away. Since it's a server, I want it to be able to run for more than 3 days. I saw a solution where you had to export the xml of the task, change the value manually (ExecutionTimeLimit), delete the task and create it from the xml template, but that doesn't work either. I also thought that it was a mandatory option for a ONSTART trigger, so I tried to replace it with a one time only trigger, the same thing happens. Is there a way to make sure my app is run on startup (without a user logged in)? Still allowing the user to stop and start it as he pleases. I know about services, but I heard it was kind of hard to make a service from an app with java. EDIT: I would prefer to fix that issue, but if that's not possible, a way to install Zookeeper Server as a service. I tried with nssm 2.23, but there is no way to install a service silently (it must be done without user interface).
tagged with: service
type: Question
tagged with: apache-zookeeper
has title: Windows Task Scheduler stops tasks when it's been running for X days
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/415409
tagged with: scheduled-tasks
type: AnsweredQuestion

http://stackoverflow.com/comment/39465790
comment on: http://stackoverflow.com/q/25318008
type: Comment
has text: Why not ask the person who gave you the source code?
type: QuestionComment
score: 0

http://stackoverflow.com/q/25338153
has comment: http://stackoverflow.com/comment/39503383
accepted answer: http://stackoverflow.com/a/25338760
tagged with: image
has answer: http://stackoverflow.com/a/25338760
type: AnsweredQuestion
tagged with: canvas
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: render
upvote count: 1
has comment: http://stackoverflow.com/comment/39503460
has body: I was experimenting with buffers and i tried to fill a buffer with the color green and then display it immediately on the screen but the screen wont display the green color without a loop. can some one explain this to me? public void draw() { createBufferStrategy(2); Graphics g = image.createGraphics(); BufferStrategy bs = getBufferStrategy(); for (int i = 0; i &lt; 16; i++) { System.out.println(i); if (!a) { g.setColor(Color.green); g.fillRect(0, 0, w, h); } a = true; Graphics bsg = bs.getDrawGraphics(); // bsg.drawImage(image, 0, 0, h, w, null); // g.clearRect(0, 0, w, h); // g.drawOval(0, 0, 50, 50); bsg.setColor(Color.green); bsg.fillRect(0, 0, getWidth(), getHeight()); bsg.dispose(); bs.show(); } } and I also found that if I set the loop to less than exactly 16 times or cancel it the image won't be displayed here is a complete runnable code public class BufferTest extends Canvas implements Runnable { int h = 400; int w = 400; BufferedImage image; boolean a; public static void main(String[] a) { JFrame frame = new JFrame(); BufferTest test = new BufferTest(); frame.add(test); frame.pack(); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); test.draw(); Thread t = new Thread(test); // t.start(); } public BufferTest() { this.setPreferredSize(new Dimension(w, h)); image = new BufferedImage(h, w, BufferedImage.TYPE_INT_RGB); } public void draw() { createBufferStrategy(2); // Graphics g = image.createGraphics(); BufferStrategy bs = getBufferStrategy(); for (int i = 0; i &lt; 16; i++) { System.out.println(i); //if (!a) { //g.setColor(Color.green); //g.fillRect(0, 0, w, h); //} //a = true; Graphics bsg = bs.getDrawGraphics(); //bsg.drawImage(image, 0, 0, h, w, null); //g.clearRect(0, 0, w, h); //g.drawOval(0, 0, 50, 50); bsg.setColor(Color.green); bsg.fillRect(0, 0, getWidth(), getHeight()); bsg.dispose(); bs.show(); } } @Override public void run() { while (true) { draw();// TODO Auto-generated method stub }…
favorite count: 0
type: Question
tagged with: buffer
has comment: http://stackoverflow.com/comment/136053611
has title: why won't my drawings display without a loop?

http://stackoverflow.com/q/25246535
has body: I am unable to generate Allure test html reports using allure-maven plugin. I am using the same version of testNG-adapter and allure maven plugin (1.4.0.RC8). But I am able to generate the allure html reports using Allure CLI. My pom.xml excluding dependencies is org.apache.maven.plugins maven-surefire-plugin 2.14 false -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar org.aspectj aspectjweaver 1.8.1 </build> true ru.yandex.qatools.allure allure-maven-plugin 1.4.0.RC8 ${basedir}/target/allure-reports/ <allureResultsDirectory>${basedir}/target/allure-results</allureResultsDirectory>
type: Question
has title: Unable to generate Allure reports using allure-maven plugin
tagged with: java
has comment: http://stackoverflow.com/comment/39371081
has comment: http://stackoverflow.com/comment/39365929
accepted answer: http://stackoverflow.com/a/25264856
tagged with: allure
has answer: http://stackoverflow.com/a/25264856
has comment: http://stackoverflow.com/comment/39369687
tagged with: testng
score: 4
upvote count: 4
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: maven
possible better answer: http://stackoverflow.com/a/39437556
favorite count: 0
has answer: http://stackoverflow.com/a/39437556

http://stackoverflow.com/q/25374325
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39578982
has title: Is it possible to make a Java JNI which calls jdbc?
has comment: http://stackoverflow.com/comment/39588030
type: Question
accepted answer: http://stackoverflow.com/a/25374412
has comment: http://stackoverflow.com/comment/113449419
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39591033
tagged with: dll
has answer: http://stackoverflow.com/a/25374412
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/39569197
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39569204
favorite count: 0
linked to: http://stackoverflow.com/q/1010645
has body: I am new to jni and very confused if I can use jni to achieve what I need done. I want to make a java api what will use jdbc to update database, but this particular api will be called from C++ program. So I think I probably should write jni code which access the database via jdbc (is that even possible?), create C++ code and generate dll so other C++ programs can just call the dll to update database. Is this all possible? If so, how do I really call jdbc in jni? If this dll is finally made, can Fortran call it as well? My other thought is maybe I should make a regular java program to update the database, then use say ikvm to wrap the java class into C++ dll? The thing is I have to use access database using Java. Our C++ programs will not access database at all, and it would be better if this java api can be accessed via system call. Or is there any better way to do it? I hope I explained it well. I am not all familiar with what I am assigned here and cannot find much relevant reference. Thank you so much!! UPDATED: The problem is not all computers have C++ postgresql driver installed but they do have Java postgresql driver installed. We don't want to force everyone to install the C++ db driver and no major changes in those C++ program will be made. So it will make sense to come up something in Java to access database. The java system service (preferred, like dll?) /API basically is called to record start time and end time of a C++ program. C++ program will make a "function" call (with pass-in parameter and returned value) to this system service/Java API to record start/end time.
tagged with: c++
score: 2
has comment: http://stackoverflow.com/comment/39569165
has comment: http://stackoverflow.com/comment/39588087
has comment: http://stackoverflow.com/comment/39587966
upvote count: 2
has comment: http://stackoverflow.com/comment/113449372

http://stackoverflow.com/q/25279190
downvote count: 1
upvote count: 4
tagged with: eclipse
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/39468904
has title: Pom.xml error in Eclipse
type: UnansweredQuestion
tagged with: apache
has answer: http://stackoverflow.com/a/25280513
tagged with: maven
has answer: http://stackoverflow.com/a/65651567
answer count: 4
has body: I have created a web project , and when i right click the project-&gt;configure-&gt;maven project, I get this error in pom.xml. Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org
score: 3
has answer: http://stackoverflow.com/a/33695398
tagged with: java

http://stackoverflow.com/comment/39478364
type: Comment
has text: Thanks for the quick answer Ian. Okay these are bad news. Is there any work-around to launch my application with some kind of a script or something similar out of an .app-bundle? My application basically works just fine on the Mac when directly launching with "java -jar Servitus.jar --installer", but I'm really interested in an .app-bundle... :-) Any further ideas?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25312006

http://stackoverflow.com/comment/39353247
type: QuestionComment
has text: No clue on the Hermes issues (same on my machine). However, you cannot "view" a topic. There is nothing to view, you can just subscribe from it and have a copy of each message passing through. I wrote a small command line utility for ActiveMQ that you can subscribe to topics with - https://github.com/northlander/a. You can also give ActiveMQ Browser a try if you want something graphical. http://sourceforge.net/projects/activemqbrowser/
comment on: http://stackoverflow.com/q/25246578
score: 0
type: Comment

http://stackoverflow.com/comment/39449296
has text: You could also put a lookup method inside the enum to return the correct element based on the input, which would be a better design
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25309460

http://stackoverflow.com/comment/41553827
type: Comment
has text: You are my hero. It's been so long and finally it's fixed. Thank you
type: AnswerComment
comment on: http://stackoverflow.com/a/25921057
score: 1

http://stackoverflow.com/a/25382000
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25381903
score: 1
type: Answer
has body: No, you can't call it a wrapper class. A wrapper class sits on top of the main class / primitive and provides additional features. For example Integer class is a wrapper over the primitive int because it provides additional functionality when compared to what an int provides. It also provides additional behavioral properties (like the ability to be inserted into collections). Your class is just a plain java class.

http://stackoverflow.com/comment/39326674
comment on: http://stackoverflow.com/q/25243386
has text: Does it say more than "Printer does not accept Job?" There could be hundreds of reasons ...
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/87545761
type: AnswerComment
has text: This solved the issue for me. I replaced my primitive types like `int` and `double` with `Integer` and `Double` and my issue was fixed
comment on: http://stackoverflow.com/a/29879294
score: 2
type: Comment

http://stackoverflow.com/q/25343955
type: Question
has answer: http://stackoverflow.com/a/25344703
type: UnansweredQuestion
tagged with: java
tagged with: spring
tagged with: servlets
tagged with: spring-mvc
answer count: 2
has title: issue in JSP:forward on button Click()(when target jsp is under web-inf folder)
score: 1
has answer: http://stackoverflow.com/a/25344093
has body: I have Two Jsp: 1. index.jsp 2. createAccount.jsp (Under WEB-INF folder) Index.jsp should show createAccount button.When i click createAccount Button jsp should be forwarded to createAccount.jsp. Current Issue: When I deploy the code on Tomcat While accessing index.jsp It automatically forwards to createAccount.jsp without showing the createAccount button. index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Vendor Account <input type="button" value="Create Vendor Account" onclick='<jsp:forward page="WEB-INF/jsp/createAccount.jsp"></jsp:forward>'> createAccount.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Vendor Account Creation Form This is a Vendor Creation Form. Actual Output: http://:8081/VendorPortal/index.jsp This is a Vendor Creation Form. Expected output : Create Vendor Account button should be displayed. Please let me know how to Implement the above scenario.
downvote count: 0
tagged with: jsp
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39395748
score: 0
comment on: http://stackoverflow.com/a/25280800
type: Comment
has text: I know that, that is what I used to do on the older versions of Android Studio... But I downloaded the latest and it doesn't work that way anymore...
type: AnswerComment

http://stackoverflow.com/comment/39385103
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25274795
has text: The error says it all. Whatever your service is spitting out, it's not what is expected by the receiver.

http://stackoverflow.com/comment/39401625
has text: Simplest solution.`trim()` your input and check for `"`" if trimmed String equals `""`, you have an empty string as input. else, proceed to regex. Make regex simpler by cutting out unexpected inputs.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25284059

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/25304458

http://stackoverflow.com/q/25295756
tagged with: wait
has answer: http://stackoverflow.com/a/25295807
has answer: http://stackoverflow.com/a/25296023
possible better answer: http://stackoverflow.com/a/25295807
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39424753
has comment: http://stackoverflow.com/comment/39424004
tagged with: java
answer count: 4
has comment: http://stackoverflow.com/comment/39423928
score: 2
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25295803
has body: I have following piece of code: synchronized void myMethod() { String s="aaa"; try { s.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } The code throws exception ... I have seen codes using wait method on threads which is self explainable and logical.. why would one use wait method on an object like string instead of using it on main thread? what is its use? are there any practical implementations like this? Thanks in advance
accepted answer: http://stackoverflow.com/a/25295803
has answer: http://stackoverflow.com/a/25295864
has comment: http://stackoverflow.com/comment/39424492
has comment: http://stackoverflow.com/comment/39426880
tagged with: multithreading
downvote count: 0
has title: Why to use wait method on strings or other objects?

json-deserialization
tag name: json-deserialization
tags question: http://stackoverflow.com/q/25307994
type: Tag
tags question: http://stackoverflow.com/q/25379510
tags question: http://stackoverflow.com/q/25279068

http://stackoverflow.com/a/25397311
answers question: http://stackoverflow.com/q/25356192
type: Answer
accepted answer of: http://stackoverflow.com/q/25356192
score: 2
has body: Yes TimeToLive is an option from the JMS spec that the Camel JMS components support. That options has no meaning for other components such as HTTP. It seems like you may want to use a filter EIP and discard the message if its to old, and you can use a java method etc to implement some code that figures out if its to old or not, and return a boolean public boolean isNotToOld(Exchange exchange) { ... return true // to accept and process the message } See more about the filter eip here http://camel.apache.org/message-filter And you can use it in a route something a like &lt;from uri="direct:MessageTypeGuaranteed"&gt; &lt;filter&gt; &lt;method ref="myBean" method="isNotToOld"/&gt; &lt;to uri="http://dummyUri?throwExceptionOnFailure=true"/&gt; &lt;/filter&gt;
upvote count: 2
has comment: http://stackoverflow.com/comment/39630094
type: AcceptedAnswer
downvote count: 0

uri
tags question: http://stackoverflow.com/q/25240458
tags question: http://stackoverflow.com/q/25323740
tag name: uri
type: Tag
tags question: http://stackoverflow.com/q/25248043
tags question: http://stackoverflow.com/q/25254970

http://stackoverflow.com/comment/39339670
type: Comment
type: QuestionComment
has text: maybe it's because bitstamp waiting for params in POST's body instead of params in url, so the type of POST-message must be MediaType.APPLICATION_FORM_URLENCODED instead of JSONObject.class. See http://stackoverflow.com/questions/14551194/how-are-parameters-sent-in-an-http-post-request. How to do it in Jersey: http://stackoverflow.com/questions/2136119/using-the-jersey-client-to-do-a-post-operation
score: 0
comment on: http://stackoverflow.com/q/25248014

http://stackoverflow.com/comment/39458887
comment on: http://stackoverflow.com/q/25309275
score: 1
has text: Can you edit your question and post some code (and the exact error message)? You should just be able to use `<DoughnutChart>` directly in your FXML, as you would with `<PieChart>`. It's not a controller, it's a `Node`.
type: Comment
type: QuestionComment

atmosphere
tag name: atmosphere
type: Tag
tags question: http://stackoverflow.com/q/25264257

http://stackoverflow.com/comment/39401420
has text: you can sue only one `replaceAll()` like this -- `str.replaceAll("[\\(\\)]", "")`
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25283135

http://stackoverflow.com/comment/39341058
score: 0
has text: I have updated my answer now. Make sure to accept it if it solves your problem :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25250696

http://stackoverflow.com/comment/39434783
has text: @bhargavg = The output will be = 14 Sept 2014 . But i don't want to use current date. Whatever i enter the date i want to get after one month date.
type: Comment
comment on: http://stackoverflow.com/q/25301623
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39421306
comment on: http://stackoverflow.com/q/25294433
type: Comment
score: 0
type: QuestionComment
has text: No, in the lines you've shown it's `\:start` with the colon after the backslash, not before. Also, do you want to remove that from all lines, or only certain lines? Do you want to remove only from the end of the lines?

http://stackoverflow.com/a/25300987
answers question: http://stackoverflow.com/q/25300915
has body: The emphasis is to hint at the fact that internally the ArrayList will need to shift the elements, and maintain open memory for further insertions causing it to shift and copy elements. A LinkedList will simply create a node then set the next node of the previous node to the new node and set the next node of the new node to the next node in the list. It should also be noted that while classically LinkedList will excel at insertions in the middle, there are often times when an ArrayList will perform as well, or better than a LinkedList (this is actually common between more than one language, including C++ [Bjarne Stroustrup actually has a lecture on the concept]). You should carefully consider what you're doing and use benchmarks to make the right decision.
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/q/25261222
tagged with: postgresql
score: 0
has title: Short url mecanism : base36
tagged with: java
has comment: http://stackoverflow.com/comment/39363414
has body: In my postgreSQL database, I have a bigint and it's base36 conversion. I have urls containing short_id in base36 and the decimal version, but I will query according to the url so base36. Can base36 short_id be my primary key for better performance ?
tagged with: playframework-2.2
type: Question
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25265101

http://stackoverflow.com/a/25308402
score: 0
has body: Well, it doesn't work because it is NOT a win32 application. Class files are run by the java virtual machine, not by the Windows operating system. You could try feeding the command 'java -jar .jar, once you've packaged your class file and the other class files that it needs in a jar file.
type: Answer
answers question: http://stackoverflow.com/q/25308323

http://stackoverflow.com/comment/39489893
has text: It’s hard to say if you’re not even telling us which programming language you are taking about…
score: 2
comment on: http://stackoverflow.com/q/25330591
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25295447
tagged with: http
type: Question
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25295558
has title: Passing "long" value in http get params
score: 0
tagged with: rest
has body: I use JAX-RS (Jersey) for handking http requests. Everything works fine except when i excecute a http get trying to pass long values. For example: http://ip:port/MyRestHandler?Operation=Something&amp;latitude=100.123456789&amp;longtitude=13345.234566 When my server receives the request its automaticlly returns 400 code and its not even entering the getHandler. Waybe its got to do with my params getting: @DefaultValue("0") @QueryParam("latitude") long latitude, @DefaultValue("0") @QueryParam("longtitude") long longtitude, Any ideas on how to overcome the problem?
tagged with: java
tagged with: jax-rs

http://stackoverflow.com/comment/39442681
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25306049
score: 0
has text: I'm guessing you don't mean [TLD](http://en.wikipedia.org/wiki/Top-level_domain) as in DNS. Then in your case the algorithm would be to split on `.` and take the second-rightmost value? (not very sophisticated I know)

http://stackoverflow.com/a/25366782
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25338279
type: Answer
answers question: http://stackoverflow.com/q/25338279
score: 2
upvote count: 2
has body: There are several issues with the code, but for now, I'll ignore the parts that are somewhat "not clean" or "not elegant", and focus on the main problem that was the reason for the question: The state of all Chargers instances was the same. The fields boolean chargerReachedTarget = false, chargerShot = false, chargerDive = true; have been defined globally. Just by moving this line (that is, these 3 fields) into the Charger class, and changing the line if (chargerShot==true) { to if (c.chargerShot==true) { the game already seemed to be much closer to what you presumably have been looking for. After this modification, it was possible to shoot individual opponents, and new opponents kept coming after the old ones had disappeared. Again: The code is not really nicely structured, and there are many possible minor improvements. For example, something like if (c.chargerShot==true) { ... } should better be if (charger.isShot()) { ... }. But I'm not so familiar with processing and its best practices, so I'm not sure how the "best" solution would look like in a global sense...

http://stackoverflow.com/a/25360451
has body: It is not odd. It is OK. The odd is that you need to transform typed boolean value to not self explainable byte. However sometimes we have to do this when working with legacy APIs. BTW if you want to save memory you can use 1 bit instead of byte, so you can group several boolean flags together while using bit for each boolean value. But this technique is relevant for huge amounts of data only when saving several bytes can be significant.
downvote count: 0
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25360375

http://stackoverflow.com/comment/39536262
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25357148
has text: Please show the mapping class
type: Comment

http://stackoverflow.com/a/25388952
answers question: http://stackoverflow.com/q/25388682
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25388682
has body: You have to take into account that byte is signed. Sh[ii] = (short) (test[2 * ii] &amp; 0xFF | (test[2 * ii + 1] &amp; 0xFF) &lt;&lt; 8);
score: 1
type: Answer

http://stackoverflow.com/comment/39434085
comment on: http://stackoverflow.com/q/25301326
score: 0
type: Comment
type: QuestionComment
has text: how about javascript or jquery?

http://stackoverflow.com/comment/39543377
has text: I didnt understand your question
score: 0
comment on: http://stackoverflow.com/q/25361078
type: Comment
type: QuestionComment

dynamic-class-creation
type: Tag
tag name: dynamic-class-creation
tags question: http://stackoverflow.com/q/25327791

http://stackoverflow.com/comment/39592230
comment on: http://stackoverflow.com/a/25381423
type: AnswerComment
has text: Thanks @Victar Much appreciated. I'll download it and take a look.
score: 0
type: Comment

http://stackoverflow.com/q/25235870
has answer: http://stackoverflow.com/a/25236065
favorite count: 0
type: Question
has title: Hibernate closing MySQL connection
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has body: I'am unable to log in to my application after some hours of inactivity. Iam using Java, Spring Security, Struts 1.3 and Hibernate. This is the log i found related to this issue 2014-07-30 14:11:40 INFO LocalSessionFactoryBean:246 - Closing Hibernate SessionFactory java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1388) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1532) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1923) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1163) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1272) at com.mysql.jdbc.Connection.execSQL(Connection.java:2236) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1555) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) /var/lib/tomcat7/logs# 2014-07-30 14:11:40 INFO SessionFactoryImpl:769 - closing at org.hibernate.loader.Loader.doQuery(Loader.java:674) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811) at se.etm.ewo.daoImpl.UserDaoImpl.getUserByUsername(Unknown Source) at se.etm.ewo.daoImpl.UserDaoImpl.loadUserByUsername(Unknown Source) at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:82) at org.springframework.security.authentication.dao…
tagged with: struts
tagged with: spring-security
score: 1
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: mysql

http://stackoverflow.com/comment/39383811
type: Comment
type: QuestionComment
has text: What is grafika? Sorry but I have no idea what you're talking about.
comment on: http://stackoverflow.com/q/25251509
score: 0

http://stackoverflow.com/comment/39697558
has text: It raises the following error:incompatible types: boolean cannot be converted to int. The line as: int capacity = file.length() > Integer.MAX_VALUE : 1024 * 128 : (int) file.length();
type: AnswerComment
comment on: http://stackoverflow.com/a/25441332
type: Comment
score: 0

http://stackoverflow.com/q/25344320
has title: How to handle exceptions thrown by observer's onNext in RxJava?
downvote count: 0
accepted answer: http://stackoverflow.com/a/25348225
has body: Consider the following example: Observable.range(1, 10).subscribe(i -&gt; { System.out.println(i); if (i == 5) { throw new RuntimeException("oops!"); } }, Throwable::printStackTrace); This outputs numbers from 1 to 5 and then prints the exception. What I want to achieve is make the observer stay subscribed and continue to run after throwing an exception, i.e. print all numbers from 1 to 10. I have tried using retry() and other various error handling operators, but, as said in the documentation, their purpose is handling errors emitted by the observable itself. The most straightforward solution is just to wrap the whole body of onNext into a try-catch block, but that doesn't sound like a good solution to me. In the similar Rx.NET question, the proposed solution was to make an extension method which would do the wrapping by creating a proxy observable. I tried to remake it: Observable&lt;Integer&gt; origin = Observable.range(1, 10); Observable&lt;Integer&gt; proxy = Observable.create((Observable.OnSubscribe&lt;Integer&gt;) s -&gt; origin.subscribe(i -&gt; {try { s.onNext(i); } catch (Exception ignored) {}}, s::onError, s::onCompleted)); proxy.subscribe(i -&gt; { System.out.println(i); if (i == 5) { throw new RuntimeException("oops!"); } }, Throwable::printStackTrace); This does not change anything, because RxJava itself wraps the subscriber into a SafeSubscriber. Using unsafeSubscribe to get around it doesn't seem to be a good solution either. What can I do to solve this problem?
type: AnsweredQuestion
upvote count: 28
has answer: http://stackoverflow.com/a/25348225
tagged with: rx-java
tagged with: java
answer count: 1
tagged with: system.reactive
favorite count: 0
score: 28
type: Question
tagged with: reactive-programming
linked to: http://stackoverflow.com/q/7210051

http://stackoverflow.com/comment/39455149
type: Comment
has text: Instantiating of object @enrico.bacis, how can I make it similar as the instantiation the way I did in java. I don't wanna miss anything.
comment on: http://stackoverflow.com/q/25312546
score: 0
type: QuestionComment

http://stackoverflow.com/a/25268208
score: 4
upvote count: 4
downvote count: 0
has body: This won't compile, since someByte is declared within the try block and accessed outside it. Should be : public class MyClass { public static byte[] someMethod() { byte[] someByte = null; try { ... someByte = .... ; return someByte; } catch (Exception e) { e.printStackTrace(); } return someByte; } }
has comment: http://stackoverflow.com/comment/39372571
answers question: http://stackoverflow.com/q/25268174
type: Answer

http://stackoverflow.com/a/25304618
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25303894
upvote count: 2
answers question: http://stackoverflow.com/q/25303894
has comment: http://stackoverflow.com/comment/39440743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39440219
has body: The general off-the-shelf pattern here is straightforward: Introduce an interface like MarkerListener. Then you can create a (possibly anonymous) MarkerListener implementation that updates your config, and add it to the respective `Marker´. import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; interface MarkerListener { void delayChanged(double oldDelay, double newDelay); } class Marker { private double delay; private final List&lt;MarkerListener&gt; markerListeners = new CopyOnWriteArrayList&lt;MarkerListener&gt;(); void addMarkerListener(MarkerListener markerListener) { markerListeners.add(markerListener); } void removeMarkerListener(MarkerListener markerListener) { markerListeners.add(markerListener); } void setDelay(double newDelay) { if (newDelay != this.delay) { double oldDelay = this.delay; this.delay = newDelay; fireDelayChanged(oldDelay, newDelay); } } private void fireDelayChanged(double oldDelay, double newDelay) { for (MarkerListener markerListener : markerListeners) { markerListener.delayChanged(oldDelay, newDelay); } } } Of course, this involves some code bloat. It is basically a minimalistic implementation of something that could also be achieved when using the DoubleProperty from JavaFX that Joop Eggen referred to in his answer. So you might want to consider using the DoubleProperty. (One could also solve this with PropertyChangeListeners, but these are probably not so appropriate here) Since you referred to "function pointers": You could also use DoubleConsumer instances instead of introducing an own interface. But it's impossible to tell from the question whether this is the best solution here.
score: 2
has comment: http://stackoverflow.com/comment/39440614

loops
tags question: http://stackoverflow.com/q/25335542
tags question: http://stackoverflow.com/q/25277256
tags question: http://stackoverflow.com/q/25350514
tag name: loops
tags question: http://stackoverflow.com/q/25248687
tags question: http://stackoverflow.com/q/25256392
type: Tag
tags question: http://stackoverflow.com/q/25306077
tags question: http://stackoverflow.com/q/25247822
tags question: http://stackoverflow.com/q/25277043
tags question: http://stackoverflow.com/q/25370567
tags question: http://stackoverflow.com/q/25387515
tags question: http://stackoverflow.com/q/25322459

http://stackoverflow.com/comment/39312786
has text: have you extend FragmentActivity ?
comment on: http://stackoverflow.com/q/25234952
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39597895
has text: Oh and "GMT" is considered a "abbreviation" and is thus deprecated according to docs. I will clean up the question once answered.
type: QuestionComment
comment on: http://stackoverflow.com/q/25386425
score: 0
type: Comment

http://stackoverflow.com/a/25247718
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25243204
answers question: http://stackoverflow.com/q/25243204
downvote count: 0
score: 1
has body: Metaphone and Wildcards are just not compatible. Firstly, Lucene does not analyze terms with wildcards, fuzzy matching, regex, etc. As such, you are trying to search plain text against metaphone codes. So, you have: In index: APTL In query: abdul~0.5 Which I think makes it more obvious why you don't get any matches. That's a levenshtein distance of 3, which is considerable. Mixing metaphone with wildcards doesn't make a great deal of sense. A valid metaphone match should be an exact match. The metaphone algorithm reduces the term to a code representing is first four sounds (simplifying somewhat). These are two different and separate methods of searching for relevant looser results. They should be kept separate, so if you want to be able to search on both fuzzy matching and metaphone, the best idea would be to index the metaphones and full text in two different fields, and then search on both of them. Something like: &lt;field name="sdn_names_phonetic" type="doublemetaphonetic" indexed="true" stored="false" termVectors="true"/&gt; &lt;field name="sdn_names" type="text_standard" indexed="true" stored="true" termVectors="true"/&gt; &lt;fieldType name="text_standard" class="solr.TextField"&gt; &lt;analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/&gt; &lt;/fieldType&gt; &lt;fieldtype name="doublemetaphonetic" stored="false" indexed="true" class="solr.TextField" &gt; &lt;analyzer&gt; &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt; &lt;filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/&gt; &lt;/analyzer&gt; &lt;/fieldtype&gt; (Note: I've changes your metaphone fields to stored=false, since both of these fields would store the same data, there is no need to store both of them). Which could be searched like: sdn_names:abdul~0.5 sdn_names_phonetic:abdul See the solr documentation section: Indexing same data in multiple fields, for a bit more about this sort of pattern.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39767138
type: Answer

http://stackoverflow.com/a/25244527
has body: You need to choose the encoding used by your PrintWriter. Outside of Eclipse, your platform is presumably defaulting to something other than UTF-8. Try this code: PrintWriter pw = new PrintWriter(new OutputStreamWriter( conn.getOutputStream(), "UTF-8"));
score: 3
has comment: http://stackoverflow.com/comment/39329064
type: Answer
has comment: http://stackoverflow.com/comment/39328580
has comment: http://stackoverflow.com/comment/39328877
answers question: http://stackoverflow.com/q/25244315
has comment: http://stackoverflow.com/comment/39329221
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25244315

http://stackoverflow.com/comment/39480357
comment on: http://stackoverflow.com/q/25326226
score: 0
type: Comment
has text: The Iterator does not support removal, hence the UnsupportedOperationException. Can you post the original code as well, so we can debug that? THe issue MIGHT be that you used the List.remove(Object) which runs through the list behind the scenes, thus throwing ConcurrentModificationException. Removing by index would solve that issue.
type: QuestionComment

http://stackoverflow.com/a/25246248
has body: As you have found these internal classes no longer do anything. To add to the window you will probably need to edit the Eclipse 4 application model. For an existing Eclipse this is the LegacyIDE.e4xmi file in the org.eclipse.platform plugin. See Eclipse 4 RCP for more details on editing application models.
score: 0
answers question: http://stackoverflow.com/q/25244733
type: Answer

http://stackoverflow.com/q/25335343
tagged with: gradle
linked to: http://stackoverflow.com/q/15437310
downvote count: 1
tagged with: unit-testing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25339033
type: UnansweredQuestion
has body: I want to write unit test for simply spring controller. Everything works - controller, views and model is ok, because when i deploy it on my local tomcat it does exactly what i want. But there is one problem. I try to write unit test for it (I use this tutorial: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-configuration/ ) and i get many exceptions. I tried everything and still it doesn't work. Here is my code: (IndexControllerTest.java) @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestContext.class, WebAppContext.class}) public class IndexControllerTest { private MockMvc mockMvc; @Autowired private UserRepository userRepositoryMock; @Autowired private WebApplicationContext applicationContext; @Before public void setUp(){ Mockito.reset(userRepositoryMock); mockMvc = MockMvcBuilders.webAppContextSetup(applicationContext).build(); } @Test public void testName() throws Exception { } } (WebAppContext.java): @EnableWebMvc @Configuration @ComponentScan("pl.com.tegess.UnitTestForSpringController") @EnableMongoRepositories("pl.com.tegess.UnitTestForSpringController.repositories") public class WebAppContext extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry){ registry.addResourceHandler("/static/**").addResourceLocations("/static/"); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer){ configurer.enable(); } @Bean public SimpleMappingExceptionResolver exceptionResolver(){ SimpleMappingExceptionResolver exceptionResolver = new SimpleMappingExceptionResolver(); Properties exceptionMappings = new Properties(); exceptionMappings.put("pl.com.tegess.UnitTestForSpringConfiguration.exceptions.ControllerNotFoundException", "error/404"); exceptionMappings.put("java.lang.Exception", "error/error"); exceptionMappings.put("java.lang.RuntimeException", "error/error"); exceptionResolver.setExceptionMappi…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25859407
tagged with: spring
tagged with: spring-mvc
answer count: 3
has title: Spring JUnit Mockito unit test controller Specified class is an interface
upvote count: 2
has answer: http://stackoverflow.com/a/25859106

http://stackoverflow.com/comment/39315056
score: 0
comment on: http://stackoverflow.com/q/25237194
type: Comment
has text: @MarounMaroun ahh ok. your poit taken
type: QuestionComment

http://stackoverflow.com/comment/39591914
has text: Have a look at: [link](http://stackoverflow.com/questions/18176867/use-different-color-for-different-actionbar-tab/18253739#18253739)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25386215
type: Comment

http://stackoverflow.com/comment/39349227
comment on: http://stackoverflow.com/q/25254514
has text: Color me surprised. Let's try something, can you go ahead and run the tutorial back from 'mvn archetype:generate'?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39311496
comment on: http://stackoverflow.com/q/25235229
has text: Works fine, unless I take the file out of the jar after I've compiled it. So I'm guessing maven/java is doing something to it during compiling?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25293472
has body: In my LDAP directory I don't have attribute called unicodePwd. All I have us userPassword. I wrote java to change userPassword attribute. However, it is storing it as plain text. For example, if I want my new password to be newpassword, LDAP stores it as newpassword and it doesn't hash it. I can't authenticate with this password once it is changed. Part of my code where I am doing this: String quotedPassword = "\"" + newPassword + "\""; byte[] newUnicodePassword = quotedPassword.getBytes("UTF-16LE"); //String newpass = new String(pwdArray, "UTF8"); mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userPassword", newUnicodePassword)); // Perform the update ctx.modifyAttributes(userName, mods); I changed this code so it passes hashed password, but it is still not authenticating... MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(newPassword.getBytes("UTF-16LE")); byte byteData[] = md.digest(); //convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i &lt; byteData.length; i++) { sb.append(Integer.toString((byteData[i] &amp; 0xff) + 0x100, 16).substring(1)); } //String newpass = new String(pwdArray, "UTF8"); mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userPassword", sb.toString())); // Perform the update ctx.modifyAttributes(userName, mods);
tagged with: ldap
has comment: http://stackoverflow.com/comment/39461758
has title: Is there a way to change LDAP password without having "unicodePwd" attribute
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39448564
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39420393
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30461919
has comment: http://stackoverflow.com/comment/39421361
answer count: 1
has comment: http://stackoverflow.com/comment/39433379
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25346929
has title: How can I read numeric passwords in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39518167
has comment: http://stackoverflow.com/comment/39518240
downvote count: 0
answer count: 3
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25347014
tagged with: java
possible better answer: http://stackoverflow.com/a/25347014
linked to: http://stackoverflow.com/q/409784
has comment: http://stackoverflow.com/comment/39518181
has answer: http://stackoverflow.com/a/25347203
linked to: http://stackoverflow.com/q/8138411
has answer: http://stackoverflow.com/a/25347007
accepted answer: http://stackoverflow.com/a/25347203
has comment: http://stackoverflow.com/comment/39518504
favorite count: 0
type: Question
tagged with: java.util.scanner
has body: I am trying to get the user to enter a four digit pin but I don't want it to be printed out on the screen as they type it. I have tried using System.console().readPassword(); like so: import java.util.Scanner; import java.io.*; import java.util.InputMismatchException; public class VirtualATM{ private static String Details; public static void main(String [] args){ try{ //Create variables &amp; scanner to be used throughout the program. Scanner sc = new Scanner(System.in); boolean RegisterOrExist = false; int cardNo = 0; String DirToWriteFile = System.getProperty("user.dir") + "/VirtualATM.txt"; //Get path to write text file to. DirToWriteFile.trim(); File file = new File(DirToWriteFile); // if file doesn't exists, then create it if (!file.exists()) { file.createNewFile(); } //Create writer to write to files. FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); System.out.println("Enter card number, or type register to register a new card."); String register = sc.nextLine(); if(register.equalsIgnoreCase("register")){ RegisterOrExist = false; RegisterNewCard(); } else { RegisterOrExist = true; cardNo = Integer.valueOf(register); } bw.write(Details); //Close the writer. bw.close(); } catch(IOException e) { e.printStackTrace(); } } /*** Method for registering a new card **/ public static void RegisterNewCard(){ Scanner sc = new Scanner(System.in); System.out.print("Name: "); String name = sc.nextLine(); int MaxVal = Integer.MAX_VALUE; int CardNo = new java.util.Random().nextInt(MaxVal) + 1; int balance = new java.util.Random().nextInt(10000) + 1; boolean OverDraft = false; int OverDraftLimit = 0; if(OverDraft = true){ OverDraftLimit = 250; } char [] PIN = {}; System.out.println("Create a FOUR digit pin: "); try{ PIN = System.console().readPassword(); }catch(InputMismatchException e){ e.printStackTrace(); } int P1 = (int) PIN[0]; int P2 = (int) PIN[1]; int P3 = (int) PIN[2]; int P4 = (int) PIN[3]; int [] PinNo = {P1, P2, P3, …
has comment: http://stackoverflow.com/comment/39518126
tagged with: password-protection
linked to: http://stackoverflow.com/q/10819469
has comment: http://stackoverflow.com/comment/39518142

http://stackoverflow.com/comment/39379154
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25271501
has text: Who, in their right mind, would allow some program to "self update" without requesting permissions (and perhaps validating that the update is not pernicious)? You might look at "msi packaging" your application, periodically checking for update, and informing user to run an update process.
score: 1

http://stackoverflow.com/comment/39479441
has text: Understood. But how do i get the Lat,Lng then? As the lati and lon stays in the DoInBackground thus cannot access them from main thread. Please help me mister.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25325685

http://stackoverflow.com/comment/39371353
comment on: http://stackoverflow.com/a/25267457
type: Comment
has text: you need to set that in your log configuration for that package, the threshold level for any package can be set in your logs with log4j.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39313392
score: 0
type: QuestionComment
has text: if you are using a placeholder fragment approach, check if the layout with the button is "activity_main" or "fragment_main"(they are layout names by default), if its the latter, you need to find it inside onCreateView and not onCreate
type: Comment
comment on: http://stackoverflow.com/q/25236272

http://stackoverflow.com/comment/39585436
type: Comment
type: QuestionComment
has text: @mdzh, Thanks alot! I'm gonna try that
score: 0
comment on: http://stackoverflow.com/q/25383236

http://stackoverflow.com/q/25370476
has answer: http://stackoverflow.com/a/25376230
accepted answer: http://stackoverflow.com/a/25376230
score: -1
has body: I have an ActionListener in other file &amp; i want to use that ActionListener in my gui code which is package GUI; public class CheckButtonGUI { private JPanel mainPanel; private JButton One, Two, Three, Four; JLabel buttonStatus; public JPanel getGUI() { CheckButtonGUI cbg = new CheckButtonGUI(); mainPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 0, 0); One = new JButton("1"); Two = new JButton("2"); Three = new JButton("3"); Four = new JButton("4"); buttonStatus = new JLabel("No Button Pressed"); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(One,gbc); gbc.gridx = 4; //gbc.gridy = 0; mainPanel.add(Two,gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(Three,gbc); gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.gridx = 4; mainPanel.add(Four,gbc); gbc.gridwidth=3; gbc.gridx = 0; gbc.gridy = 2; mainPanel.add(buttonStatus,gbc); // Action Listeners CheckListener cli = new CheckListener(this); One.addActionListener(cli); Two.addActionListener(cli); Three.addActionListener(cli); Four.addActionListener(cli); return mainPanel; } public void displayText(String str) { buttonStatus.setText(str); } private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("[=] JTextField of Dreams [=]"); CheckButtonGUI demo = new CheckButtonGUI(); frame.setContentPane(demo.getGUI()); frame.setLocation(550, 350); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // We no longer manually re-size, we use pack to automatically size the frame. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } each &amp; everything works fine but as soon as i try to add actionListener…
type: AnsweredQuestion
upvote count: 0
tagged with: java
answer count: 1
has title: Why i can't add actionListener written in other file
downvote count: 1
tagged with: swing
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39562770
has comment: http://stackoverflow.com/comment/39571197
has comment: http://stackoverflow.com/comment/39571274

http://stackoverflow.com/comment/39369142
comment on: http://stackoverflow.com/a/25265661
type: Comment
type: AnswerComment
score: 0
has text: You can use org.hibernate.type.LongType.INSTANCE *OR* org.hibernate.type.IntegerType.INSTANCE

http://stackoverflow.com/a/25238888
answers question: http://stackoverflow.com/q/25238782
has body: You probably want to try something along the lines of: Pattern p = Pattern.compile("^[\\w\\d ._#$@-]{1,255}$"); Your problem with the remaining #, $ and @ characters might come from the fact that you added them in the character class after the hyphen (-), thus confusing the compiler about whether you were trying to add a range. Full example String[] valid = { "abc 12345", "abc12345", "abc.ert.trs.123", "abc.bcv.trs", "abc.trt#trs", "a", "a$", "$a#", "1234$", "567#", "test 123 #" }; Pattern p = Pattern.compile("^[\\w\\d ._#$@-]{1,255}$"); for (String s: valid) { Matcher m = p.matcher(s); System.out.printf("\"%s\" is valid? %b %n", s, m.matches()); } Output "abc 12345" is valid? true "abc12345" is valid? true "abc.ert.trs.123" is valid? true "abc.bcv.trs" is valid? true "abc.trt#trs" is valid? true "a" is valid? true "a$" is valid? true "$a#" is valid? true "1234$" is valid? true "567#" is valid? true "test 123 #" is valid? true
type: Answer
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25368133
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: playframework
accepted answer: http://stackoverflow.com/a/25430926
has comment: http://stackoverflow.com/comment/39657662
has title: Play Framework PersistenceException
tagged with: java
has comment: http://stackoverflow.com/comment/39657373
has answer: http://stackoverflow.com/a/25430926
has comment: http://stackoverflow.com/comment/39643923
tagged with: persistence
type: Question
tagged with: oracle-database
tagged with: ebean
possible better answer: http://stackoverflow.com/a/34236364
has body: I'm trying to use the Play framework (Java) to simply read some data from a few Oracle tables, probably even use a few complex queries later on. I'm following a tutorial but I'm having some issues retrieving the data. My Model class look like this: package models; import java.util.ArrayList; import java.util.List; import play.libs.F; import javax.persistence.*; import com.avaje.ebean.*; import play.db.ebean.*; @Entity @Table(name="TABLESPACE.CAT_BONDS") public class Cat_Bond extends Model { @Id public String symbol; public String database; public String tickType; public String assetClass; public String sourcePlatform; public String sourceExchange; public static Finder&lt;String, Cat_Bond&gt; find = new Finder&lt;String, Cat_Bond&gt;(String.class,Cat_Bond.class); public Cat_Bond(){} public Cat_Bond(String symbol, String database, String tickType, String assetClass, String sourcePlatform, String sourceExchange) { this.symbol = symbol; this.database = database; this.tickType = tickType; this.assetClass = assetClass; this.sourcePlatform = sourcePlatform; this.sourceExchange = sourceExchange; } /* * retrieve all rows from the 'cat_bonds' table */ public static List&lt;Cat_Bond&gt; findAll(){ //return new ArrayList&lt;Cat_Bond&gt;(cat_bond); return find.all(); } /* * Find by EAN */ public static Cat_Bond findByEan(String symbol){ return find.where().eq("symbol", symbol).findUnique(); } } My controller class: package controllers; import java.util.List; import views.html.*; import models.Cat_Bond; import play.data.Form; import play.mvc.*; public class Cat_Bonds extends Controller { private static final Form&lt;Cat_Bond&gt; cat_bondForm = Form.form(Cat_Bond.class); public static Result list(){ List&lt;Cat_Bond&gt; cat_bond = Cat_Bond.findAll(); return ok(list.render(cat_bond)); } And the application.conf entry looks like: #Oracle db.default.driver=oracle.jdbc.OracleDriver db.default.url="jdbc:oracle:thin:@server.uk.net.intra:port/ALIAS" db.default.user=user db.default.passwo…
has answer: http://stackoverflow.com/a/34236364

http://stackoverflow.com/a/25374670
answers question: http://stackoverflow.com/q/25374618
has comment: http://stackoverflow.com/comment/39569956
score: 3
type: Answer
has body: replaceFirst() was introduced in 1.4 and your compiler pre-dates that. One possibility is to use something like: public class testprog { public static void main(String[] args) { String s = "0001000"; while ((s.length() &gt; 1) &amp;&amp; (s.charAt(0) == '0')) s = s.substring(1); System.out.println(s); } } It's not the most efficient code in the world but it'll get the job done. A more efficient segment without unnecessary string creation could be: public class testprog { public static void main(String[] args) { String s = "0001000"; int pos = 0; int len = s.length(); while ((pos &lt; len-1) &amp;&amp; (s.charAt(pos) == '0')) pos++; s = s.substring(pos); System.out.println(s); } } Both of those also handle the degenerate cases of an empty string and a string containing only 0 characters.
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39451503
score: 0
comment on: http://stackoverflow.com/q/25308625
type: Comment
type: QuestionComment
has text: i played with width and height, left i have in the code...not much of help.

http://stackoverflow.com/q/25303954
type: Question
has comment: http://stackoverflow.com/comment/39438990
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25304075
has comment: http://stackoverflow.com/comment/39438882
has body: I have a method like: public String getParamValue(@NotNull String param) { ....... ....... ....... } Even after putting @NotNull in-front of the param, whenever i am calling getParamValue(null) it is not throwing NPE. It proceeds as normal, do i need to do something else or am i using it wrongly? Thanks. I am using Java 7 and javax.validation.constraints.NotNull if it helps in any ways.
linked to: http://stackoverflow.com/q/8756768
answer count: 3
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25304089
downvote count: 0
has title: @NotNull not working as expected
has answer: http://stackoverflow.com/a/25304138
has comment: http://stackoverflow.com/comment/39439042
favorite count: 0

http://stackoverflow.com/comment/39347991
type: Comment
has text: Either one is fine. Dagger is more focused towards Android (built for speed). Roboguice has a bit more to offer.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25254493

http://stackoverflow.com/comment/39335283
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25247905
has text: inside the while loop i pass every line into a new `Scanner`. Then my `if` statement checks if that line starts with an `int`.. `if(lineScanner.hasNextInt())`.. As i said a line starting with `£01` does not start with an `int` so it will not go inside the `if` statement and will continue to the next line.
type: Comment

firefox
type: Tag
tags question: http://stackoverflow.com/q/25296181
tags question: http://stackoverflow.com/q/25321275
tags question: http://stackoverflow.com/q/25280905
tags question: http://stackoverflow.com/q/25300690
tags question: http://stackoverflow.com/q/25354989
tag name: firefox

http://stackoverflow.com/comment/39550264
type: QuestionComment
comment on: http://stackoverflow.com/q/25337884
score: 0
has text: I cannot change entities . I need to do it in criteria api. I tried to call setFetchMode(LAZY) on `owner` association but it fetches all props of `User owner` eagerly anyway
type: Comment

http://stackoverflow.com/comment/39424446
score: 2
comment on: http://stackoverflow.com/a/25295864
type: Comment
has text: I raise you [numbered monitors](http://pastebin.com/YGBJGaGg). (By the way, for anyone reading this, don't ever do this at home.)
type: AnswerComment

http://stackoverflow.com/comment/39313936
type: Comment
type: QuestionComment
has text: It's good idea, to start using an [Integrated Development Environment](http://en.wikipedia.org/wiki/Integrated_development_environment), such as: [Eclipse IDE](http://www.eclipse.org/home/index.php), [NetBeans IDE](https://netbeans.org/), or [IntelliJ IDEA](http://www.jetbrains.com/idea/). All of those three will show you alerts and messages about what is wrong with your code before you even hit "compile/n/run" button.
comment on: http://stackoverflow.com/q/25236560
score: 0

http://stackoverflow.com/q/25322328
has answer: http://stackoverflow.com/a/25322540
accepted answer: http://stackoverflow.com/a/25322540
answer count: 1
has comment: http://stackoverflow.com/comment/39473071
tagged with: tree
type: AnsweredQuestion
score: 0
has body: I want to merge the node which has the same name, and add their children together. But I got a java.util.ConcurrentModificationException exception: Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at test.Test.mergeNode(Test.java:60) at test.Test.main(Test.java:43) Following is the source.Could someone give any hints? Any suggestions will be welcomed. public class Test { public static void main(String[] args) throws Exception { TreeLayoutNode root = new TreeLayoutNode(); root.setName("Production"); TreeLayoutNode node1 = new TreeLayoutNode(); node1.setName("node1"); TreeLayoutNode node2 = new TreeLayoutNode(); node2.setName("node1"); TreeLayoutNode child1 = new TreeLayoutNode(); child1.setName("child1"); TreeLayoutNode child2 = new TreeLayoutNode(); child2.setName("child2"); TreeLayoutNode child3 = new TreeLayoutNode(); child3.setName("child3"); root.addChildNode(node1); root.addChildNode(node2); node1.addChildNode(child1); node1.addChildNode(child2); node2.addChildNode(child1); node2.addChildNode(child3); HashMap&lt;String, TreeLayoutNode&gt; nodeMap = Maps.newHashMap(); mergeNode(root, nodeMap); } /** * * @param node */ private static void mergeNode(TreeLayoutNode node, HashMap&lt;String, TreeLayoutNode&gt; nodeMap) { List&lt;TreeLayoutNode&gt; children = node.getChildren(); if(CollectionUtils.isEmpty(children)){ return; } Iterator&lt;TreeLayoutNode&gt; it = children.iterator(); while(it.hasNext()){ TreeLayoutNode child = it.next(); if(nodeMap.containsKey(child.getName())){ TreeLayoutNode duplicate = nodeMap.get(child.getName()); List&lt;TreeLayoutNode&gt; childrenOfChild = child.getChildren(); if(CollectionUtils.isNotEmpty(childrenOfChild)){ for(TreeLayoutNode single: childrenOfChild){ duplicate.addChildNode(single); } node.removeChildNode(child); mergeNode(duplicate, nodeMap); } }else{ nodeMap.put(child.getName(), child); } } } } …
tagged with: exception
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39473267
has title: java.util.ConcurrentModificationException while merge node in a tree structure
has comment: http://stackoverflow.com/comment/39473073

cryptography
tags question: http://stackoverflow.com/q/25320978
tag name: cryptography
tags question: http://stackoverflow.com/q/25260570
tags question: http://stackoverflow.com/q/25255950
tags question: http://stackoverflow.com/q/25306191
tags question: http://stackoverflow.com/q/25284279
type: Tag
tags question: http://stackoverflow.com/q/25321187
tags question: http://stackoverflow.com/q/25320705
tags question: http://stackoverflow.com/q/25275337
tags question: http://stackoverflow.com/q/25313638
tags question: http://stackoverflow.com/q/25345075

http://stackoverflow.com/comment/39537515
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25357243
has text: i added this line of code just before of the place that call jsni code : ScriptInjector.fromUrl("//192.168.10.100:7001/mapviewer/fsmc/jslib/oraclemaps.js");i can see javascript in firebug but it stiil raise this exception :...createPluginMap is not defined

http://stackoverflow.com/a/25357241
answers question: http://stackoverflow.com/q/25356928
has comment: http://stackoverflow.com/comment/39536802
accepted answer of: http://stackoverflow.com/q/25356928
type: Answer
has comment: http://stackoverflow.com/comment/39536413
upvote count: 6
has body: DLLs created with C# are not like other DLLs. They are technically called .NET assemblies. They rely on the Common Language Runtime (CLR) in the same way that Java bytecode relies on the Java Virtual Machine. The video you posted a link to is not creating a .NET assembly, but rather a native Windows DLL. Obviously, if you have two virtual machines loaded in a process, things are going to get complicated. They both have their own ideas about how to use memory, garbage collection, layout of objects in memory, threading and so on. That's not to say that what you are trying to do is impossible, but it's a lot more complicated than loading native libraries with LoadLibrary. You might like to take a look at the following projects to help you out: SWiG - www.swig.org - free but I'm not sure how much extra work will be involved in interfacing Java to C# JNbridge - www.jnbridge.com - not free but claims to make what you are trying to do simple Javonet - www.javonet.com - not free but claims to make what you are trying to do simple IKVM - www.ikvm.net - this one is a bit left-field. It lets you run Java bytecode on a .NET runtime, which then means that you can call .NET/C# code directly. If you Java is fairly simple and/or you don't have to deploy your code to many clients, this might work for you.
has comment: http://stackoverflow.com/comment/39536267
type: AcceptedAnswer
downvote count: 0
score: 6

http://stackoverflow.com/a/25264686
score: 1
has comment: http://stackoverflow.com/comment/39394059
type: Answer
answers question: http://stackoverflow.com/q/25263028
has body: According to java doc it will not give null. It will throw ClassNotFoundException if it's not able to find class in class-path. I think your are handling this exception. Make sure you have jar in classpath. http://www.java2s.com/Code/Jar/h/Downloadhivejdbc0100jar.htm
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25263028

http://stackoverflow.com/comment/39356885
score: 0
type: QuestionComment
has text: I completely agree with @Dici. You are still allocating data on the heap based on a value which is resolved at compile time.
comment on: http://stackoverflow.com/q/25259602
type: Comment

http://stackoverflow.com/q/25234379
has comment: http://stackoverflow.com/comment/39310002
type: AnsweredQuestion
answer count: 2
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/25234561
upvote count: 1
has answer: http://stackoverflow.com/a/25234561
possible better answer: http://stackoverflow.com/a/25234417
favorite count: 0
has comment: http://stackoverflow.com/comment/39309908
tagged with: arraylist
tagged with: object
has comment: http://stackoverflow.com/comment/39309925
type: Question
has body: I am trying to create an ArrayList of Object[] from an Object[][] perform some changes and then getting a new Object[][] with the changes made. However I get this compile error: error: incompatible types: Object[] cannot be converted to Object[][] when performing this: protected Object[][] data; fillData(); ArrayList dlist= new ArrayList&lt;Object[]&gt;( Arrays.asList(data) ); //NO COMPILE ERROR Object[] example=new Object[2]; //just to use in toArray() String [] args= {"new data 1","new data 2"};//yeah just a typo thanks Oscar dlist.add( args ); //Sending String instead of Object is legal thanks Oscar. data= dlist.toArray( example ); //COMPILER ERROR incompatible... I am using the wrong statement with no compiler error: ArrayList dlist= new ArrayList&lt;Object[]&gt;( Arrays.asList(data) ); because the output is Object[] instead of Object[][] which is what i want Thanks for your help.
tagged with: java
score: 1
has answer: http://stackoverflow.com/a/25234417
has title: Arraylist<Object []> to Object[][]

http://stackoverflow.com/comment/39378302
type: QuestionComment
has text: What is the assertion after `Vector2 mtd = delta.scl(((radius + radius) - distance) / distance);`? Let's say `distance` becomes very small, then `Vector2 mtd = delta.scl(((radius + radius) - distance) / distance);` can result in mtd becoming a long Vector2. (I have othre reservations, but this should be cleared up first.)
comment on: http://stackoverflow.com/q/25270664
score: 0
type: Comment

http://stackoverflow.com/q/25308832
accepted answer: http://stackoverflow.com/a/25309236
type: AnsweredQuestion
score: 0
tagged with: javacc
tagged with: java
has title: JavaCC: How to print the text of a node?
answer count: 1
has body: Imagine I have following code in my jjt file: void architecture_statement_part() : { System.out.println("architecture_statement_part"); } { ( architecture_statement() )* } I want print the text, which corresponds to the architecture_statement_part is printed using the println statement. When something goes wrong with parsing, I will know where exactly to look for the error. How can I do it? I tried void architecture_statement() #void : { System.out.println("architecture_statement: " + image.toString()); } but it led to a compiler error.
has answer: http://stackoverflow.com/a/25309236
type: Question

http://stackoverflow.com/a/25318078
has comment: http://stackoverflow.com/comment/39465351
has comment: http://stackoverflow.com/comment/39465674
has body: The problem is in the 4th from bottom line of code: System.out.println((noSuchProvdr.getMessage()); ^ Remove the extra parenthesis from there to make it System.out.println(noSuchProvdr.getMessage()); Edit: If the compiler is telling you java.security.NoSuchProviderException is never thrown in body of corresponding try statement, remove this last catch block catch (NoSuchProviderException noSuchProvdr) { System.out.println((noSuchProvdr.getMessage()); }
has comment: http://stackoverflow.com/comment/39465327
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25318008
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25318008
upvote count: 1

http://stackoverflow.com/comment/39319976
type: Comment
comment on: http://stackoverflow.com/a/25239929
score: 0
type: AnswerComment
has text: because when i run project, firefox is opened and i can see it login succeed.

http://stackoverflow.com/a/51563062
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25243342
upvote count: 2
downvote count: 0
has body: In my case the problem was resolved when I changed my gradle version from 4.6 to 4.7.

specifications
type: Tag
tag name: specifications
tags question: http://stackoverflow.com/q/25334997

http://stackoverflow.com/comment/44973094
has text: Project Lombok is broken and very unreliable with Gradle builds.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25383690
type: Comment

http://stackoverflow.com/comment/39421234
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25294312
has text: Does it have to be formatted in a particular way for Struts to parse it then?
score: 0

http://stackoverflow.com/a/25374412
has comment: http://stackoverflow.com/comment/41170696
has comment: http://stackoverflow.com/comment/40084971
type: Answer
has comment: http://stackoverflow.com/comment/39859123
has comment: http://stackoverflow.com/comment/40106353
has comment: http://stackoverflow.com/comment/39857171
score: 4
has comment: http://stackoverflow.com/comment/39628302
answers question: http://stackoverflow.com/q/25374325
has comment: http://stackoverflow.com/comment/41243697
has comment: http://stackoverflow.com/comment/39931320
has comment: http://stackoverflow.com/comment/39830399
has body: I'm not going to lecture you on the right or wrong way to approach what you are trying to do. However, if you are trying to invoke Java code (JDBC.jar) then the following is for you.. Otherwise feel free to downvote. JVM.hpp: #ifndef JVM_HPP_INCLUDED #define JVM_HPP_INCLUDED #include "../java/jni.h" #include &lt;windows.h&gt; #include &lt;iostream&gt; #include &lt;stdexcept&gt; #include &lt;algorithm&gt; class Jvm { private: JavaVM* jvm; JNIEnv* env; JavaVMInitArgs jvm_args; jclass systemClassLoader; public: Jvm(std::string ClassPath = "."); ~Jvm(); inline JavaVM* GetJVM() const {return jvm;} inline JNIEnv* GetENV() const {return env;} inline jclass GetSystemClassLoader() const {return systemClassLoader;} void DestroyJVM(); void PrintStackTrace(); jclass DefineClass(const char* FullClassName, const void* ClassBuffer, std::uint32_t BufferLength); jclass DefineClass(const char* FullClassName, jobject ClassLoader, const void* ClassBuffer, std::uint32_t BufferLength); void RegisterNativeMethod(const char* MethodName, const char* MethodSignature, void* func_ptr); void RegisterNativeMethod(jobject ClassLoader, const char* MethodName, const char* MethodSignature, void* func_ptr); void RegisterNativeMethods(JNINativeMethod* Methods, std::uint32_t MethodCount); void RegisterNativeMethods(jobject ClassLoader, JNINativeMethod* Methods, std::uint32_t MethodCount); protected: void InitClassLoader(); }; #endif // JVM_HPP_INCLUDED JVM.cpp: #include "JVM.hpp" Jvm::~Jvm() { env-&gt;DeleteGlobalRef(this-&gt;systemClassLoader); jvm-&gt;DestroyJavaVM(); } Jvm::Jvm(std::string ClassPath) : jvm(NULL), env(NULL), jvm_args(), systemClassLoader(NULL) { JavaVMOption* options = new JavaVMOption[2]; jvm_args.version = JNI_VERSION_1_6; JNI_GetDefaultJavaVMInitArgs(&amp;jvm_args); options[0].optionString = const_cast&lt;char*&gt;("-Djava.compiler=NONE"); options[1].optionString = const_cast&lt;char*&gt;(("-Djava.class.path=" + ClassPath).c_str()); jvm_args.nOptions = 2; jvm_args.options = option…
has comment: http://stackoverflow.com/comment/39861270
has comment: http://stackoverflow.com/comment/39852590
has comment: http://stackoverflow.com/comment/39624269
has comment: http://stackoverflow.com/comment/39867905
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41228238
downvote count: 0
has comment: http://stackoverflow.com/comment/39930859
has comment: http://stackoverflow.com/comment/39938587
has comment: http://stackoverflow.com/comment/39939451
has comment: http://stackoverflow.com/comment/41171632
has comment: http://stackoverflow.com/comment/39829298
has comment: http://stackoverflow.com/comment/39854226
has comment: http://stackoverflow.com/comment/39936025
upvote count: 4
has comment: http://stackoverflow.com/comment/39827758
has comment: http://stackoverflow.com/comment/40086669
has comment: http://stackoverflow.com/comment/39828874
has comment: http://stackoverflow.com/comment/39936728
accepted answer of: http://stackoverflow.com/q/25374325
has comment: http://stackoverflow.com/comment/39859274

http://stackoverflow.com/q/25297316
has body: I'm taking over an existing Spring MVC project, and need to modify it's behavior, I added a servlet filter to intercept all incoming requests, some URLs of this app has the following format : http://example.com/SupportCenter/abc.html?token=some_token_value I want to get the token value before anything else happens, but since this app has a security login page, if you are not logged in, and you try to get to the above URL, it will direct you to the login page at : http://example.com/SupportCenter/login.jsp Therefore I won't be able intercept the incoming request url [ http://example.com/SupportCenter/abc.html ] and the token value, my app's web.xml looks like this : <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> contextConfigLocation /WEB-INF/classes/applicationContext.xml Site_Filter com.builders.support.center.ServletFilter Site_Filter /* org.springframework.web.context.ContextLoaderListener supportCenter org.springframework.web.servlet.DispatcherServlet 1 supportCenter *.html supportCenter /login supportCenter /newlogin ... FORM /login.html /fail_login.html 1 4 The supportCenter-servlet.xml looks like this : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:component-scan base-package="com.XYZ.support.center.weblayer.springmvc.controllers"/> /WEB-INF/properties/web-site.properties org.sprin…
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39432655
answer count: 0
type: UnansweredQuestion
tagged with: jsp
tagged with: servlet-filters
tagged with: spring-mvc
has title: How to intercept request in servlet filter first before it hits the login jsp in Spring MVC?
has comment: http://stackoverflow.com/comment/39432755
score: 0
tagged with: java

http://stackoverflow.com/comment/39558465
comment on: http://stackoverflow.com/a/25364397
type: Comment
score: 0
type: AnswerComment
has text: No I think you inadvertently tried to edit my answer. Please edit your question and I'll be glad to take a look.

http://stackoverflow.com/q/25372258
has body: I am thinking about implementing a content based recommendation project idea in hadoop. Just wanted suggestions if weka can be used with hadoop or if it is advisable to use Mahout for a cbf based implementation Please advise Thanks
type: Question
tagged with: hadoop
tagged with: mahout-recommender
type: UnansweredQuestion
tagged with: mahout
has comment: http://stackoverflow.com/comment/39586036
score: 0
tagged with: weka
has answer: http://stackoverflow.com/a/25386719
tagged with: java
has title: content based recommender in hadoop
answer count: 1

http://stackoverflow.com/q/25347100
has answer: http://stackoverflow.com/a/25347342
score: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
tagged with: google-cloud-datastore
tagged with: google-app-engine
answer count: 1
upvote count: 1
has title: Inconsistent behavior when adding an Entity using Google App Engine datastore
accepted answer: http://stackoverflow.com/a/25347342
type: AnsweredQuestion
has body: I'm working on a Google App Engine project that's written in Java. Whenever I add an entity into the datastore I use a transaction: DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Transaction transaction = datastore.beginTransaction(); datastore.put(entity); transaction.commit(); I then count the number of entities that are in the datastore: Query query = new Query(kind); query.setFilter(filter); PreparedQuery preparedQuery = datastore.prepare(query); int count = preparedQuery.countEntities(FetchOptions.Builder.withDefaults()); System.out.println("count = " + count); I've noticed that sometimes the datastore can be inconsistent. Like sometimes I'll add an entity, but the count doesn't show up. If I then add another entity the count goes up by 2. Why does this happen? How do I stop it from happening?

http://stackoverflow.com/comment/39701186
score: 0
has text: Thanks for responding but thing is same for info docs and man pages. I haven't find anything regarding the raspivid controls to control the video stream with different processes.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25438272

http://stackoverflow.com/a/65906094
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25320890
has body: This is the best way I found for this problem, since it does not matter where the browser is installed or whatever, java communicates with the operating system and makes a request to run the default browser. String url = "https://yourdomain.org/"; java.awt.Desktop.getDesktop().browse( java.net.URI.create(url));

http://stackoverflow.com/q/25260630
has comment: http://stackoverflow.com/comment/39359423
has answer: http://stackoverflow.com/a/25261411
linked to: http://stackoverflow.com/q/14075799
tagged with: swing
tagged with: tablecellrenderer
has comment: http://stackoverflow.com/comment/39358578
type: AnsweredQuestion
tagged with: jtable
has title: JTable - extend default CellRenderer
score: 0
tagged with: java
answer count: 1
type: Question
has body: I use a big JTable and I want to extend the CellRenderer for every Class, so every second Row has a gray Background, to make it more readable. This gray Background for every second row should look something like this: http://i61.tinypic.com/of3sky.png But I still want the default alignment for every Class and the default settings for isSelected and hasFocus. The code for the Background should be simple, something like: if(row % 2 == 0){ super.setBackground(new Color(200, 200, 200)); } else{ super.setBackground(Color.WHITE); } But how to get the default CellRenderer for every Class, and extend it in this way? Thank you in advance!
duplicate of: http://stackoverflow.com/q/14075799
accepted answer: http://stackoverflow.com/a/25261411

http://stackoverflow.com/comment/39447320
comment on: http://stackoverflow.com/q/25308509
has text: Where? You mean in the run configuration dialog? i.e. arguments to your java program?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32663790
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/66670043
has body: Create getters/setters for your data model. It has solved my problem.
score: 5
answers question: http://stackoverflow.com/q/25365707
has comment: http://stackoverflow.com/comment/70800918
upvote count: 5

http://stackoverflow.com/comment/39369225
score: 0
comment on: http://stackoverflow.com/q/25265997
type: QuestionComment
has text: Waog gave you the correct answer (correct since you edited it).
type: Comment

http://stackoverflow.com/a/25260336
has body: Note that you cannot override @Import extending configuration classes. If you want to select which imports to use at runtime, you could use a @ImportSelector instead. However, @Configuration classes are not more that spring (scoped) managed factories so as you already have a factory method for someBean you don't need to go even further: @Configuration public class SubModuleA1Config { @Autowired private Environment env; @Bean public SomeBean someBean() { String customerProperty = env.getProperty("customer"); if ("C1".equals(customerProperty)) return new C1SomeBean(); return new SomeBean(); } } Update Using a ImportSelector: class CustomerImportSelector implements ImportSelector, EnvironmentAware { private static final String PACKAGE = "org.example.config"; private static final String CONFIG_CLASS = "SubModuleConfig"; private Environment env; @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { String customer = env.getProperty("customer"); return new String[] { PACKAGE + "." + customer + "." + CONFIG_CLASS }; } @Override public void setEnvironment(Environment environment) { this.env = environment; } } @Configuration @Import(CustomerImportSelector.class) public class ModuleAConfig { // some module level beans } However, as every customer has a a separate package, consider also using @ComponentScan. This will pick the configuration class present and don't need a extra configuration property. @Configuration @ComponentScan(basePackages="org.example.customer") public class SubModuleA1Config { @Autowired private CustomerFactory customerFactory; @Bean public SomeBean someBean() { return customerFactory.someBean(); } } public interface CustomerFactory { SomeBean someBean(); } @Component public class C1CustomerFactory implements CustomerFactory { @Override public SomeBean someBean() { return new C1SomeBean(); } }
upvote count: 9
has comment: http://stackoverflow.com/comment/39380309
type: Answer
answers question: http://stackoverflow.com/q/25252374
has comment: http://stackoverflow.com/comment/39422032
score: 9
accepted answer of: http://stackoverflow.com/q/25252374
has comment: http://stackoverflow.com/comment/39424298
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39385833
comment on: http://stackoverflow.com/q/25271569
has text: I am trying to figure out if there is a way to get a response back from the client once he has successfully completed his task. I thought callback was the correct way to approach this but now I am not sure thats the case.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25370670
has answer: http://stackoverflow.com/a/25371120
upvote count: 0
type: UnansweredQuestion
answer count: 1
score: -3
has comment: http://stackoverflow.com/comment/39562390
has title: OpenGL drivers out of date on 2012 macbook pro
has body: I have recently taken to programming in Java with LWJGL. I have been following a tutorial series on how to make a game engine using this library. However, I have been getting a lot of errors despite the fact that I copied his code exactly, and later used the exact code he typed to troubleshoot. I asked him about it and he said that it was probably because my OpenGl was out of date. Sure enough, when I checked, I discovered that I was running OpenGL 2.1, and needed at least openGl 3.0 to follow his tutorial. When I searched around on how to update my drivers, it said that you needed update your OS X. However, I am currently running the latest version of Mavericks, and have a 2012 retina Macbook Pro. According to this apple help page: http://support.apple.com/kb/HT5942?viewlocale=en_US&amp;locale=en_US my particular model should be running OpenGL 4.1, not 2.1. How on earth could this have happened, and what do I need to do to update my drivers?
tagged with: opengl
tagged with: java
downvote count: 3
tagged with: macos
linked to: http://stackoverflow.com/q/24095931
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39562331

http://stackoverflow.com/q/25291950
answer count: 1
has answer: http://stackoverflow.com/a/25380757
has title: Acess values xml file from animation xml file
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/xml
has body: Inside my res/animator/backward.xml file, how can I acess a value from res/values/dimens.xml ? <translate android:fromXDelta="0%" android:toXDelta="-100%" android:duration="@dimen/anim_time" /> values file: 500
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/25380757

http://stackoverflow.com/comment/39467323
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25318983
has text: I tested it and got the exception. It's the last snippet of my message.
type: AnswerComment

http://stackoverflow.com/q/25272863
type: Question
linked to: http://stackoverflow.com/q/2231369
tagged with: datainputstream
has comment: http://stackoverflow.com/comment/39381471
linked to: http://stackoverflow.com/q/207947
has title: Does a DataInputStream skip chars?
accepted answer: http://stackoverflow.com/a/25272921
has body: I have an problem with the DataInputStream, it doesn't read the file completly there are every so often (every ~33000 chars) 2-3 chars skipped. I am trying to parse the file (8 mb) as json and with those skipped chars in the string I can't parse the string as json. public static String readTemplate(String templateName) throws IOException { log.info("Opening Template"); InputStream resStream = this.getClass().getResourceAsStream("/assets/"+SpellCraftMod.MODID+"/templates/"+templateName+".json"); // I need to open the file that way DataInputStream in = new DataInputStream(resStream); String temp = ""; SpellCraftMod.log.info("Reading Data"); int available = 0; while ((available = in.available()) &gt; 0) { try { temp += in.readUTF(); } catch (EOFException ignore) {} log.info("To GO: " + available); } log.info("Closing File"); in.close(); resStream.close(); return temp; }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25272921
has comment: http://stackoverflow.com/comment/39381595
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39381516
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has comment: http://stackoverflow.com/comment/39381400
has comment: http://stackoverflow.com/comment/39381737

http://stackoverflow.com/q/25305805
answer count: 1
tagged with: service
type: Question
has body: I'm implementing a bound service that an activity can access via binding. I call methods of the service to get access to particular values. The service gets values updates every 30 millis with a Timer.scheduleAtFixedRate calls to the update method. I'm expecting that with binding, updated values of the service will be pushed to activity and result in automatic updating of my activity values with only one call; but this is not the case. Alternatively, I put the service method call in a runnable class and post it using a Handler object. However, even so, the values are not updated. The connection onCreate(): mConnection = new ServiceConnection(){ @Override public void onServiceConnected(ComponentName name, IBinder service) { // TODO Auto-generated method stub Toast.makeText(context, "Service is connected", Toast.LENGTH_SHORT).show(); LocalBinder binder = (LocalBinder) service; gyroService = binder.getService(); mBound = true; } @Override public void onServiceDisconnected(ComponentName name) { // TODO Auto-generated method stub Toast.makeText(context, "Service is disconnected", Toast.LENGTH_SHORT).show(); mBound = false; } }; Here's the binding onStart of my activity method. @Override protected void onStart() { super.onStart(); // Bind to LocalService Intent gyroIntent = new Intent(this, GyroFusionService.class); Bundle bundle = new Bundle(); bundle.putString("activity", "calibration"); gyroIntent.putExtras (bundle); bindService(gyroIntent, mConnection, Context.BIND_AUTO_CREATE); } Here's the runnable object I call using a handler: private Runnable updateTiltTask = new Runnable() { public void run() { if (mBound) { // Call a method from the LocalService. // However, if this call were something that might hang, then this request should // occur in a separate thread to avoid slowing down the activity performance. calibValues = ((GyroFusionService) gyroService).getCalibArray(); baseValues = ((GyroFusionService) gyroService).getBaseArray(); updateOrientationDisplay(); // o…
tagged with: android
has title: Dynamic value updates from a bound service
type: AnsweredQuestion
score: 0
tagged with: binding
has answer: http://stackoverflow.com/a/25327281
tagged with: dynamic
accepted answer: http://stackoverflow.com/a/25327281
tagged with: java

http://stackoverflow.com/comment/39531353
has text: Yes I am. At least my compiler lets me do that ;) When synchronizing static method you are making using class for locking. I've edited my post once again so that it answers the questions in more detailed way. I've used the volatile for DCL - thanks for reminding me that. Please do let me know if you think there is something wrong with the extended answer.
comment on: http://stackoverflow.com/a/25354210
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25248438
has body: I have a dynamic form on submit I call the plugin like below var method = "post"; // Set method to post by default if not specified. var path = "downloadExcel.obj"; var formDownload = document.createElement("form"); formDownload.setAttribute("method", method); formDownload.setAttribute("action", path); formDownload.setAttribute("id", "fileDownloadForm"); var custhiddenField = document.createElement("input"); custhiddenField.setAttribute("type", "hidden"); custhiddenField.setAttribute("name", "customerId"); custhiddenField.setAttribute("value", customerId); // VALUE IS GETTING UPDATED HERE formDownload.appendChild(custhiddenField); ............................................................................... //On printing the form here on console I get the updated formDownload ........................................................................... formDownload.submit = $.fileDownload($('#fileDownloadForm').prop('action'), { httpMethod: "POST", data: $('#fileDownloadForm').serialize(), preparingMessageHtml: "We are preparing your report, please wait...", failMessageHtml: "There was a problem generating your report, please try again." }); Now I am able to download the file first time successfully but when I try to download second time [without refreshing the page], my variable formDownload is having the updated data but when I debug inside jquery.fileDownload [settings.data] still have the old data. Henceforth downloading the file for previous customer again and again
score: 0
has comment: http://stackoverflow.com/comment/39337419
answer count: 2
has comment: http://stackoverflow.com/comment/39339549
has comment: http://stackoverflow.com/comment/39337250
tagged with: java
has title: JOHN CULVINER FILE DOWNLOAD with dynamic form not working
has comment: http://stackoverflow.com/comment/39336299
has comment: http://stackoverflow.com/comment/39339187
tagged with: jsp
has answer: http://stackoverflow.com/a/25267232
has comment: http://stackoverflow.com/comment/39339650
has comment: http://stackoverflow.com/comment/39337078
type: Question
has comment: http://stackoverflow.com/comment/39336789
has answer: http://stackoverflow.com/a/25250443
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39336631
tagged with: spring-mvc

http://stackoverflow.com/comment/39424066
comment on: http://stackoverflow.com/a/25274453
type: AnswerComment
score: 0
type: Comment
has text: @MachlevDevelopment look at the change I made.

http://stackoverflow.com/comment/39391353
type: AnswerComment
score: 0
has text: Didn't work! @Html(names.mkString("[",",","]")) // Error : Tom is not defined @Html(names.mkString("""["", """","""", """"]")) // Error : unclosed multi-line string literal
comment on: http://stackoverflow.com/a/25275965
type: Comment

http://stackoverflow.com/a/25317387
answers question: http://stackoverflow.com/q/25313837
score: 0
has body: Add this to web.xml PrimeFaces FileUpload Filter org.primefaces.webapp.filter.FileUploadFilter I only had this in my web.xml had forgoten to add the filter itself PrimeFaces FileUpload Filter faces FORWARD Looks like the FileUploader will work without it but not very well at all. Would think a configuraton error like that would of log something to indicate where the problem was.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25313837
type: Answer

http://stackoverflow.com/comment/39472628
type: QuestionComment
comment on: http://stackoverflow.com/q/25322108
type: Comment
has text: Please add your code right here.
score: 0

http://stackoverflow.com/comment/39434614
comment on: http://stackoverflow.com/q/25288128
score: 0
type: Comment
type: QuestionComment
has text: If you disagree that your question is a duplicate, edit your question to include a link to that other question and to explain why your question is not a duplicate. Rather than having a discussion in comments.

http://stackoverflow.com/comment/39509119
type: Comment
type: QuestionComment
has text: yes! I tried and actually its working. I identified that problem is happening when I have try-catch block nested in "if-statement". In those cases my code is not able to detect "try" block.
comment on: http://stackoverflow.com/q/25340834
score: 0

http://stackoverflow.com/q/25378881
answer count: 1
type: Question
tagged with: android
score: 0
tagged with: teechart
has body: I'm trying to customize Teechart Pie. Now it looks this: As you can see, there are values and names in the legend. How can I remove values and leave only names in the legend? Thank you.
type: AnsweredQuestion
has title: Teechart: how remove values from legend?
has answer: http://stackoverflow.com/a/25382014
accepted answer: http://stackoverflow.com/a/25382014
tagged with: java

http://stackoverflow.com/comment/39422135
has text: @AdamJ You can do `a[0] = a[0].toUpperCase();` which would replace the String in a[0].
type: AnswerComment
comment on: http://stackoverflow.com/a/25294868
type: Comment
score: 0

http://stackoverflow.com/comment/39585770
comment on: http://stackoverflow.com/a/25383315
type: AnswerComment
has text: Mike, thank you. This really helps me. I'm going to try and re-write my program a few times for practice, and your feedback will really help.
score: 0
type: Comment

http://stackoverflow.com/comment/39576595
type: AnswerComment
comment on: http://stackoverflow.com/a/25378413
has text: He doesn't need the `BufferedReader` as well as the `Object[]` array
type: Comment
score: 0

http://stackoverflow.com/q/25283589
has comment: http://stackoverflow.com/comment/39401914
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/39401442
has comment: http://stackoverflow.com/comment/39401729
has comment: http://stackoverflow.com/comment/39401627
has answer: http://stackoverflow.com/a/25323967
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39401654
score: 0
has comment: http://stackoverflow.com/comment/39401991
tagged with: java
has comment: http://stackoverflow.com/comment/39401544
tagged with: plugins
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39401547
has body: I've developed a plugin (MultiTanPluginX) that executes a m2m QVT transformation. The transformation is executed successfully in the plugin itself, however, when exporting the plugin and using it in another java project I'm getting this error: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory$Registry org.eclipse.m2m.qvt.oml.TransformationExecutor.doLoad(TransformationExecutor.java:205) org.eclipse.m2m.qvt.oml.TransformationExecutor.loadTransformation(TransformationExecutor.java:108) org.eclipse.m2m.qvt.oml.TransformationExecutor.execute(TransformationExecutor.java:137) multitenantplugin.qvtTransform.generateMultiTenant(qvtTransform.java:81) org.saas.mda.tenanthandler.tenantServlet.dothistrans(tenantServlet.java:205) org.saas.mda.tenanthandler.tenantServlet.doGet(tenantServlet.java:182) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) I've defined this class in the Runtime plugins inside my plugin, however, this class can't be included as a jar file in my new java project. How can I solve this?
has title: Invoking my own plugin in another java project
has comment: http://stackoverflow.com/comment/39475354
answer count: 1
has comment: http://stackoverflow.com/comment/39400764
accepted answer: http://stackoverflow.com/a/25323967

http://stackoverflow.com/a/25281605
upvote count: 3
type: Answer
has body: Sadly generics won't work here as generics do not cover primitives but they do cover primitive arrays. Primitive arrays are also not autoboxed into a wrapper class array. That is something you would have to do manually, but that is very very slow. One solution is to provide an override for each primitive, similar to how Arrays.sort is implemented. This creates a lot of duplicate code. Another solution is to use an Array interface similar to ArrayList that emulates an Array, get/set methods for indices, and provide subclasses for each primitive and one for objects. You can then use the Array interface and not care what the actual type is.
answers question: http://stackoverflow.com/q/25281409
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25281409
score: 3

http://stackoverflow.com/comment/73956965
type: Comment
score: 4
type: AnswerComment
has text: What would the approach be for a scenario, eg with Venue and Address entities, where a venue must have an Address and an address MUST be associated with a Venue? I mean...to avoid creating an orphaned address which may never be assigned to anything? Maybe Im wrong, but the client app SHOULD NEVER be responsible maintaining consistency within the database. I cannot rely on client app creating an Address and then definitely assigning to a Venue. Is there a way to POST the sub-resource (in this case the Address entity) with the creation of the actual resource so that I can avoid inconsistency??
comment on: http://stackoverflow.com/a/26426909

http://stackoverflow.com/q/25366015
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/25366103
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39552693
has title: ArrayList of objects. Search by multiple conditions
answer count: 1
type: Question
has body: I've got an ArrayList of CRM objects (actionsList). I want to find: If one object has a value "First contact" in field "typeOfContact", is there another object with the value "Offer" field "typeOfContact" and the same dealer and name as in previous object. public class CRM { private String remark; private String number; private String dealer; private String name; private String typeOfContact; private String model; private String phone; private String email; //... public String getRemark(){ return remark; } public void setRemark(String remark){ this.remark=remark; } public String getNumber(){ return number; } public void setNumber(String number) { this.number=number; } public String getDealer(){ return dealer; } public void setDealer(String dealer) { this.dealer=dealer; } public String getName(){ return name; } public void setName(String name) { this.name=name; } public String getTypeOfContact(){ return typeOfContact; } public void setTypeOfContact(String typeOfContact) { this.typeOfContact=typeOfContact; } public String getModel(){ return model; } public void setModel(String model) { this.model=model; } public String getPhone(){ return phone; } public void setPhone(String phone) { this.phone=phone; } public String getEmail(){ return email; } public void setEmail(String email) { this.email=email; } // ... } Should it be something like this? for(CRM crm : actionsList){ if (crm.getTypeOfContact.equals("First contact"){ for(CRM x : actionsList){ if (x.getDealer().equals(crm.getDealer()) &amp;&amp; (x.getName().equals(crm.getName()) &amp;&amp; x.getTypeOfContact().equals("Offer"))){ System.out.println("OK"); } else { System.out.println("Not OK"); } } } }
has answer: http://stackoverflow.com/a/25366103
has comment: http://stackoverflow.com/comment/39552752

http://stackoverflow.com/a/25367884
downvote count: 0
answers question: http://stackoverflow.com/q/25364409
has body: docker pull command just pull a pre-built image. There isn't Dockerfile on your local machine. But you can find the original Dockerfile from Docker Hub. If you use itzg/ubuntu-openjdk-7 image you can access it's online repository. https://registry.hub.docker.com/u/itzg/ubuntu-openjdk-7/ Dockerfile is available on Dockerfile tab(Only "Automated Build" repositories have Dockefile tab on Docker Hub). FROM ubuntu:trusty MAINTAINER itzg ENV APT_GET_UPDATE 2014-07-19 RUN apt-get update RUN apt-get install -y openjdk-7-jre-headless ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 Below is another Dockerfile from edwindj/docker-r. FROM ubuntu:trusty MAINTAINER Edwin de Jonge RUN apt-get update RUN apt-get install -y r-base There is no method to automatically merge two or more Dockerfiles, but you can combine these two Dockerfile like below. FROM ubuntu:trusty RUN apt-get update # Install java RUN apt-get install -y openjdk-7-jre-headless ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 # Install R RUN apt-get install -y r-base And build it with docker build command. $ docker build nacyot/ubuntu-java-r . Try to java and R command on the container which based on nacyot/ubuntu-java-r image. $ docker run -it nacyot/ubuntu-java-r cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS" $ docker run -it nacyot/ubuntu-java-r java -version java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode) $ docker run -it nacyot/ubuntu-java-r R --version R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the GNU General Public License versions 2 or 3. For more information about these matters see http://www.gnu.org/licenses/. It wor…
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/q/25383863
has answer: http://stackoverflow.com/a/25383926
possible better answer: http://stackoverflow.com/a/25383926
upvote count: 8
has comment: http://stackoverflow.com/comment/39586583
type: Question
score: 2
has comment: http://stackoverflow.com/comment/39586825
tagged with: final
has comment: http://stackoverflow.com/comment/39586592
has title: What does "static final int" mean?
downvote count: 6
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25383947
has body: I'm new to java and the book surprisingly started using this without explaining it even once. Why does stack overflow want me to write even more than I actually need?
answer count: 3
has comment: http://stackoverflow.com/comment/83478125
tagged with: java
has comment: http://stackoverflow.com/comment/39586566
has answer: http://stackoverflow.com/a/25383925
has comment: http://stackoverflow.com/comment/39586833
linked to: http://stackoverflow.com/q/2070669
accepted answer: http://stackoverflow.com/a/25383925

http://stackoverflow.com/q/25359901
has answer: http://stackoverflow.com/a/25360249
has comment: http://stackoverflow.com/comment/39541822
type: Question
has comment: http://stackoverflow.com/comment/39544511
tagged with: resourcebundle
type: UnansweredQuestion
has body: I have an application that is separated in several contexts with the same layout for each context but with different messages. Example on context "A": TITLE Label: text Example on context "B": TITLE B Label: text B Note that the "Label" is the same on each context and context "A" is the default context. I need to have one properties files per context: resources.properties (context A - default) title=TITLE label=Label text=text resources_b.properties (context B) title=TITLE B text=text B And I would like to load the good property file depending on context. The first solution I found is to use Locale like this: // context is either "A", "B"... resources = ResourceBundle.getBundle(config, new Locale(context)); This way, if the message is not found in resources_b.properties, it will return the one from resources.properties as expected. What could be the best way to have a "pretty" resource loading per context not using Locale ? The application is currently only in English, but it may change in the future...
has comment: http://stackoverflow.com/comment/39542502
has comment: http://stackoverflow.com/comment/39541724
score: 0
has title: Load ResourceBundle depending on context
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39305373
type: Comment
has text: Open your war file by using unzip tool and check in lib whether dom4j jar is available or not.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25232267

http://stackoverflow.com/a/25264910
has comment: http://stackoverflow.com/comment/39392859
accepted answer of: http://stackoverflow.com/q/25257046
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25257046
has comment: http://stackoverflow.com/comment/39392696
has comment: http://stackoverflow.com/comment/39435478
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has body: To get the value of the actor field, you need to find the revision entity. It's a normal entity, so you can simply look it up by id using Hibernate, or using the AuditReader.findRevision(revisionEntityClass, revision) method. As to querying for revisions generated in the last 5 minutes, I would do a query on the revision entity specifying that the timestamp column must be &gt;= NOW()-5 minutes (that's pseudo-code, of course :) ).

http://stackoverflow.com/q/25278784
tagged with: maven
has answer: http://stackoverflow.com/a/25279838
favorite count: 0
tagged with: jmeter-maven-plugin
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25279838
type: Question
has body: I build a test plan on Jmeter and running that from maven. But I don't know how to take those user defined variables from the command line when I am running the test on maven that I have specified in Jmeter. For example I have defined the number of threads field in jmeter with "${__P(users)}", or I have some if controller condition to run the specific thread. And specified the if condition of if controller with "${__P(tiff)}" == "true". So how do I take the values of tiff or users from command line when I am running the test with maven. What should I include in my POM.xml file? how should I write the command line statement to achieve this goal My dependencies and plugins in pom.xml are as follows: org.jvnet.hudson.plugins jmeter 0.3.0 test com.lazerycode.jmeter jmeter-maven-plugin 1.9.1 jmeter-tests verify jmeter
has title: How to run take the users defined variables of Jmeter from command line when running the test through jmeter-maven plugin
tagged with: jmeter
upvote count: 3
answer count: 1
downvote count: 0
tagged with: jmeter-plugins

http://stackoverflow.com/a/25385209
upvote count: 1
has comment: http://stackoverflow.com/comment/39618253
has comment: http://stackoverflow.com/comment/39624773
answers question: http://stackoverflow.com/q/25384736
has comment: http://stackoverflow.com/comment/39628384
score: 1
has body: I think you're looking for a list like this: http://www.xe.com/symbols.php Just read in the list and create a map of columns 1 = key, 3 = value. Most of the currency symbols are single-character, but not all are. That's just a fact of life. Using the code, you can go between the symbol in this new list and the currency value in the original source you provided.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39419295
type: AnswerComment
has text: @MarkPeters True. As stated in the JLS quote above, "and the value of the constant expression is representable in the type of the variable". A negative `final` `b` would cause `char c = b;` to fail with an error also.
comment on: http://stackoverflow.com/a/25293421
score: 0
type: Comment

http://stackoverflow.com/a/25231257
has comment: http://stackoverflow.com/comment/39303237
has comment: http://stackoverflow.com/comment/39303712
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25231125
has comment: http://stackoverflow.com/comment/39304160
has comment: http://stackoverflow.com/comment/39303114
score: 2
has comment: http://stackoverflow.com/comment/39303176
accepted answer of: http://stackoverflow.com/q/25231125
downvote count: 0
has comment: http://stackoverflow.com/comment/39303527
has comment: http://stackoverflow.com/comment/39303936
type: Answer
has body: Solution is :: Bundle.putParcelable/Bundle.getParcelable Have a look at this answer. Use those methods, putParcelable and getParcelable. Also you can :: Intent intent = new Intent(context, SecondActity.class); intent.putIntegerArrayListExtra("arraylist",myArrayList); //myArrayList is ArrayList&lt;Integer&gt; startActivity(intent); To get the arrayList in second Activity. ArrayList arrayList&lt;Integer&gt; = getIntent().getIntegerArrayListExtra("myArrayList") {Edit} ---- You can use newInstance to pass the data from fragment to fragment This is one of the way to achieve it, i use constructor to pass the data FragmentOne.java int myData=12; FragmentManager manager = getActivity().getSupportFragmentManager(); Fragment frgObj=FragmentTwo.newInstance(myData); FragmentTransaction ft = manager.beginTransaction(); ft.replace(R.id.container, frgObj,"FragmentTwo"); ft.addToBackStack(null); ft.commit(); FragmentTwo.java int myData; public static FragmentTwo newInstance(int _myData){ FragmentTwo fragment = new FragmentTwo(); myData=_myData return fragment; } {EDIT-3} I have made a project for you download it from Here Mount in in your editor and run it .... it has bunch of other stuffs .... don't bother about it Check how i am starting a fragment from activity ----> then onClick of button how i am starting a fragment ---> there pass the data with the constructor as i shown in edit2 ALSO REFER -- this -- StackOVERFLOW POST
has comment: http://stackoverflow.com/comment/39459765
upvote count: 2
has comment: http://stackoverflow.com/comment/39303637

http://stackoverflow.com/q/25251460
has body: I'm currently stuck trying the following. I have managed to store two values as BigDecimals, I have also managed to divide these values and show the chosen amount of decimals. Current fields: BigDecimal latestPopulation, earliestPopulation, gip, divider; Like so: latestPopulation = new BigDecimal(aInterger.toString()); earliestPopulation = new BigDecimal(bInterger.toString()); divider = latestPopulation.divide(earliestPopulation, 10, RoundingMode.HALF_UP); I then need to use the power of like so: gip = divider.pow(1/cInterger); However when I call System.out.println(gip); it shows the result with no decimal places. How do I define the number of decimal places I want?
has title: Java - How To Show Decimals with BigDecimal pow
has comment: http://stackoverflow.com/comment/39342134
score: 1
tagged with: math
tagged with: java
tagged with: bigdecimal
linked to: http://stackoverflow.com/q/9482889
has comment: http://stackoverflow.com/comment/39341992
type: Question
has comment: http://stackoverflow.com/comment/39341959
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25251650
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39451573
type: QuestionComment
has text: `Autowired is not happening. The object is null` show the complete stacktrace of exception and add code instead of adding images..
comment on: http://stackoverflow.com/q/25310197
score: 0
type: Comment

http://stackoverflow.com/comment/46146796
type: AnswerComment
has text: Why can you not POST the comment to the returning comments link? What was the design decision around this? The HAL examples show this as supported. See this example provided in the spec on users posts. http://haltalk.herokuapp.com/explorer/browser.html#/users/mike
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25451662

http://stackoverflow.com/comment/39425243
type: Comment
score: 2
type: AnswerComment
has text: "people would synchronize the String in order to call its method safely" -- that doesn't make any sense. There doesn't have to be any relationship between the lock object and the operations that are being synchronized, and there often isn't any.
comment on: http://stackoverflow.com/a/25296023

http://stackoverflow.com/q/25280130
has answer: http://stackoverflow.com/a/25280475
type: AnsweredQuestion
score: 0
has body: I have successfully parsed JSONArray into list by using the below function public List&lt;Integer&gt; ParseJson(String json, List&lt;Integer&gt; myList) { JSONArray jsonArray = null; try { JSONObject mainJson = new JSONObject(json); jsonArray = mainJson.getJSONArray("result"); myList = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; jsonArray.length(); i++) { myList.add(Integer.parseInt(jsonArray.get(i).toString())); } // System.out.println(myList); } catch (JSONException e) { e.printStackTrace(); } Collections.reverse(myList); return myList; } Now I need the List into reverse order. What would be the optimized way to do that?
tagged with: reverse
has comment: http://stackoverflow.com/comment/39394191
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25280507
possible better answer: http://stackoverflow.com/a/25280475
answer count: 4
has comment: http://stackoverflow.com/comment/39394315
has comment: http://stackoverflow.com/comment/39394323
has comment: http://stackoverflow.com/comment/39394201
type: Question
has comment: http://stackoverflow.com/comment/39394164
has title: android reverse int array
has comment: http://stackoverflow.com/comment/39394391
has comment: http://stackoverflow.com/comment/39394497
accepted answer: http://stackoverflow.com/a/25280478
has answer: http://stackoverflow.com/a/25280478
has answer: http://stackoverflow.com/a/25280491
has comment: http://stackoverflow.com/comment/39394696
has comment: http://stackoverflow.com/comment/39394595

http://stackoverflow.com/comment/39431424
type: Comment
type: QuestionComment
score: 0
has text: @Birdie I mean: to submit a callback that will be triggered once the event occurs.
comment on: http://stackoverflow.com/q/25299620

http://stackoverflow.com/comment/39473383
type: AnswerComment
comment on: http://stackoverflow.com/a/25310332
type: Comment
has text: Glad that I could help you!
score: 0

http://stackoverflow.com/q/25332844
linked to: http://stackoverflow.com/q/11693135
has body: I have small java application with rest api. It's deployed and available with url like http://1.1.1.1:8080/rest. Also I enabled CORS filter there and it works find. But also I would like to configure access to my api with url like "http://myhost.com/". In this case CORS filter stop working. Any ideas? UPD1 Available headers: response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); UPD2 Updated 'Access-Control-Allow-Headers': response.setHeader("Access-Control-Allow-Headers", "x-requested-with, " + "Content-Type, " + "Host, " + "User-Agent, " + "Accept, " + "Accept-Language, " + "Accept-Encoding, " + "Referer, " + "Origin, " + "Connection, " + "Cache-Control"); Request: GET /list HTTP/1.1 Host: myhost.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0 Accept: */* Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Referer: http://mysecondhost.com/test.html Origin: http://mysecondhost.com Connection: keep-alive Cache-Control: max-age=0 UPD3 Looks like we have nginx there with the following headers configuration: add_header 'Access-Control-Allow-Methods' 'GET,POST,DELETE,OPTIONS'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Headers' 'WD-Since,WD-Start,WD-Direction,WD-Length,WD-Ids,Content-Type,WD-Client-Id'; add_header 'Access-Control-Expose-Headers' 'WD-Total-Length,WD-Phone-Modal,WD-Client-Id,WD-Udid,WD-Need-More'; proxy_cache off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:8080/rest/;
has comment: http://stackoverflow.com/comment/39495590
type: Question
tagged with: cors
has comment: http://stackoverflow.com/comment/39494330
has comment: http://stackoverflow.com/comment/39495068
has answer: http://stackoverflow.com/a/25342715
answer count: 1
tagged with: tomcat
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25342715
has title: CORS doesn't work for different url
tagged with: nginx
linked to: http://stackoverflow.com/q/23478470
tagged with: java

http://stackoverflow.com/comment/39374927
type: QuestionComment
comment on: http://stackoverflow.com/q/25269382
has text: But two -1 votes for asking the same question twice.
score: 0
type: Comment

http://stackoverflow.com/comment/39463980
comment on: http://stackoverflow.com/a/25316710
type: Comment
score: 0
type: AnswerComment
has text: I wouldn't wish to post it here. Can you send me some zip using dropbox, or whatever file sharing you want then post the link for the download ?

checkstyle
tags question: http://stackoverflow.com/q/25376347
tags question: http://stackoverflow.com/q/25382831
tags question: http://stackoverflow.com/q/25345238
tag name: checkstyle
type: Tag

http://stackoverflow.com/comment/39317517
type: QuestionComment
type: Comment
has text: I will try to post my code. The problem is that i did too many attempts, so i need to post the most stable version. It will take some time.
score: 0
comment on: http://stackoverflow.com/q/25238334

http://stackoverflow.com/comment/39428129
score: 0
type: AnswerComment
has text: @cekayyy, that's an outer JsonObject around the JsonArray. I'll update my answer.
comment on: http://stackoverflow.com/a/25253566
type: Comment

http://stackoverflow.com/comment/39559807
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25369535
type: Comment
has text: Thanks. This quickfix works. If you find any information on this bug, please post the link here.

http://stackoverflow.com/a/25298226
answers question: http://stackoverflow.com/q/25297967
score: 0
type: Answer
has body: So I managed to run this code using Rhino. It does in fact run. I made some changes to filenames in order to get it running on my mac, but it is essentially the same code: function ReadFile () { var file = new java.io.BufferedReader(new java.io.FileReader("file")); var fileWriter = new java.io.FileWriter("file2",false); while ((line = file.readLine()) != null) { if (line.contains ("/")) line = line.replace("/","\\"); fileWriter.write(line + "\n"); } fileWriter.close(); file.close(); } ReadFile (); So the bugs you had were: Reading and writing to the same file. This is awkward using streams. Basically, don't do it. I changed it to write to file2. Closing the writer inside your reader loop. Close the writer at the end, once closed, you can no longer write to it. Not closing the file you are reading from. For those interested in how I got this running, on OS X, using rhino: brew install rhino rhino example.js I had to remove the println because that wasn't recognised but that wasn't a critical part. JS on the JVM. Fun! Except nothing is async..... There are other JS engines too, but rhino worked.
accepted answer of: http://stackoverflow.com/q/25297967
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39428711

http://stackoverflow.com/comment/39349097
comment on: http://stackoverflow.com/a/25254428
type: AnswerComment
score: 0
has text: <phew> thought I missed something :P
type: Comment

http://stackoverflow.com/q/25388716
has answer: http://stackoverflow.com/a/25405896
has answer: http://stackoverflow.com/a/25388809
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25388873
tagged with: android
has comment: http://stackoverflow.com/comment/39596518
has body: I have this bluetooth headset which sends messages everytime to the main Activity. Within the main activity, I have a handler which will process these messages and output accordingly. I have a fragment which will make use of the messages. I cannot find a way to send live data from MainActivity to the fragment and I don't want to copy/paste the handler code to the fragment. Is there a way to send live data from the mainActivity to the fragment. I am including some code for you to better understand. MainActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_dashboard); //Bluetooth headset which send live data tgDevice = new TGDevice(bluetoothAdapter, handler); tgDevice.connect(false); } /** * Handles messages from TGDevice * @param menu * @return */ private final Handler handler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case TGDevice.MSG_STATE_CHANGE: switch (msg.arg1) { case TGDevice.STATE_IDLE: break; case TGDevice.STATE_CONNECTING: //androidVersion.setText("Connecting...\n"); break; case TGDevice.STATE_CONNECTED: //androidVersion.setText("Connected" + "\t" +wifiInfo.getSSID()); tgDevice.start(); break; case TGDevice.STATE_NOT_FOUND: //tv.append("Can't find\n"); break; case TGDevice.STATE_NOT_PAIRED: //tv.append("not paired\n"); break; case TGDevice.STATE_DISCONNECTED: //tv.append("Disconnected\n"); } break; case TGDevice.MSG_POOR_SIGNAL: poorSignalValue = msg.arg1; actionBar.setTitle("Signal: " + poorSignalValue); Log.v("Poor", "Signal: " + poorSignalValue + "\n"); break; default: break; } } }; The Fragment will make use of the poorsignal as well as other variables. What is the best way to do this? Other fragments will also make use of the TGDevice.
has title: Send live data from Main Activity to Fragment
has answer: http://stackoverflow.com/a/49737385
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/39596121
tagged with: java
answer count: 4
type: Question

http://stackoverflow.com/comment/39594136
score: 0
type: AnswerComment
has text: so, what value should be assigned to variable "number"? in order to execute %1.25, what should be added? if you have any idea, please share. thnx
comment on: http://stackoverflow.com/a/25387581
type: Comment

http://stackoverflow.com/a/25382880
has comment: http://stackoverflow.com/comment/39586114
score: 0
has body: I solved a similar problem like this: batch.begin(); for (Ground ground : groundArray){ batch.draw(ground.getTextureRegion(), ground.x, ground.y); } batch.end(); For more info look HERE If you have some questions i will be happy to update my answer, just post in comments. There you go: public class Ground { public float x; float y; private TextureRegion texture; private Rectangle bounds; public Ground(float x, float y){ texture = Assets.atlas.findRegion("ground"); this.x = x; this.y = y; bounds = new Rectangle(x, y, 100, 498); } public TextureRegion getTextureRegion(){ return texture; } public Rectangle getBounds(){ return bounds; } } If you want to know about Asstes.atlas.findRegions look HERE
answers question: http://stackoverflow.com/q/25382002
type: Answer
has comment: http://stackoverflow.com/comment/39584844

http://stackoverflow.com/a/25364734
has comment: http://stackoverflow.com/comment/39550809
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25364437
has body: Create a Service to use a Timer to send an Intent. Let the intent contain some data so that the App knows it is supposed to run that method. http://developer.android.com/reference/android/app/Service.html http://developer.android.com/reference/java/util/Timer.html http://developer.android.com/reference/android/content/Intent.html Use putExtra to alert your app on what is happening. You should also check out this previous question How to set a timer in android.
score: 2
answers question: http://stackoverflow.com/q/25364437
has comment: http://stackoverflow.com/comment/39550706
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39583125
has text: No only phone statelistner is used
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25380932
type: QuestionComment

http://stackoverflow.com/q/25359104
has body: I'm trying to use a list iterator to walk a linked list and do some operations / checks on the next node depending on the integer value stored there, but I'm getting some errors in my code. I think I'm not understanding what iterator.next() is returning (some E object, but I don't know how to access the value I want from it) The editor wants me to do some casting as explained below. It gets rid of errors, but I don't know if this is a safe way to handle the problem or if it has the behavior I'm looking for. Please explain why I am getting errors and if there is a good way to handle this. LinkedList&lt;Integer&gt;[] hash = new LinkedList[list.size()]; hash = remo.createHash(hash, list.size()); ListIterator iterator = list.listIterator(0); // use the value of the integer stored at the next Node as its hash // and add the same value to the linked list at that bucket int i = 0; while(iterator.hasNext()){ hash[iterator.next()].add(iterator.next()); i++; } // reset iterator to beginning of list iterator = list.listIterator(0); // if the hash bucket corresponding to the value at that node has more than // one item in its list, remove that node from the list. while(iterator.hasNext()){ if(hash[iterator.next()].size()&gt;1){ iterator.remove(iterator.next()); } } createHash initializes each linked list in the array and remo is an instance of my class. the editor wants me to cast iterator.next() to an int hash[iterator.next()] and it wants me to cast it to an in .add(iterator.next()). Example: hash[(int)iterator.next()] hash[(int)iterator.next()].add((Integer)iterator.next());
type: Question
has answer: http://stackoverflow.com/a/25359195
tagged with: iterator
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25359242
score: 0
has title: Getting list values using Iterator Java
tagged with: list
has comment: http://stackoverflow.com/comment/39540121
tagged with: java
has comment: http://stackoverflow.com/comment/39539763

http://stackoverflow.com/comment/39569780
comment on: http://stackoverflow.com/q/25374588
has text: Why do you expect the image to be available in the gallery?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25246493
accepted answer: http://stackoverflow.com/a/25249932
type: AnsweredQuestion
score: 0
has title: JAXB removing unnecessary nested XML tag
tagged with: java
possible better answer: http://stackoverflow.com/a/25249219
has answer: http://stackoverflow.com/a/25249932
tagged with: jaxb
has answer: http://stackoverflow.com/a/25249219
tagged with: javax.xml
linked to: http://stackoverflow.com/q/17024050
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39487914
answer count: 2
has body: Currently I have following output from my program: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <foo name="Alex" status="Married"/> <foo name="Chris" status="Married with 2 children"/> As you can see, having both and tags is useless. I'd like to remove , so the output would look like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <foo name="Alex" status="Married"/> <foo name="Chris" status="Married with 2 children"/> Code that's generating first output is listed below: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Container { @XmlElement @XmlJavaTypeAdapter(MyAdapter.class) private Map<String, Foo> elements = new HashMap<String, Foo>(); public Container() { this.elements = new HashMap<String, Foo>(); } public Map<String, Foo> getElements() { return elements; } @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL) @XmlRootElement(name = "foo") static class Foo { @XmlAttribute public String name; @XmlAttribute public String status; public Foo(String name, String status) { this.name = name; this.status = status; } public Foo() { } } public static void main(String[] args) throws JAXBException { final JAXBContext context = JAXBContext.newInstance(Container.class); final Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); final Container c = new Container(); final Map<String, Foo> elementsMap = c.getElements(); elementsMap.put("e1", new Foo("Alex", "Married")); elementsMap.put("e2", new Foo("Chris", "Married with 2 children")); m.marshal(c, System.out); } } And MyAdapter class, based on JAXB @XmlAdapter: Map -> List adapter? (marshall only) : public class MyAdapter extends XmlAdapter<MyAdapter.AdaptedFoo, Map<String, Foo>> { static class AdaptedFoo { public List property = new ArrayList<>(); } public static class Property { @XmlAttribute public String name; @XmlElementRef(type = Foo.class) public Foo value; } @Override public Map<String, Foo> unmarshal(AdaptedFoo v) throws Exception { return …

http://stackoverflow.com/comment/39587968
comment on: http://stackoverflow.com/a/25366852
has text: No problem at all! I'm glad I was able to help!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39338561
type: Comment
comment on: http://stackoverflow.com/a/25249523
score: 0
type: AnswerComment
has text: The iteration begins and it's printing `temFoo: null` on the console.

http://stackoverflow.com/q/25356543
has answer: http://stackoverflow.com/a/25357046
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/39535834
upvote count: 1
has title: How do I make an array of arrays in Java
has body: I want to create a program that creates a deck of cards and to have an array of cards. Each card is also an array that holds two values, suit and value. So you would be able to do something like card[1] = [1,5] where 1 is the rank of the suite and 5 is the value of the card. It's been a long time since I have used Java so this is my project to reteach me how to program. Thanks in advance for the help!
linked to: http://stackoverflow.com/q/4781100
tagged with: arraylist
has answer: http://stackoverflow.com/a/25357604
has comment: http://stackoverflow.com/comment/39535066
answer count: 3
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/4781100
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39535138
has answer: http://stackoverflow.com/a/25356557
has comment: http://stackoverflow.com/comment/39535063
type: UnansweredQuestion

http://stackoverflow.com/a/25381442
upvote count: 2
has comment: http://stackoverflow.com/comment/39581841
type: Answer
has body: ThreadLocal is different. SingleTon is different. ThreadLocal Even singleton object has different thread local in different thread. For ex, A is a singleton reference. A can be shared in multiple threads. So each thread has thread specific thread local value. Singleton Only one object exists in JVM at a time.
answers question: http://stackoverflow.com/q/25381396
score: 1
downvote count: 1

http://stackoverflow.com/q/25336278
has title: JSP NullPointer StandardWrapperValve[servlets. ]: Servlet.service() for servlet servlets. threw exception java.lang.NullPointerException
tagged with: jsp
has answer: http://stackoverflow.com/a/63762357
possible better answer: http://stackoverflow.com/a/63762357
has answer: http://stackoverflow.com/a/25336506
accepted answer: http://stackoverflow.com/a/25336506
has body: I'm trying to learn how to work with JSP. And I encountered something, which makes no sense, at least in my opinion: When I try to run: response.getWriter().println(m.getDb().printAll()); I get this when trying to load the page in question: 2014-08-16T03:19:59.789+0200|Warning: StandardWrapperValve[servlets.GUI]: Servlet.service() for servlet servlets.GUI threw exception java.lang.NullPointerException at servlets.GUI.doGet(GUI.java:39) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilter…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39506926
has comment: http://stackoverflow.com/comment/39501960
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39507615
favorite count: 0
type: Question
answer count: 2

app-bundle
type: Tag
tags question: http://stackoverflow.com/q/25267364
tag name: app-bundle

http://stackoverflow.com/comment/39321039
type: Comment
comment on: http://stackoverflow.com/a/25240155
score: 0
type: AnswerComment
has text: @stealthjong that's absolutely not correct. Because, from xml the developer would have given default value to be 3 or 4. So the check would be incorrect

http://stackoverflow.com/comment/39422479
has text: Then it is expecting int only. Please remove `String.ValueOf()`. Sorry about that! May be you can share your entire code to check. I cannot see anyother way to figure this out. Since my answer solved your original question please accept it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25292607
type: AnswerComment

http://stackoverflow.com/a/25340328
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25340113
has body: Create your own class with a main method which installs a shutdown hook to save before closing. then invoke the original programs main method. add this to the jar and use this class to launch the program.
type: Answer
answers question: http://stackoverflow.com/q/25340113
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25362078
answer count: 5
has answer: http://stackoverflow.com/a/25362419
has comment: http://stackoverflow.com/comment/39545224
tagged with: android
has answer: http://stackoverflow.com/a/25362213
has comment: http://stackoverflow.com/comment/39545181
score: -1
accepted answer: http://stackoverflow.com/a/25362206
has answer: http://stackoverflow.com/a/25362224
type: AnsweredQuestion
has body: I was trying to create a sign up form for my Android application This is my XML code <TextView android:id="@+id/mynumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Number +961" android:textSize="20sp" android:color="@android:color/white" /> <EditText android:id="@+id/editTextNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="Number" android:textColor="#FFFFFF" /> If you notice the first LinearLayout has a horizontal orientation and gravity (I want both the textview and edit text to be next to each others) After the first linear layout i want the create account button to come out However it is showing up on the same line with the previous edit text and text view Any idea if i should change in the settings of the second linear layout
upvote count: 0
has title: LinearLayout on android
has comment: http://stackoverflow.com/comment/39545180
has comment: http://stackoverflow.com/comment/39545132
has comment: http://stackoverflow.com/comment/39545250
tagged with: java
downvote count: 1
tagged with: android-linearlayout
has answer: http://stackoverflow.com/a/25362306
possible better answer: http://stackoverflow.com/a/25362213
has answer: http://stackoverflow.com/a/25362206
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/comment/97578475
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25231004
score: 0
has text: how to get result like **765 Xyz 987** for **765Xyz987** , **765 Xyz** for **765Xyz**, and **Xyz 987** for **Xyz987**. If possible a common command maybe? If not, separate command.

http://stackoverflow.com/q/25270171
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/55508635
favorite count: 0
has body: I want to implement scroll to refresh functionality with a listView. Also there are other view elements in the same layout file which are displayed if the list is empty. Here is my layout file. The problem is that when I scroll down and then try to scroll up, instead of scrolling all the way to the top and then refreshing it just refreshes there and scroll up is not working. &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="64dp" android:paddingLeft="16dp" android:paddingRight="16dp" &gt; &lt;ImageView android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:src="@drawable/inbox_empty" /&gt; &lt;TextView android:id="@+id/noEventsText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="16dp" android:layout_toRightOf="@+id/noEventsIcon" /&gt; &lt;View android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="1px" android:layout_alignParentBottom="true" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android:background="@color/dividerOnBlack" /&gt; &lt;/RelativeLayout&gt; &lt;ListView android:id="@+id/list_items" android:layout_width="match_parent" android:layout_height="fill_parent" android:cacheColorHint="@android:color/transparent" android:choiceMode="multipleChoice" android:descendantFocusability="afterDescendants" android:divider="@android:color/transparent" android:dividerHeight="0px" android:scrollbars="none" /&gt; &lt;/LinearLayout&gt; &lt;/android.support.v4.widget.Swi…
type: Question
linked to: http://stackoverflow.com/q/11295080
answer count: 12
downvote count: 0
tagged with: swiperefreshlayout
has answer: http://stackoverflow.com/a/32736440
has answer: http://stackoverflow.com/a/67435959
has title: Scroll up does not work with SwipeRefreshLayout in Listview
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26728632
has answer: http://stackoverflow.com/a/35779571
has answer: http://stackoverflow.com/a/27690074
has answer: http://stackoverflow.com/a/66474348
upvote count: 39
score: 39
has answer: http://stackoverflow.com/a/58017688
has answer: http://stackoverflow.com/a/32729673
has answer: http://stackoverflow.com/a/64016539
has answer: http://stackoverflow.com/a/26100003
has answer: http://stackoverflow.com/a/55921387

http://stackoverflow.com/a/25308208
answers question: http://stackoverflow.com/q/25307720
has comment: http://stackoverflow.com/comment/39447032
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39446728
has body: First a bit of bad news: FileReader is a utility class that as default uses the platform encoding: non-portable. As the encoding is defined in the XML source itself, you might keep to InputStream if possible. You could keep the XML as read-only resource inside the war/ear. Or as read-only resource in the jboss directories, outside the application. Using as java resource via the system ClassLoader of jboss. Or as file, where the path is configured as above. Maybe in an existing properties/xml configuration file. You could also use the jboss admin console to configure a path. Maybe of interest: System.getProperty("file.encoding"); // The default encoding System.getProperty("user.name"); // Under which user are we running System.getProperty("user.home"); // The user's home System.getProperty("user.dir"); // The applications working dir JBoss also defines a couple of things; but that would be non-portable.
type: Answer
upvote count: 1

http://stackoverflow.com/a/25312229
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39595846
accepted answer of: http://stackoverflow.com/q/25309435
downvote count: 0
type: Answer
upvote count: 1
has body: It seems the endpoint is currently down. Worth trying in a few hours, or you can set up your own spotlight server very easily
answers question: http://stackoverflow.com/q/25309435
score: 1

http://stackoverflow.com/comment/39596253
type: Comment
type: QuestionComment
has text: Is this a guessing game.. "Guess what my exception is"?
comment on: http://stackoverflow.com/q/25388419
score: 4

http://stackoverflow.com/q/25237345
has comment: http://stackoverflow.com/comment/39315368
has answer: http://stackoverflow.com/a/25237544
upvote count: 12
has comment: http://stackoverflow.com/comment/39315539
has answer: http://stackoverflow.com/a/25247143
possible better answer: http://stackoverflow.com/a/25238371
answer count: 6
has answer: http://stackoverflow.com/a/39496647
tagged with: class
score: 12
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39315457
has comment: http://stackoverflow.com/comment/39315359
has comment: http://stackoverflow.com/comment/39315249
has answer: http://stackoverflow.com/a/56990616
tagged with: java
has answer: http://stackoverflow.com/a/59749536
downvote count: 0
has answer: http://stackoverflow.com/a/25238371
has title: How to run java class file which is in different directory?
favorite count: 0
has body: Directory path: c:\home\test\src\com\bsoft\conc I have my java program in src folder and I have my class file in conc folder. I need to run my java program from home folder.When I run I'm getting error: could not find or load main class
type: Question
accepted answer: http://stackoverflow.com/a/25247143

http://stackoverflow.com/comment/39315750
score: 0
comment on: http://stackoverflow.com/a/25233472
type: Comment
type: AnswerComment
has text: @mKorbel I could return `Void` for the first example, but I think I was going to demonstrate using `get` to get the `Object[][]` row data as well, but went a different direction...it's all contextual, hence the point for three examples ;) - It also demonstrates possible error handling

http://stackoverflow.com/comment/39367856
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25265734
has text: Could you add the exception your receiving to the question?

http://stackoverflow.com/comment/39474203
comment on: http://stackoverflow.com/a/25309351
has text: No ... I don't think it proves it. It supports my theory though. Also, sync probably isn't the way to maximize copy throughput. But then again, I'm not convinced that your test is a realistic way to measure copy throughput. (Repeatedly copying the same file ....)
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39596409
type: Comment
score: 0
type: AnswerComment
has text: I still get No object for refid=AccessLog. What else do you have in your config?
comment on: http://stackoverflow.com/a/25388227

http://stackoverflow.com/a/25338908
has comment: http://stackoverflow.com/comment/39556738
has comment: http://stackoverflow.com/comment/39692954
has comment: http://stackoverflow.com/comment/40019636
has comment: http://stackoverflow.com/comment/39620627
has comment: http://stackoverflow.com/comment/39547010
type: Answer
has body: The SwingWorker API outlines a suitable approach. Because of the size, I'd update a TableModel, as shown here, rather than a text component. Lines will begin appearing almost immediately, while the GUI remains responsive. The listening JTable will need to render only visible lines, and you may be able to leverage sorting and filtering.
has comment: http://stackoverflow.com/comment/39544540
has comment: http://stackoverflow.com/comment/39994345
has comment: http://stackoverflow.com/comment/39620017
has comment: http://stackoverflow.com/comment/40009213
has comment: http://stackoverflow.com/comment/39536209
answers question: http://stackoverflow.com/q/25336981
has comment: http://stackoverflow.com/comment/39810092
score: 1
has comment: http://stackoverflow.com/comment/39622379
downvote count: 0
has comment: http://stackoverflow.com/comment/40031431
has comment: http://stackoverflow.com/comment/39612299
upvote count: 1

http://stackoverflow.com/a/26559990
has body: Make sure that the both domain classes have the according package that they should. That should be the first line of both files. Did you create them with grails create-domain or just copy pasted? You could make unit-test for both files individually and then together to see if they have other problem that is causing this Also more information about the domain classes would be good, can you provide the whole code?
downvote count: 1
score: -1
type: Answer
has comment: http://stackoverflow.com/comment/41740813
upvote count: 0
answers question: http://stackoverflow.com/q/25259864

http://stackoverflow.com/q/25301277
tagged with: android
has comment: http://stackoverflow.com/comment/39436936
tagged with: android-intent
has answer: http://stackoverflow.com/a/25301478
has comment: http://stackoverflow.com/comment/39433999
type: AnsweredQuestion
score: 2
answer count: 2
has answer: http://stackoverflow.com/a/25302637
upvote count: 2
tagged with: java
has title: onHandelIntent() function in android
downvote count: 0
accepted answer: http://stackoverflow.com/a/25301478
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25302637
has body: This is a small snippet from http://developer.android.com/guide/components/services.html which describes services in android. public class HelloIntentService extends IntentService { /** * A constructor is required, and must call the super IntentService(String) * constructor with a name for the worker thread. */ public HelloIntentService() { super("HelloIntentService"); } /** * The IntentService calls this method from the default worker thread with * the intent that started the service. When this method returns, IntentService * stops the service, as appropriate. */ @Override protected void onHandleIntent(Intent intent) { // Normally we would do some work here, like download a file. // For our sample, we just sleep for 5 seconds. long endTime = System.currentTimeMillis() + 5*1000; while (System.currentTimeMillis() &lt; endTime) { synchronized (this) { try { wait(endTime - System.currentTimeMillis()); } catch (Exception e) { } } } } } Concept: onStartservices() handles the thread synchronization itself as mentioned and synchronized is used to handle synchronization Question. why is synchronization(this) explicitly defined even though onstartservices() takes care of it?

http://stackoverflow.com/q/25384023
has comment: http://stackoverflow.com/comment/39587200
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25384074
score: 5
has answer: http://stackoverflow.com/a/25384045
tagged with: key-value
has comment: http://stackoverflow.com/comment/39587330
has title: Best collection to use for small number of key-value pairs in Java
has answer: http://stackoverflow.com/a/25384074
has body: I'm currently creating a prototype of a Rock-Paper-Scissors program and I need to store the selections in an Integer-String format. What would be the "best" collection to use, in terms of speed of searching and memory usage? The premise being that the computer will pick a random number, then the key-value pairs are searched to find the appropriate selection name for use later in the program. EDIT: To clarify, there will be at most 5 key-value pairs in the collection, with Integers as the keys.
has comment: http://stackoverflow.com/comment/39587300
has answer: http://stackoverflow.com/a/25385797
upvote count: 6
has answer: http://stackoverflow.com/a/25384177
answer count: 4
possible better answer: http://stackoverflow.com/a/25384045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39587595
tagged with: java
has comment: http://stackoverflow.com/comment/39587791
tagged with: collections

http://stackoverflow.com/a/50232033
score: 1
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25346712
has body: This is possible using classes of tess4j i.e ImageDeskew &amp; ImageHelper ImageDeskew imgdeskew=new ImageDeskew(img); // BufferedImage img ImageHelper.rotateImage(bim, -imgdeskew.getSkewAngle()); // rotateImage static method

http://stackoverflow.com/comment/39432967
type: AnswerComment
score: 0
has text: but shouldn't rounding be rounding? So if I want to round something that is smaller than zero but greater than minus half I should expect -0?
comment on: http://stackoverflow.com/a/25286903
type: Comment

http://stackoverflow.com/q/25334139
has comment: http://stackoverflow.com/comment/39500481
has answer: http://stackoverflow.com/a/56267474
tagged with: powermock
has title: how to mock a URL connection
has answer: http://stackoverflow.com/a/55451970
score: 18
has answer: http://stackoverflow.com/a/52957731
has body: Hi I have a method that takes an URL as an input and determines if it is reachable. Heres the code for that: public static boolean isUrlAccessible(final String urlToValidate) throws WAGNetworkException { URL url = null; HttpURLConnection huc = null; int responseCode = -1; try { url = new URL(urlToValidate); huc = (HttpURLConnection) url.openConnection(); huc.setRequestMethod("HEAD"); huc.connect(); responseCode = huc.getResponseCode(); } catch (final UnknownHostException e) { throw new WAGNetworkException(WAGConstants.INTERNET_CONNECTION_EXCEPTION); } catch (IOException e) { throw new WAGNetworkException(WAGConstants.INVALID_URL_EXCEPTION); } finally { if (huc != null) { huc.disconnect(); } } return responseCode == 200; } I want to unit test the isUrlAccessible() method using PowerMockito. I feel that I will need to use whenNew() to mock the creation of URL and the when url.openConnection() is called, return another mock HttpURLConnection object. But I have am not sure how to implement this? Am I on the right track? Can anyone help me in implementing this?
tagged with: jmockit
upvote count: 18
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/68843300
accepted answer: http://stackoverflow.com/a/25334710
tagged with: mocking
possible better answer: http://stackoverflow.com/a/25334350
tagged with: java
tagged with: junit
has answer: http://stackoverflow.com/a/25334710
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/25334350
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/56677860

http://stackoverflow.com/a/25234683
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25234401
upvote count: 2
has body: Null check for getData isn't always done twice in the first example. It is only ensured to get done no matter what. The &amp;&amp; operator checks if left condition is true (if obj.getType != null), and only if it is, does it proceed on with checking the second one (if obj.getData() != null). &amp;&amp; and || are lazy operators. If they can determine the value of whole boolean statement after checking the first condition, then they do not go onto examining the others - unlike &amp; or |. Second version doesn't ever check for obj.getData value unless the outer condition is met. If it is not, you never get to reach the second block.
downvote count: 0

http://stackoverflow.com/q/25235475
has comment: http://stackoverflow.com/comment/39312253
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25235539
has title: Read from System.in in hh:mm format with delimiter
has answer: http://stackoverflow.com/a/25235539
has body: i'm trying to read from the System.in something like this: hh:mm (for example: 17:10, 9:32, etc.) I also want to store the number before the colon into "hour" variable and the one after into "minute" variable. My code so far is like this: import java.util.Scanner; Scanner in = new Scanner(System.in); in.useDelimiter(":|\\n"); int hour = 0, minute = 0; while (in.hasNext()){ hour = in.nextInt(); minute = in.nextInt(); System.out.println("Hour is : " + hour); System.out.println("Minute is : " + minute); } However, when I run it and type in "9:10" then PRESS ENTER for example, I got this: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) If i put this instead: in.useDelimiter(":"); then it only reads in the first number (the "hour"), it only reads in the second number (the "minute" when I key in 9:10: (note the second colon). Could you guys help?
has comment: http://stackoverflow.com/comment/39314996
accepted answer: http://stackoverflow.com/a/25241151
has comment: http://stackoverflow.com/comment/39311928
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25241151
tagged with: java
has comment: http://stackoverflow.com/comment/39312391
tagged with: delimiter

http://stackoverflow.com/comment/39623128
type: AnswerComment
has text: Depends, if you want to get each one, you need to know each type. You could use `Set`, which will allow you to iterate over the `classtype` values, adding each value to it and will ensure that there are no duplicates, with that in had, you would then need to simply iterate over the set and replace `"1"` with the value from the `Set`...
comment on: http://stackoverflow.com/a/25376107
score: 0
type: Comment

http://stackoverflow.com/q/25349000
has comment: http://stackoverflow.com/comment/39521837
tagged with: java
has body: Until a day ago I ran jar files (jdownloader) fine and suddenly it couldn't but it was trying to find an app to run it. I changed it to use the jre environment, but then it would do like it was trying to open and then nothing. I uninstalled the jre and installed it again but the same. It doesn't produce an error or anything but it just loads for a while (the mouse changing to the loading animation) and then nothing, like it ran but the end result was just nothing Running java -jar path_to_jar Exception in thread "main" java.lang.NoClassDefFoundError: it/sauronsoftware/junique/AlreadyLockedException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: it.sauronsoftware.junique.AlreadyLockedException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more
has comment: http://stackoverflow.com/comment/39521457
has title: JAR file won't run BUT it doesn't produce an error
type: Question
has comment: http://stackoverflow.com/comment/39521750
answer count: 0
type: UnansweredQuestion
tagged with: jar
has comment: http://stackoverflow.com/comment/39521591
score: 0

http://stackoverflow.com/comment/39435373
type: Comment
type: AnswerComment
has text: Nice site JB. Luckily I didn't struggle with French throughout my primary/highschool for nothing. It's Return-Of-Investment time.
score: 0
comment on: http://stackoverflow.com/a/25301442

jlist
tags question: http://stackoverflow.com/q/25373037
tags question: http://stackoverflow.com/q/25363408
tags question: http://stackoverflow.com/q/25294939
tag name: jlist
type: Tag

http://stackoverflow.com/q/25233964
has title: Creating an Eraser for an Android Drawing App
score: 0
tagged with: java
answer count: 1
type: Question
tagged with: eraser
has body: I'm working on a drawing application and am pretty close to release but I'm having issues with the eraser part of the app. I have 2 main screens (fragments) one is just a blank white canvas that the user can draw on with some options and so on. The other is a note taking fragment. This note taking fragment looks like notebook paper. So for erasing on the drawing fragment, I can simply use the background of the canvas and the user wont know the difference. On the note fragment though I cannot do this beacuse I need to keep the background in tact. I have looked into PorterDuffer modes and have tried the clear version and tried to draw onto a separate bitmap but nothing has worked. If there was a way to control what gets draw ontop of what then that would be useful. I'm open to any suggestions, I can't seem to get anything to work. Ive also played with enabling a drawing cache before erasing and that doesn't work. In addition I tried hardware enabling and that made my custom view behave oddly. Below is the relavent code. My on draw methods goes through a lot of paths because I am querying them in order to allow for some other functionallity. @Override protected void onDraw(Canvas canvas) { //draw the backgroumd type if(mDrawBackground) { //draw the background //if the bitmap is not null draw it as the background, otherwise we are in a note view if(mBackgroundBitmap != null) { canvas.drawBitmap(mBackgroundBitmap, 0, 0, backPaint); } else { drawBackgroundType(mBackgroundType, canvas); } } for (int i = 0; i &lt; paths.size(); i++ ) { //Log.i("DRAW", "On draw: " + i); //draw each previous path. mDrawPaint.setStrokeWidth(strokeSizes.get(i)); mDrawPaint.setColor(colors.get(i)); canvas.drawPath(paths.get(i), mDrawPaint); } //set paint attributes to the current value mDrawPaint.setStrokeWidth(strokeSize); mDrawPaint.setColor(mDrawColor); canvas.drawPath(mPath, mDrawPaint); } and my draw background method /** * Method that actually draws the notebook paper background * @param c…
has answer: http://stackoverflow.com/a/25235430
accepted answer: http://stackoverflow.com/a/25235430
tagged with: android
tagged with: android-canvas
type: AnsweredQuestion

http://stackoverflow.com/a/47752609
has body: There have Some Simple Methods to Highlight Text with case insensitive order. You can use one of this examples within 1 minutes. https://stackoverflow.com/a/47751719/3036320
answers question: http://stackoverflow.com/q/25324620
score: 0
type: Answer

http://stackoverflow.com/a/25308442
answers question: http://stackoverflow.com/q/25304721
type: AcceptedAnswer
downvote count: 0
has body: As a first point that may or may not make much difference, you can use a property path to simplify { ?position skos:prefLabel ?label. } UNION { ?position skos:altLabel ?label. } as ?position skos:prefLabel|skos:altLabel ?label This makes the query: SELECT ?position WHERE { ?s rdf:type esco:Occupation. # (1) ?position skos:prefLabel|skos:altLabel ?label # (2) FILTER (lcase(?label)="acuponcteur"@fr ) } What's the point of ?s in this query? There are some number n of ?position/?label pairs that match (2), and some number m values of ?s that match (1). The number of results that you get from the query is m&times;n, but you never use the value of ?s. It looks like you used DISTINCT to get rid of some repeated values, but you didn't look to see why you were getting repeated values in the first place. You should simply remove the useless line (1), and have the query: SELECT DISTINCT ?position WHERE { ?position skos:prefLabel|skos:altLabel ?label FILTER (lcase(?label)="acuponcteur"@fr ) } I wouldn't be surprised if, at the point, you don't even need the DISTINCT anymore.
type: Answer
has comment: http://stackoverflow.com/comment/39447752
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/25304721

http://stackoverflow.com/comment/39541353
score: 0
has text: @Christine small typo as I was originally checking it's not empty, correct form is `if (someString==null || someString.isEmpty())`
comment on: http://stackoverflow.com/q/25359512
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25279774
has body: Because you are using @GeneratedValue() It will look for how the database that you are using generates ids. For MySql or HSQSL, there are increment fields that automatically increment. In Postgres or Oracle, they use sequence tables. Since you didn't specify a sequence table name, it will look for a sequence table named hibernate_sequence and use it for default. So you probably don't have such a sequence table in your database and now you get that error. Either add a hibernate_sequence like @GeneratedValue(strategy=SEQUENCE) or your own sequence table and use the annotations to name your sequence table that you have like @GeneratedValue(strategy=SEQUENCE, generator="student_id_seq") Hope that helps
type: Answer
answers question: http://stackoverflow.com/q/25279423
score: 0

http://stackoverflow.com/comment/39552104
score: 0
comment on: http://stackoverflow.com/a/25365385
has text: Worked for the navigation, but how can I pass values? Lets say I select a row in "GeneralView" and get redirected to "DetailedView", how can I pass the data (object, row)?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25366308
type: Question
has title: How to implement a deep copy of an object that contains an array of objects in Java?
accepted answer: http://stackoverflow.com/a/25366380
tagged with: clone
has answer: http://stackoverflow.com/a/25366380
type: AnsweredQuestion
score: 0
tagged with: java
has body: I need to make a class called Garage implement Cloneable and override the Object.clone() method to make a deep copy of an object of type Garage which contains an array of objects of type Vehicle. I have read on several SO answers that Cloneable is broken and it is wise not to use it, but my lab assignment demands that I implement Cloneable and code a proper clone() method. I have been looking for long but still haven't been able to do this. Any help would be much appreciated. This is my code for the Garage class: public class Garage extends Vehicle implements Cloneable { // array to store up to 15 Vehicle objects Vehicle array[] = new Vehicle[15]; // overriding the clone method to perform a deeper copy @Override protected Object clone() throws CloneNotSupportedException { //TODO } } This is my code for the Vehicle class: public class Vehicle { int numWheels; int ID; String name; }
answer count: 1

http://stackoverflow.com/q/25235227
has title: Tooltip for Vaadin Table column header
score: 5
has comment: http://stackoverflow.com/comment/88537500
type: UnansweredQuestion
upvote count: 5
has comment: http://stackoverflow.com/comment/88537178
tagged with: vaadin7
has body: Can I add a tooltip to a column header in a Vaadin Table? Motivation Table columns are often abbreviated to fit the width of their rows’ content. It would be nice for the user if the full-length version the column title could be presented as a tooltip. For buttons and labels and such, I can call setDescription to specify text for an automatic tooltip. Is there some way to do this for a Table header? Similar Discussions I found this Question for adding tooltips to rows and cells. I found this Vaadin Forum posting on hacking some HTML for tooltip on an icon in a table header. But I want just a simple tooltip on a header, and have not found such information. I have read the Table page in the Book of Vaadin. Assuming no such feature is available, I have filed this feature request # 14419.
linked to: http://stackoverflow.com/q/7558119
answer count: 0
linked to: http://stackoverflow.com/q/35411106
tagged with: java
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/a/25372020
score: 4
has comment: http://stackoverflow.com/comment/39564891
type: Answer
accepted answer of: http://stackoverflow.com/q/25371805
answers question: http://stackoverflow.com/q/25371805
upvote count: 4
type: AcceptedAnswer
has body: Ok so I did some digging... I wrote up a little program probably close to what you did. public class IntTest { public static void main(String[] args){ int a = 7; int b = -7; System.out.println(Integer.toBinaryString(a)); System.out.println(Integer.toBinaryString(b)); } } My output: 111 11111111111111111111111111111001 So 111 is the same if it had 29 "0"s in front of it. That is just wasted space and time. If we follow the instructions for twos compliment from this guy here you can see that what we must do is flip the bits ( zeros become ones and ones become zeros ) then we add 1 to the result. So 0000 0000 0000 0000 0000 0000 0000 0111 becomes 1111 1111 1111 1111 1111 1111 1111 1001 The ones can not be thrown out because they are significant in the twos compliment representation. This is why you have 32 bits in the second case. Hope this helps! -- Code on!!!
downvote count: 0
has comment: http://stackoverflow.com/comment/39564983

http://stackoverflow.com/a/25301447
accepted answer of: http://stackoverflow.com/q/25300525
has body: The original meaning of 'portable' was 'costs less to convert to a new platform than it does to rewrite for the new platform'. As languages evolved and vendor lock-ins reduced, it has since morphed to mean several things including binary compatibility and source-code compatibility. 'Platform-independent' means that there is nothing in the system or its specification that is inherently bound to a single platform. They're related, but not the same thing.
type: Answer
answers question: http://stackoverflow.com/q/25300525
upvote count: 6
has comment: http://stackoverflow.com/comment/39434631
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39440941
score: 6

http://stackoverflow.com/comment/39445541
has text: All are float variables @sᴜʀᴇsʜᴀᴛᴛᴀ
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25307473
type: QuestionComment

http://stackoverflow.com/comment/39460457
score: 0
comment on: http://stackoverflow.com/a/25314775
has text: declare that outside the setOnClick
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39560441
score: 0
has text: Incidentally, "Prefer lists to arrays" is item 25 in Effective Java, Second Edition.
comment on: http://stackoverflow.com/q/25369715
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25258046
downvote count: 1
has answer: http://stackoverflow.com/a/25258218
has comment: http://stackoverflow.com/comment/39356327
favorite count: 0
score: 8
type: Question
upvote count: 9
has body: May I know what is the difference between POJO (Plain old java object) and DAO (Data access object) in Java. Where to use which one? From the Jboss hibernate tutorial (http://docs.jboss.org/hibernate/orm/4.2/manual/en-US/html/ch04.html#persistent-classes-pojo), why POJO is used with database if we have DAO? Thanks in advance
has comment: http://stackoverflow.com/comment/39354097
has comment: http://stackoverflow.com/comment/39354115
has answer: http://stackoverflow.com/a/25258129
type: UnansweredQuestion
has title: What is the difference between POJO and DAO
linked to: http://stackoverflow.com/q/19154202
tagged with: pojo
has comment: http://stackoverflow.com/comment/39354319
tagged with: dao
answer count: 2
tagged with: java